-
Notifications
You must be signed in to change notification settings - Fork 85
Fix default language not applied #426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
SECRET_FORCED_LANGUAGE is not applied because fallbackLng works only when detection method failed.
WalkthroughThe initialization of the i18next instance in the client was updated by replacing the use of the Changes
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
client/i18n.js (2)
8-15: Consider adding validation for the forced language value.While the current implementation works, it would be more robust to validate the forced language value to handle edge cases like empty strings or invalid language codes.
function getLanguage() { - const language = config.get('settings.forcedLanguage'); + const forcedLanguage = config.get('settings.forcedLanguage'); + const language = forcedLanguage && forcedLanguage.trim() ? forcedLanguage : null; const detectionMethod = ['navigator']; return { language, detectionMethod }; }This ensures that empty or whitespace-only forced language values fall back to detection rather than potentially causing i18next issues.
23-25: Consider documenting the detection fallback behavior.The detection configuration is still present, which is good for cases where no forced language is set. However, this dual behavior (forced vs. detected) could benefit from a clarifying comment.
+ // Language detection is used only when no forced language is configured lng: language, detection: { order: detectionMethod, },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
client/i18n.js(1 hunks)
🔇 Additional comments (1)
client/i18n.js (1)
22-22: ```shell
#!/bin/bash
sed -n '1,200p' client/i18n.js</details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
|
Thank you! Did you verify the cases locally? |
|



SECRET_FORCED_LANGUAGE is not applied because fallbackLng works only when detection method failed.
Summary by CodeRabbit