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*
WalkthroughThis PR refactors I18n locale fallback configuration by centralizing it into a dedicated initializer. Previously, fallback settings were scattered across multiple environment files (production, profile) and the pluralization initializer. The new approach introduces a custom Changes
Sequence DiagramThis diagram shows the interactions between components: sequenceDiagram
participant App as Application Code
participant I18n as I18n System
participant Fallbacks as I18n::Fallbacks
participant SiteSetting as SiteSetting
App->>SiteSetting: Get default_locale
SiteSetting-->>App: Return locale value
Note over App,Fallbacks: New: Ensure fallbacks are loaded
App->>I18n: Access fallbacks
I18n-->>App: Return Fallbacks instance
App->>Fallbacks: ensure_loaded!
activate Fallbacks
Fallbacks->>Fallbacks: Load fallback configurations
deactivate Fallbacks
Fallbacks-->>App: Fallbacks ready
Note over App: Continue with locale setup
🔗 Cross-Repository Impact AnalysisEnable automatic detection of breaking changes across your dependent repositories. → Set up now Learn more about Cross-Repository AnalysisWhat It Does
How to Enable
Benefits
Note for WindsurfPlease change the default marketplace provider to the following in the windsurf settings:Marketplace Extension Gallery Service URL: https://marketplace.visualstudio.com/_apis/public/gallery Marketplace Gallery Item URL: https://marketplace.visualstudio.com/items Entelligence.ai can learn from your feedback. Simply add 👍 / 👎 emojis to teach it your preferences. More shortcuts belowEmoji Descriptions:
Interact with the Bot:
Also you can trigger various commands with the bot by doing The current supported commands are
More commands to be added soon. |
Test 9
Summary by CodeRabbit
Release Notes
Refactor
Chore
✏️ Tip: You can customize this high-level summary in your review settings.
Replicated from ai-code-review-evaluation/discourse-coderabbit#9
EntelligenceAI PR Summary
This PR centralizes I18n locale fallback configuration into a dedicated initializer with a custom three-tier fallback strategy.
config.i18n.fallbacks = truefrom production, profile, and cloud66 environment filesconfig/initializers/i18n.rbwithFallbackLocaleListclass implementing user locale → site default → English fallback chainconfig/initializers/pluralization.rb(functionality consolidated)I18n.fallbacks.ensure_loaded!call inApplicationController#set_localemethodensure_loaded!method inTranslateAcceleratorfor explicit locale loading API