-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
deps: Move from github.com/gohugoio/go-i18n/v2 => github.com/nicksnyder/go-i18n/v2 #14065
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
base: master
Are you sure you want to change the base?
Conversation
28d2c1f to
057b443
Compare
602fc0e to
ff41741
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Migrate from the deprecated github.com/gohugoio/go-i18n/v2 to the canonical github.com/nicksnyder/go-i18n/v2 and adapt Hugo’s i18n handling accordingly.
- Replace imports and module dependency to nicksnyder/go-i18n/v2
- Introduce a bundleBuilder to handle unsupported/artificial language tags by remapping to real tags and parsing translation files
- Update Translator to work with the new bundle wrapper and adjust language key handling
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| langs/i18n/translationProvider.go | Replaces direct i18n.Bundle setup with a bundleBuilder abstraction; adds logic to remap undefined/artificial language tags to real tags; updates translator initialization. |
| langs/i18n/i18n.go | Updates Translator to work with the new internal bundle wrapper and adjusts language key normalization and logging. |
| go.mod | Removes github.com/gohugoio/go-i18n/v2 and adds github.com/nicksnyder/go-i18n/v2 v2.6.0. |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
ff41741 to
7aa0247
Compare
|
@jmooring what do you think about this PR/strategy? |
b2889ba to
463eecd
Compare
First, thanks for the key and private use subtag length checks. Second, I don't fully understand (and I don't need to at the moment) the approach of using a defined (but unused) language tag when we encounter an arbitrary language tag ( One of my concerns was how this would effect localization with arbitrary/artificial languages, but this still seems to be based on the site config key, not the language object we hijacked, so that looks good. I spot tested localization of times and currencies, as well as pluralization. I did not test collation. But I did find one issue. Consider these translation tables: If I purposely omit translating the word "foo" in each of the tables, then run If |
Yea, this is the The above isn't the best workaround in the world, but the fact that I had forgot that we had forked the go-i18n library tells me that we needed to fix this, and it probably also makes an argument about deprecate the use of "fake" language codes in the future. |
…er/go-i18n/v2 Closes gohugoio#14064
463eecd to
ffc2d80
Compare
Closes #14064