Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Localization not working properly #175

Open
mtylty opened this issue Feb 21, 2016 · 6 comments
Open

Localization not working properly #175

mtylty opened this issue Feb 21, 2016 · 6 comments

Comments

@mtylty
Copy link

mtylty commented Feb 21, 2016

Localization seems like it doesn't work properly. I'm trying to use Lita as an Italian bot but...

I've found at least two problems:

  • when running on slack I cannot set a locale different from en. I've tried LANG and config.robot.locale and neither work. I keep getting translation missing errors looking for en locale strings (i18n is instead working fine in the shell adapter, set with the config option);
  • locale strings are useless for route help strings. I'm sure this is related to the fact that routes, being a class-level dsl, are evaluated before a proper locale string is set so they always try to use en locale strings.

I'm not sure I'm doing something wrong but this is driving me crazy and it looks like it might be an actual bug. If somebody could please confirm this I could start working on PR to fix this.

Thanks!

@jimmycuadra
Copy link
Collaborator

Those sound like bugs to me. Thanks for the report!

@AHaymond
Copy link

AHaymond commented Apr 7, 2021

has this ever been fixed? 5 years from the last comment and I am getting DEBUG: translation missing: C.UTF-8.lita.handler.dispatch all over my logs and sending the help message to Lita provides a large dump of such errors.

@tim-fitzgerald
Copy link

Running into this as well right now. Interested if anyone has a solution

@jimmycuadra
Copy link
Collaborator

Part of the issue should be fixed by using "default locale" instead of "locale" which you can do as of v4.8: https://github.com/litaio/lita/releases/tag/v4.8.0. The problem of handler help text not translating is indeed because they are a class-level construct, so the translation is getting run when the file is loaded, which is before the Lita configuration is loaded. This will be addressed in Lita 5 by setting the locale (and the default locale) based on the environment variables LC_ALL, LC_MESSAGES, or LANG very early in the program's execution. Setting the locale via Lita configuration will be deprecated in favor of these environment variables.

@jrcasso
Copy link

jrcasso commented Sep 29, 2021

@jimmycuadra setting config.robot.default_locale = :en per release instructions did not fix the issue

@silvamerica
Copy link

@jrcasso Try setting LANG=en and see if that helps? That was what helped me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants