-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Artificial language codes longer than 8 alphanumeric characters break i18n #9119
Comments
Or maybe we could just change the documentation, specifying a valid pattern. |
@jmooring :) Some background: I still try to find a solution to #8279 where I need to have more fine grained control over which path prefix is used in a mutli lang setup. Maybe we could come up with a more stable way of linking the language to the read-in i18n files - maybe the languageCode if present? |
Let's continue the discussion at #8279. |
/
break i18n
So, yes, the documentation here needs to be changed from:
To something like:
There's a related issue about language tag vs. locale. The outcome of that investigation may affect the examples above. In addition to the required documentation change, there's a bug. The i18n file is ignored when the language tag is nine or more characters. Example: git clone --single-branch -b hugo-github-issue-9119 https://github.com/jmooring/hugo-testing hugo-github-issue-9119
cd hugo-github-issue-9119
hugo server With this configuration:
Hugo parses It fails because nicksnyder/go-i18n parses the language tag too, also using golang.org/x/text/language. It determines that We should re-validate the language tag after prepending |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
When using a language with a custom key including a slash the generated translate function keys won't match the i18n translation files.
According to the documentation:
When using a language config like this:
The generated translate function will use the i18n translation file names as keys.
But executing the translation, the lookup key will be using the original languages key (
"fragen"
and"en/questions"
respectively)Since I cannot name the translation files including a slash, I tried replacing it with a colon, but had no success.
For me this patch works, but it is hardly a generic solution
What version of Hugo are you using (
hugo version
)?Does this issue reproduce with the latest release?
Yes
The text was updated successfully, but these errors were encountered: