DeepSeek V4.1 Flash · Balanced

feature-localization-fallbacks-server-side-discourse-cursor

Discourse · Ruby · S · 30–99 lines · 6 files

The normal review, with one generalist agent. Judge: Claude Haiku 5.5.

Gold bugs found
2 of 2
Comments published
3
Comments matching a bug
2
Comments not matching
1
Cost of this PR
$0.118

Published comments (3)

highbugconfig/initializers/i18n.rb:17

`SiteSetting.default_locale.to_sym` raises NoMethodError when default_locale is nil — A nil `default_locale` raises `NoMethodError` inside `I18n.fallbacks[]` during translation lookups, since `compact` runs after `to_sym`. Build the array first and guard before calling `to_sym`.

mediumbugconfig/initializers/i18n.rb:17

Translation cache is not invalidated when default_locale changes — Users keep seeing text from the previous site locale after an admin changes `default_locale`, since the `translate_accelerator.rb` LRU key omits the resolved fallback chain. Include the current `SiteSetting.default_locale` in the cache key or clear `@cache` when it changes.

mediumbugapp/controllers/application_controller.rb:159

Fallback chain loaded only on controller path, not in jobs or rake tasks — In Sidekiq threads and rake tasks the `SiteSetting.default_locale`/`:en` fallbacks are looked up against locale files that were never loaded, so missing keys render "translation missing" instead of fallback text. Call `I18n.fallbacks.ensure_loaded!` wherever the locale is changed for a context.

Gold bugs found (2)

mediumFallback locale catalogs are only loaded in the controller's set_locale filter, while translate loads just the current locale, so translations outside requests (jobs, mailers) cannot fall back to the site default or English.
mediumThe translation cache key does not include the site or its default locale, but fallback results now depend on SiteSetting.default_locale, so multisite processes or a changed default locale serve stale fallback translations.

Gold bugs missed (0)

None.