Skip to content

Commit

Permalink
added language options
Browse files Browse the repository at this point in the history
  • Loading branch information
remko48 committed Oct 6, 2023
1 parent b5a5601 commit 2cf434d
Show file tree
Hide file tree
Showing 2 changed files with 282 additions and 1 deletion.
276 changes: 276 additions & 0 deletions pwa/src/data/languageOptions.ts
Original file line number Diff line number Diff line change
@@ -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";
7 changes: 6 additions & 1 deletion pwa/src/layout/Head.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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 (
<Helmet
htmlAttributes={{
lang: i18n.language,
lang: currentLanguage,
}}
bodyAttributes={{
class: process.env.GATSBY_NL_DESIGN_THEME_CLASSNAME,
Expand Down

0 comments on commit 2cf434d

Please sign in to comment.