FEATURE: Localization fallbacks (server-side)#2
Conversation
The FallbackLocaleList object tells I18n::Backend::Fallbacks what order the languages should be attempted in. Because of the translate_accelerator patch, the SiteSetting.default_locale is *not* guaranteed to be fully loaded after the server starts, so a call to ensure_loaded! is added after the locale is set for the current user. The declarations of config.i18n.fallbacks = true in the environment files were actually garbage, because the I18n.default_locale was SiteSetting.default_locale, so there was nothing to fall back to. *derp*
|
@claude review this PR |
1 similar comment
|
@claude review this PR |
|
Claude finished @akshayutture-augment's task —— View job Code Review Complete ✓Tasks:
SummaryThis PR implements server-side localization fallbacks for the Discourse application. The implementation is solid and well-designed with good architectural decisions. The changes properly configure I18n to fall back through a chain of locales (user locale → site default locale → English) when translations are missing. ✅ Strengths
🔍 Issues & Concerns1. Potential Thread Safety Issue (Medium Severity)Location: def ensure_loaded!
self[I18n.locale].each { |l| I18n.ensure_loaded! l }
endThe Recommendation: Consider passing the locale as a parameter: def ensure_loaded!(locale = I18n.locale)
self[locale].each { |l| I18n.ensure_loaded! l }
end2. Redundant
|
Test 9
Replicated from ai-code-review-evaluation/discourse-greptile#9