this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Don't need to update locales on runtime

+8 -6
+8 -6
src/utils/get-translate-target-language.js
··· 1 1 import languages from '../data/translang-languages'; 2 2 3 3 import localeMatch from './locale-match'; 4 - import mem from './mem'; 5 4 import states from './states'; 6 5 7 6 const translationTargetLanguages = Object.entries(languages.tl).map( ··· 11 10 }), 12 11 ); 13 12 14 - const locales = mem(() => [ 15 - new Intl.DateTimeFormat().resolvedOptions().locale, 16 - ...navigator.languages, 17 - ]); 13 + const locales = [...navigator.languages]; 14 + try { 15 + const dtfLocale = new Intl.DateTimeFormat().resolvedOptions().locale; 16 + if (!locales.includes(dtfLocale)) { 17 + locales.unshift(dtfLocale); 18 + } 19 + } catch {} 18 20 19 21 const localeTargetLanguages = () => 20 22 localeMatch( 21 - locales(), 23 + locales, 22 24 translationTargetLanguages.map((l) => l.code.replace('_', '-')), // The underscore will fail Intl.Locale inside `match` 23 25 'en', 24 26 );