How to preserve i18n with shared resource bundles while overriding command name? #1749
-
Hey! Now I have a rather specific question: I'm developing a command line application which implements a standardized command line interface which acts as a front-end for an API. Now my issue is: I internationalized the CLI frontend with the help of a shared resource bundle. There I have strings like "parent.subcommand.usage.header".
from inside the backend, "parent.subcommand.usage.header" can no longer be resolved (it would need to read "backendXY.subcommand.usage.header" now). This coupling of user-facing command name and internal resolution of i18n resources is unfortunate. What is the best way to work around this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
I suppose one solution would be to switch from shared resource bundles to individual resource bundles for each (sub-)command. |
Beta Was this translation helpful? Give feedback.
-
Hi @vanitasvitae, can I ask you a favor?
That should publish |
Beta Was this translation helpful? Give feedback.
Hi @vanitasvitae, can I ask you a favor?
Can you check out the project and build it and try with that version of picocli?
The reason I ask is that this would allow you to use some recent changes (#1710 and #1706):
That would allow you to have separate resource bundles for each subcommand, while still have shared entries in the root command for strings that are common across commands.
That should publish
picocli-4.7.0-SNAPSHOT
to your local .m2 Maven cache. You can then try this in a project that uses theinfo.picocli:picocli:4.7.0-SNAPSHOT
dependency.