deps: Move from github.com/gohugoio/go-i18n/v2 => github.com/nicksnyder/go-i18n/v2#14065
deps: Move from github.com/gohugoio/go-i18n/v2 => github.com/nicksnyder/go-i18n/v2#14065bep wants to merge 1 commit intogohugoio:masterfrom
Conversation
28d2c1f to
057b443
Compare
602fc0e to
ff41741
Compare
There was a problem hiding this comment.
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
|
For documentation planning purposes, will this PR be included in 0.153.0 or deferred to a later date? I have no opinion either way. |
|
It will be delayed. I have enough on my plate as it is, and its not important (and I have some hesitations about the approach). |
Closes #14064