rails / mission_control-jobs

Dashboard and Active Job extensions to operate and troubleshoot background jobs
MIT License
613 stars 71 forks source link

Use a supported locale for localization #156

Closed sundling closed 3 weeks ago

sundling commented 2 months ago

The changes in #137 causes the exception I18n::InvalidLocale: :en is not a valid locale to be raised if the application doesn't support the en locale. It could be that the application uses en-US instead or maybe an English locale isn't available at all.

This change fixes the exception by looking for English based locales and will fallback to I18n.default_locale if none is found. Sorting the locales ensure that en is used if it is available.

rosa commented 3 weeks ago

Thanks a lot @sundling, and sorry for the delay! I've been busy with other stuff and haven't dedicated time to Mission Control lately, but I'm finally focused on it. In the end, I think I'm going to go with https://github.com/rails/mission_control-jobs/pull/184 so that we don't need to set the locale, and it's also simpler.