-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add translations for helps. #18
Comments
One wrinkle here is that typer adds some of the help text for (i.e. --help) - that may eventually be wrapped in gettext and if it is - how do the native python translation and django translation systems work together? |
Does django have translations for the common options? |
We will not translate error messages presented on the terminal per Django's practice. I do think translating the default CLI helps is important because the CLI interface may be used by non-devs. Consider using google translate: https://github.com/ankitpopli1891/django-autotranslate |
What is the rationale behind including it? Will it be an optional dependency? And shouldn't it be up to the project, including django-typer to supply the translation? I would use django-translate either for all of my project or not at all. But it would surprise me, if one third-party library handles it on its own. |
It would only be a development dependency, it wouldn't register on pypi at all. Translations would be produced at package time. Django's stance toward translation so far as I can tell is that if it's language that only developers are exposed to the strings are not translated and if it's language downstream users are exposed to it is translated. Django does not offer translations out of the box for the helps for default command parameters. Probably because this language is thought of as in the first category. I'm not sure I agree with this. I think the CLI interface of a Django site probably falls somewhere between the developer only audience and the user audience. As such I think it makes sense to provide translations out of the box for the common parameters. |
Thanks for the clarification. I am a bit torn whether to translate commands or not. Lately, I have switched to skipping this extra step and go with English text there. The reason is, that most of the system we are deploying to are either C.UTF-8 or en_US.UTF-8. Just a handful uses de_DE.UTF-8 and would profit from a translation. Maybe the stance of Django is reasonable and pragmatic. |
Yeah, I wrestled with it too. I'm leaning towards yes for a few reasons:
|
Also further clarification. I'm not talking about building translation infrastructure for commands that use django-typer, only including a .po file that contains google translate generated translations for the help strings of the common parameters. Params like --verbosity or --settings |
Ah. Now I am in sync with you. The last comment closed a gap in my mind and the mentioning of the dev dependency also makes sense. This makes total sense. |
@oliverandrich sanity check, does this make any sense? ![]() original english: ![]() |
They look pretty good to me. I would have translated "settings modul" as "Modul für Einstellungen" instead of "Einstellungsmodul". But this is basically a stylistic question and not incorrect. |
The remaining task here is to figure out how to get stdlib gettext translations in upstream Typer to work with the django translation system 🤔 |
Both click and typer wrap strings in stdlib gettext. These are mostly error strings and help markers (things like [OPTIONS]). The only way to really incorporate these is to monkey patch the gettext function calls upstream. This works but is icky/brittle. Because the use case here is generating translated UIs from the helps for an admin command runner or something like that - it's not critical that the markers/errors to be translated because they wouldn't appear in that UI anyway. I'm considering the help translations to be good enough and kicking the rest of this can down the road. No reason it should hold up a 3.0 release. There should probably be an official Django supported mechanism for dealing with dependency libraries that use stdlib gettext. Perhaps even monkey patching the stdlib gettext calls.... |
Should make a good faith effort to provide translations for all the languages Django provides translations for.
The text was updated successfully, but these errors were encountered: