diff --git a/pwa/src/data/languageOptions.ts b/pwa/src/data/languageOptions.ts new file mode 100644 index 00000000..81ff57e3 --- /dev/null +++ b/pwa/src/data/languageOptions.ts @@ -0,0 +1,276 @@ +export const languageOptions = [ + { label: "ZA", value: "af-ZA" }, + { label: "AL", value: "sq-AL" }, + { label: "DZ", value: "ar-DZ" }, + { label: "BH", value: "ar-BH" }, + { label: "EG", value: "ar-EG" }, + { label: "IQ", value: "ar-IQ" }, + { label: "JO", value: "ar-JO" }, + { label: "KW", value: "ar-KW" }, + { label: "LB", value: "ar-LB" }, + { label: "LY", value: "ar-LY" }, + { label: "MA", value: "ar-MA" }, + { label: "OM", value: "ar-OM" }, + { label: "QA", value: "ar-QA" }, + { label: "SA", value: "ar-SA" }, + { label: "SY", value: "ar-SY" }, + { label: "TN", value: "ar-TN" }, + { label: "AE", value: "ar-AE" }, + { label: "YE", value: "ar-YE" }, + { label: "AM", value: "hy-AM" }, + { label: "AZ", value: "az-AZ" }, + { label: "AZ", value: "az-AZ" }, + { label: "ES", value: "eu-ES" }, + { label: "BY", value: "be-BY" }, + { label: "BG", value: "bg-BG" }, + { label: "ES", value: "ca-ES" }, + { label: "CN", value: "zh-CN" }, + { label: "HK", value: "zh-HK" }, + { label: "MO", value: "zh-MO" }, + { label: "SG", value: "zh-SG" }, + { label: "TW", value: "zh-TW" }, + { label: "CHS", value: "zh-CHS" }, + { label: "CHT", value: "zh-CHT" }, + { label: "HR", value: "hr-HR" }, + { label: "CZ", value: "cs-CZ" }, + { label: "DK", value: "da-DK" }, + { label: "MV", value: "div-MV" }, + { label: "BE", value: "nl-BE" }, + { label: "NL", value: "nl-NL" }, + { label: "AU", value: "en-AU" }, + { label: "BZ", value: "en-BZ" }, + { label: "CA", value: "en-CA" }, + { label: "CB", value: "en-CB" }, + { label: "IE", value: "en-IE" }, + { label: "JM", value: "en-JM" }, + { label: "NZ", value: "en-NZ" }, + { label: "PH", value: "en-PH" }, + { label: "ZA", value: "en-ZA" }, + { label: "TT", value: "en-TT" }, + { label: "GB", value: "en-GB" }, + { label: "US", value: "en-US" }, + { label: "ZW", value: "en-ZW" }, + { label: "EE", value: "et-EE" }, + { label: "FO", value: "fo-FO" }, + { label: "IR", value: "fa-IR" }, + { label: "FI", value: "fi-FI" }, + { label: "BE", value: "fr-BE" }, + { label: "CA", value: "fr-CA" }, + { label: "FR", value: "fr-FR" }, + { label: "LU", value: "fr-LU" }, + { label: "MC", value: "fr-MC" }, + { label: "CH", value: "fr-CH" }, + { label: "ES", value: "gl-ES" }, + { label: "GE", value: "ka-GE" }, + { label: "AT", value: "de-AT" }, + { label: "DE", value: "de-DE" }, + { label: "LI", value: "de-LI" }, + { label: "LU", value: "de-LU" }, + { label: "CH", value: "de-CH" }, + { label: "GR", value: "el-GR" }, + { label: "IN", value: "gu-IN" }, + { label: "IL", value: "he-IL" }, + { label: "IN", value: "hi-IN" }, + { label: "HU", value: "hu-HU" }, + { label: "IS", value: "is-IS" }, + { label: "ID", value: "id-ID" }, + { label: "IT", value: "it-IT" }, + { label: "CH", value: "it-CH" }, + { label: "JP", value: "ja-JP" }, + { label: "IN", value: "kn-IN" }, + { label: "KZ", value: "kk-KZ" }, + { label: "IN", value: "kok-IN" }, + { label: "KR", value: "ko-KR" }, + { label: "KZ", value: "ky-KZ" }, + { label: "LV", value: "lv-LV" }, + { label: "LT", value: "lt-LT" }, + { label: "MK", value: "mk-MK" }, + { label: "BN", value: "ms-BN" }, + { label: "MY", value: "ms-MY" }, + { label: "IN", value: "mr-IN" }, + { label: "MN", value: "mn-MN" }, + { label: "NO", value: "nb-NO" }, + { label: "NO", value: "nn-NO" }, + { label: "PL", value: "pl-PL" }, + { label: "BR", value: "pt-BR" }, + { label: "PT", value: "pt-PT" }, + { label: "IN", value: "pa-IN" }, + { label: "RO", value: "ro-RO" }, + { label: "RU", value: "ru-RU" }, + { label: "IN", value: "sa-IN" }, + { label: "SP", value: "sr-SP" }, + { label: "SP", value: "sr-SP" }, + { label: "SK", value: "sk-SK" }, + { label: "SI", value: "sl-SI" }, + { label: "AR", value: "es-AR" }, + { label: "BO", value: "es-BO" }, + { label: "CL", value: "es-CL" }, + { label: "CO", value: "es-CO" }, + { label: "CR", value: "es-CR" }, + { label: "DO", value: "es-DO" }, + { label: "EC", value: "es-EC" }, + { label: "SV", value: "es-SV" }, + { label: "GT", value: "es-GT" }, + { label: "HN", value: "es-HN" }, + { label: "MX", value: "es-MX" }, + { label: "NI", value: "es-NI" }, + { label: "PA", value: "es-PA" }, + { label: "PY", value: "es-PY" }, + { label: "PE", value: "es-PE" }, + { label: "PR", value: "es-PR" }, + { label: "ES", value: "es-ES" }, + { label: "UY", value: "es-UY" }, + { label: "VE", value: "es-VE" }, + { label: "KE", value: "sw-KE" }, + { label: "FI", value: "sv-FI" }, + { label: "SE", value: "sv-SE" }, + { label: "SY", value: "syr-SY" }, + { label: "IN", value: "ta-IN" }, + { label: "RU", value: "tt-RU" }, + { label: "IN", value: "te-IN" }, + { label: "TH", value: "th-TH" }, + { label: "TR", value: "tr-TR" }, + { label: "UA", value: "uk-UA" }, + { label: "PK", value: "ur-PK" }, + { label: "UZ", value: "uz-UZ" }, + { label: "UZ", value: "uz-UZ" }, + { label: "VN", value: "vi-VN" }, +]; + +export type TLanguageCodes = + | "ZA" + | "AL" + | "DZ" + | "BH" + | "EG" + | "IQ" + | "JO" + | "KW" + | "LB" + | "LY" + | "MA" + | "OM" + | "QA" + | "SA" + | "SY" + | "TN" + | "AE" + | "YE" + | "AM" + | "AZ" + | "AZ" + | "ES" + | "BY" + | "BG" + | "ES" + | "CN" + | "HK" + | "MO" + | "SG" + | "TW" + | "CHS" + | "CHT" + | "HR" + | "CZ" + | "DK" + | "MV" + | "BE" + | "NL" + | "AU" + | "BZ" + | "CA" + | "CB" + | "IE" + | "JM" + | "NZ" + | "PH" + | "ZA" + | "TT" + | "GB" + | "US" + | "ZW" + | "EE" + | "FO" + | "IR" + | "FI" + | "BE" + | "CA" + | "FR" + | "LU" + | "MC" + | "CH" + | "ES" + | "GE" + | "AT" + | "DE" + | "LI" + | "LU" + | "CH" + | "GR" + | "IN" + | "IL" + | "IN" + | "HU" + | "IS" + | "ID" + | "IT" + | "CH" + | "JP" + | "IN" + | "KZ" + | "IN" + | "KR" + | "KZ" + | "LV" + | "LT" + | "MK" + | "BN" + | "MY" + | "IN" + | "MN" + | "NO" + | "NO" + | "PL" + | "BR" + | "PT" + | "IN" + | "RO" + | "RU" + | "IN" + | "SP" + | "SP" + | "SK" + | "SI" + | "AR" + | "BO" + | "CL" + | "CO" + | "CR" + | "DO" + | "EC" + | "SV" + | "GT" + | "HN" + | "MX" + | "NI" + | "PA" + | "PY" + | "PE" + | "PR" + | "ES" + | "UY" + | "VE" + | "KE" + | "FI" + | "SE" + | "SY" + | "IN" + | "RU" + | "IN" + | "TH" + | "TR" + | "UA" + | "PK" + | "UZ" + | "UZ" + | "VN"; diff --git a/pwa/src/layout/Head.tsx b/pwa/src/layout/Head.tsx index 6250b0e8..969fe4ca 100644 --- a/pwa/src/layout/Head.tsx +++ b/pwa/src/layout/Head.tsx @@ -5,6 +5,7 @@ import { Helmet } from "react-helmet"; import { getPageTitle } from "../services/getPageTitle"; import { useGatsbyContext } from "../context/gatsby"; import { useTranslation } from "react-i18next"; +import { languageOptions } from "../data/languageOptions"; export const Head: React.FC = () => { const { gatsbyContext } = useGatsbyContext(); @@ -15,10 +16,14 @@ export const Head: React.FC = () => { crumbLabel: t(_.upperFirst(crumb.crumbLabel)), })); + const currentLanguage = languageOptions.find( + (language) => language.label === (i18n.language.toUpperCase() === "EN" ? "US" : i18n.language.toUpperCase()), + )?.value; + return (