DeepSeek V4 Pro · 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 Opus 5.5.

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

Published comments (2)

mediumbugapp/controllers/application_controller.rb:159

I18n fallback locales not loaded outside controllers — Fallback locales are never loaded in background jobs and mailers, so missing keys return `MissingTranslation` instead of falling back to the site default or English. Load the fallback chain inside `I18n.translate`/`load_locale`, or call `ensure_loaded!` in those contexts rather than only in the controller before_filter.

mediumbugconfig/initializers/i18n.rb:20-21

I18n.locale with regex metacharacters causes RegexpError in fallback loading — A user setting a locale with regex metacharacters like `(` causes an unhandled `RegexpError` and a 500 on every request because `ensure_loaded!` interpolates `I18n.locale` into a regex. Validate `locale` against `LocaleSiteSetting.supported_locales` before it reaches the fallback loading path.

Gold bugs found (1)

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.

Gold bugs missed (2)

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.
highFallbackLocaleList#[] reads SiteSetting.default_locale.to_sym on every I18n.t call; when site settings are unavailable (fresh DB/migrations, failed refresh! leaving an empty container) the read returns nil or raises, so I18n.t calls in boot/rake/seed paths crash instead of falling back to :en.