%PDF- %PDF-
Direktori : /home/emergentqj/actioncivile/pre-auth/.4cc3a2e1590a4463a5f392ddcc26929e/static/js/utils/ |
Current File : /home/emergentqj/actioncivile/pre-auth/.4cc3a2e1590a4463a5f392ddcc26929e/static/js/utils/getTranslations.js |
import countryConfig from "config/countryData"; const { countryData, langData, } = countryConfig; export const getTranslationItem = (languageCode) => { const langItem = langData.find((lang) => lang.code === languageCode); return (langItem) ? { name: langItem.nativename, code: langItem.code, } : null; }; export const getTranslations = (countryCode) => { const country = countryData[countryCode]; // We have the country, we have the translations if (country && country.translations) { return country.translations .map(getTranslationItem) .filter((item) => item != null); } // No country, offer fallback const translations = [{ name: "English", code: "en", }]; translations.sort((a, b) => a.name > b.name); return translations; };