mirror of
https://github.com/discourse/discourse.git
synced 2025-02-20 17:52:45 +08:00

Sometimes, parts of the application pass in the locale as a string, not a symbol. This was causing the translate_accelerator to cache two versions of the locale separately: one cache for the symbol version, and one cache for the string version. For example, in a running production process: ``` irb(main):001:0> I18n.instance_variable_get(:@loaded_locales) => [:en, "en"] ``` This commit ensures the `locale` key is always converted to a symbol, and adds a spec to ensure the same locale cannot appear twice in `@loaded_locales`