-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Add support for getLocales in Polyglot i18nProvider #8143
Conversation
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.
👍
*/ | ||
export default ( | ||
getMessages: GetMessages, | ||
initialLocale: string = 'en', | ||
availableLocales: Locale[] = [{ locale: 'en', name: 'English' }], | ||
polyglotOptions: any = {} | ||
): I18nProvider => { | ||
let locale = initialLocale; |
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.
Shouldn't we throw a warning if the initialLocal
is not in the availableLocales
? Maybe I'm nitpicking here
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.
nice to have ;)
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.
TranslationSetup.md
- line 152:
The specified anchor using-specific-polyglot-features
is in the README of polyglot package, not above in the document.
This solution is all-or-nothing: you can't silence only some missing translation warnings. An alternative solution consists of passing a default translation using the _
translation option, as explained in the Using Specific Polyglot Features section(#using-specific-polyglot-features) above.
Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com>
Follows #7758