-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Feat: Add minimal support for i18n #1789
Conversation
Ack sorry about the conflicts! 😭 |
|
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.
- This is very exciting! 🎉
- It looks like the generated catalog code sets the
message.DefaultCatalog
package-level variable 🤔 Does this mean that this library is intended for use at the application level and not from a dependency likegithub.com/urfave/cli/v3
? - Is there supposed to be an import of
_ "github.com/urfave/cli/v3/internal/translations"
somewhere in the top level so that the catalog is initialized? - I had to manually install
gotext
to get this working locally. Can agotext
-ensuring command be added tointernal/build/build.go
like the one that ensuresgoimports
exists?
|
@dearchap Thank you! I sincerely appreciate your work on this 🤘🏼 I'm still confused about the intended usage given this line in the generated code. How is this supposed to work if Given that the template file for the generated code hasn't been touched in ~4 years, I'm wondering if using |
@meatballhat you have a keen eye. I tested cli with these changes along with a sample app that uses its own catalog and basically the translation doesn't work as one catalog overrides the other due to the message.DefaultCatalog in init. I'm going to redo this PR. |
@meatballhat I've hacked around the package global Catalog initialization. I dont like it but this is what we have until support for multiple Catalogs is rolled into the text/message package itself. For now this is the simplest route without adding dependencies on other i18n libraries which look to me more heavyweight |
@meatballhat Also I'm not sure why only the window tests are failing. Can you take a look ? |
Offhand I don't see why that failure is happening 🤔 Can the |
What type of PR is this?
(REQUIRED)
What this PR does / why we need it:
(REQUIRED)
Enable basic internalization support for urfave/cli
Which issue(s) this PR fixes:
(REQUIRED)
Fixes #980
Special notes for your reviewer:
(fill-in or delete this section)
Testing
(fill-in or delete this section)
Release Notes
(REQUIRED)