DoneDeal0 / Talkr

Talkr is the lightest i18n provider for React applications. It supports Typescript, provides autocompletion, has 0 dependencies, and is very easy to use.
https://talkr-documentation.netlify.app/
249 stars 10 forks source link

detectBrowserLanguage is assigning not supported values #37

Closed normandanielmq closed 1 year ago

normandanielmq commented 1 year ago

Hi! great library.

Just to let you know that when detectBrowserLanguage is used is assigns the browser's language even though is not included by the provided list of languages.

DoneDeal0 commented 1 year ago

Hi @normandanielmq , thanks for your message! You're right, the function initLocale() might return an unsupported language when detectBrowserLanguage is activated. I'll correct that. However, there is no risk for existing users since the T function has a fallback to the default language (const currentLocale = !languages[locale] ? defaultLanguage : locale;)