From 11988382d68b1d792fb2da90a846502da0acf07d Mon Sep 17 00:00:00 2001 From: Emile Rolley Date: Wed, 25 Oct 2023 17:16:21 +0200 Subject: [PATCH] refactor(i18n): use 'en' instead of 'en-us' --- source/locales/faq/{FAQ-en-us.yaml => FAQ-en.yaml} | 0 source/locales/pages/{en-us => en}/CGU.md | 0 source/locales/pages/{en-us => en}/about.mdx | 0 .../locales/pages/{en-us => en}/accessibility.md | 0 source/locales/pages/{en-us => en}/budgetBottom.md | 0 source/locales/pages/{en-us => en}/budgetTop.md | 0 source/locales/pages/{en-us => en}/diffuser.md | 0 .../locales/pages/{en-us => en}/documentation.md | 0 source/locales/pages/{en-us => en}/landing.md | 0 .../locales/pages/en/m\303\251thode.md" | 0 .../locales/pages/{en-us => en}/petrogazLanding.md | 0 source/locales/pages/{en-us => en}/privacy.md | 0 .../{releases-en-us.json => releases-en.json} | 0 source/locales/translation.ts | 14 +++++++------- source/sites/publicodes/LandingExplanations.tsx | 2 +- source/sites/publicodes/Personas.tsx | 12 ++++++------ source/sites/publicodes/pages/About.tsx | 2 +- source/sites/publicodes/pages/Accessibility.tsx | 2 +- source/sites/publicodes/pages/Budget.tsx | 8 ++++---- source/sites/publicodes/pages/CGU.tsx | 2 +- source/sites/publicodes/pages/Diffuser.tsx | 2 +- .../publicodes/pages/DocumentationContexte.tsx | 6 +++--- "source/sites/publicodes/pages/M\303\251thode.tsx" | 2 +- source/sites/publicodes/pages/PetrogazLanding.tsx | 2 +- source/sites/publicodes/pages/Privacy.tsx | 2 +- 25 files changed, 28 insertions(+), 28 deletions(-) rename source/locales/faq/{FAQ-en-us.yaml => FAQ-en.yaml} (100%) rename source/locales/pages/{en-us => en}/CGU.md (100%) rename source/locales/pages/{en-us => en}/about.mdx (100%) rename source/locales/pages/{en-us => en}/accessibility.md (100%) rename source/locales/pages/{en-us => en}/budgetBottom.md (100%) rename source/locales/pages/{en-us => en}/budgetTop.md (100%) rename source/locales/pages/{en-us => en}/diffuser.md (100%) rename source/locales/pages/{en-us => en}/documentation.md (100%) rename source/locales/pages/{en-us => en}/landing.md (100%) rename "source/locales/pages/en-us/m\303\251thode.md" => "source/locales/pages/en/m\303\251thode.md" (100%) rename source/locales/pages/{en-us => en}/petrogazLanding.md (100%) rename source/locales/pages/{en-us => en}/privacy.md (100%) rename source/locales/releases/{releases-en-us.json => releases-en.json} (100%) diff --git a/source/locales/faq/FAQ-en-us.yaml b/source/locales/faq/FAQ-en.yaml similarity index 100% rename from source/locales/faq/FAQ-en-us.yaml rename to source/locales/faq/FAQ-en.yaml diff --git a/source/locales/pages/en-us/CGU.md b/source/locales/pages/en/CGU.md similarity index 100% rename from source/locales/pages/en-us/CGU.md rename to source/locales/pages/en/CGU.md diff --git a/source/locales/pages/en-us/about.mdx b/source/locales/pages/en/about.mdx similarity index 100% rename from source/locales/pages/en-us/about.mdx rename to source/locales/pages/en/about.mdx diff --git a/source/locales/pages/en-us/accessibility.md b/source/locales/pages/en/accessibility.md similarity index 100% rename from source/locales/pages/en-us/accessibility.md rename to source/locales/pages/en/accessibility.md diff --git a/source/locales/pages/en-us/budgetBottom.md b/source/locales/pages/en/budgetBottom.md similarity index 100% rename from source/locales/pages/en-us/budgetBottom.md rename to source/locales/pages/en/budgetBottom.md diff --git a/source/locales/pages/en-us/budgetTop.md b/source/locales/pages/en/budgetTop.md similarity index 100% rename from source/locales/pages/en-us/budgetTop.md rename to source/locales/pages/en/budgetTop.md diff --git a/source/locales/pages/en-us/diffuser.md b/source/locales/pages/en/diffuser.md similarity index 100% rename from source/locales/pages/en-us/diffuser.md rename to source/locales/pages/en/diffuser.md diff --git a/source/locales/pages/en-us/documentation.md b/source/locales/pages/en/documentation.md similarity index 100% rename from source/locales/pages/en-us/documentation.md rename to source/locales/pages/en/documentation.md diff --git a/source/locales/pages/en-us/landing.md b/source/locales/pages/en/landing.md similarity index 100% rename from source/locales/pages/en-us/landing.md rename to source/locales/pages/en/landing.md diff --git "a/source/locales/pages/en-us/m\303\251thode.md" "b/source/locales/pages/en/m\303\251thode.md" similarity index 100% rename from "source/locales/pages/en-us/m\303\251thode.md" rename to "source/locales/pages/en/m\303\251thode.md" diff --git a/source/locales/pages/en-us/petrogazLanding.md b/source/locales/pages/en/petrogazLanding.md similarity index 100% rename from source/locales/pages/en-us/petrogazLanding.md rename to source/locales/pages/en/petrogazLanding.md diff --git a/source/locales/pages/en-us/privacy.md b/source/locales/pages/en/privacy.md similarity index 100% rename from source/locales/pages/en-us/privacy.md rename to source/locales/pages/en/privacy.md diff --git a/source/locales/releases/releases-en-us.json b/source/locales/releases/releases-en.json similarity index 100% rename from source/locales/releases/releases-en-us.json rename to source/locales/releases/releases-en.json diff --git a/source/locales/translation.ts b/source/locales/translation.ts index 821b7c3b68..06583e7a76 100644 --- a/source/locales/translation.ts +++ b/source/locales/translation.ts @@ -4,17 +4,17 @@ import { i18n } from 'i18next' import type { MDXContent } from 'mdx/types' -import uiEn from '!locale-yaml-loader!./ui/ui-en-us.yaml' +import uiEn from '!locale-yaml-loader!./ui/ui-en.yaml' // import uiEs from '!locale-yaml-loader!./ui/ui-es.yaml' import uiFr from '!locale-yaml-loader!./ui/ui-fr.yaml' // import uiIt from '!locale-yaml-loader!./ui/ui-it.yaml' -import faqEn from '!locale-yaml-loader!./faq/FAQ-en-us.yaml' +import faqEn from '!locale-yaml-loader!./faq/FAQ-en.yaml' // import faqEs from '!locale-yaml-loader!./faq/FAQ-es.yaml' import faqFr from '!locale-yaml-loader!./faq/FAQ-fr.yaml' // import faqIt from '!locale-yaml-loader!./faq/FAQ-it.yaml' -import releasesEn from './releases/releases-en-us.json' +import releasesEn from './releases/releases-en.json' // import releasesEs from './releases/releases-es.json' import releasesFr from './releases/releases-fr.json' // import releasesIt from './releases/releases-it.json' @@ -123,22 +123,22 @@ export function changeLangTo(i18n: i18n, currentLangState: Lang) { export function getMarkdownInCurrentLang( markdownFiles: Array<[Lang, string]>, - currentLangState: Lang + currentLangState: Lang, ) { return ( markdownFiles.find( - ([lang]) => getLangInfos(lang).abrv === currentLangState + ([lang]) => getLangInfos(lang).abrv === currentLangState, )?.[1] || markdownFiles[0][1] ) } export function getMarkdownXInCurrentLang( markdownFiles: Array<[Lang, MDXContent]>, - currentLangState: Lang + currentLangState: Lang, ): MDXContent { return ( markdownFiles.find( - ([lang]) => getLangInfos(lang).abrv === currentLangState + ([lang]) => getLangInfos(lang).abrv === currentLangState, )?.[1] || markdownFiles[0][1] ) } diff --git a/source/sites/publicodes/LandingExplanations.tsx b/source/sites/publicodes/LandingExplanations.tsx index f090ad27ba..75edff026f 100644 --- a/source/sites/publicodes/LandingExplanations.tsx +++ b/source/sites/publicodes/LandingExplanations.tsx @@ -6,7 +6,7 @@ import avantages from './avantages.yaml' import LandingContent from './LandingContent' import MarkdownPage from './pages/MarkdownPage' -import contentEn from '../../locales/pages/en-us/landing.md' +import contentEn from '../../locales/pages/en/landing.md' import contentEs from '../../locales/pages/es/landing.md' import contentFr from '../../locales/pages/fr/landing.md' import contentIt from '../../locales/pages/it/landing.md' diff --git a/source/sites/publicodes/Personas.tsx b/source/sites/publicodes/Personas.tsx index cb49a3fa10..3d10aa781b 100644 --- a/source/sites/publicodes/Personas.tsx +++ b/source/sites/publicodes/Personas.tsx @@ -57,7 +57,7 @@ const visualisationChoices = { export default () => { const selectedPersona = useSelector( - (state: AppState) => state.simulation?.persona + (state: AppState) => state.simulation?.persona, ) const [searchParams, setSearchParams] = useSearchParams({ @@ -72,7 +72,7 @@ export default () => { const engine = useEngine() const rules = useSelector((state: AppState) => state.rules) const personasQuestions = getQuestionsInRules(engine, rules).filter( - ({ type }) => !type.includes('Mosaïque') + ({ type }) => !type.includes('Mosaïque'), ) const visualisationComponentProps = { @@ -186,7 +186,7 @@ export const PersonaGrid = ({ const engine = useEngine() const branchData: BranchData = useBranchData() - const lang = i18n.language === 'en' ? 'en-us' : i18n.language + const lang = i18n.language const navigate = useNavigate() const [params] = useSearchParams() @@ -197,7 +197,7 @@ export const PersonaGrid = ({ fetchAndSetAvailablePersonas( `/personas-${lang}.json`, branchData, - setAvailablePersonas + setAvailablePersonas, ) } }, [branchData.loaded, branchData.deployURL, lang]) @@ -209,7 +209,7 @@ export const PersonaGrid = ({ const setPersona = (persona: Persona) => { const safeSituation = safeGetSituation( persona.situation, - engine.getParsedRules() as NGCRulesNodes + engine.getParsedRules() as NGCRulesNodes, ) setSituationForValidKeys({ engine, @@ -394,7 +394,7 @@ export const PersonaExplanations = ({ personasQuestionList }) => { className="ui__ button small" onClick={() => { navigator.clipboard.writeText( - JSON.stringify(personasQuestionList) + JSON.stringify(personasQuestionList), ) }} > diff --git a/source/sites/publicodes/pages/About.tsx b/source/sites/publicodes/pages/About.tsx index 710dbf16b6..8033ea718b 100644 --- a/source/sites/publicodes/pages/About.tsx +++ b/source/sites/publicodes/pages/About.tsx @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next' import { Lang } from '../../../locales/translation' import MarkdownXPage from './MarkdownXPage' -import contentEn from '../../../locales/pages/en-us/about.mdx' +import contentEn from '../../../locales/pages/en/about.mdx' import contentFr from '../../../locales/pages/fr/about.mdx' diff --git a/source/sites/publicodes/pages/Accessibility.tsx b/source/sites/publicodes/pages/Accessibility.tsx index d0d636218d..595ee47f32 100644 --- a/source/sites/publicodes/pages/Accessibility.tsx +++ b/source/sites/publicodes/pages/Accessibility.tsx @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next' import { Lang } from '../../../locales/translation' import MarkdownPage from './MarkdownPage' -import contentEn from '../../../locales/pages/en-us/accessibility.md' +import contentEn from '../../../locales/pages/en/accessibility.md' // import contentEs from '../../../locales/pages/es/accessibility.md' import contentFr from '../../../locales/pages/fr/accessibility.md' // import contentIt from '../../../locales/pages/it/accessibility.md' diff --git a/source/sites/publicodes/pages/Budget.tsx b/source/sites/publicodes/pages/Budget.tsx index 77620aa5b8..8882b9916c 100644 --- a/source/sites/publicodes/pages/Budget.tsx +++ b/source/sites/publicodes/pages/Budget.tsx @@ -3,8 +3,8 @@ import { Markdown } from '@/components/utils/markdown' import Meta from '@/components/utils/Meta' import { getMarkdownInCurrentLang, Lang } from '@/locales/translation' import { useTranslation } from 'react-i18next' -import contentEnBottom from '../../../locales/pages/en-us/budgetBottom.md' -import contentEnTop from '../../../locales/pages/en-us/budgetTop.md' +import contentEnBottom from '../../../locales/pages/en/budgetBottom.md' +import contentEnTop from '../../../locales/pages/en/budgetTop.md' import contentFrBottom from '../../../locales/pages/fr/budgetBottom.md' import contentFrTop from '../../../locales/pages/fr/budgetTop.md' import SelectYear from './budget/SelectYear' @@ -18,7 +18,7 @@ export default () => { [Lang.Fr, contentFrTop], [Lang.En, contentEnTop], ], - lang + lang, ) const contentBottom = getMarkdownInCurrentLang( @@ -26,7 +26,7 @@ export default () => { [Lang.Fr, contentFrBottom], [Lang.En, contentEnBottom], ], - lang + lang, ) return ( diff --git a/source/sites/publicodes/pages/CGU.tsx b/source/sites/publicodes/pages/CGU.tsx index 95101e0bd3..4ba07c6bb3 100644 --- a/source/sites/publicodes/pages/CGU.tsx +++ b/source/sites/publicodes/pages/CGU.tsx @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next' import { Lang } from '../../../locales/translation' import MarkdownPage from './MarkdownPage' -import contentEn from '../../../locales/pages/en-us/CGU.md' +import contentEn from '../../../locales/pages/en/CGU.md' // import contentEs from '../../../locales/pages/es/CGU.md' import contentFr from '../../../locales/pages/fr/CGU.md' // import contentIt from '../../../locales/pages/it/CGU.md' diff --git a/source/sites/publicodes/pages/Diffuser.tsx b/source/sites/publicodes/pages/Diffuser.tsx index ee62026047..9b5681d476 100644 --- a/source/sites/publicodes/pages/Diffuser.tsx +++ b/source/sites/publicodes/pages/Diffuser.tsx @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next' import { Lang } from '../../../locales/translation' import MarkdownPage from './MarkdownPage' -import contentEn from '../../../locales/pages/en-us/diffuser.md' +import contentEn from '../../../locales/pages/en/diffuser.md' // import contentEs from '../../../locales/pages/es/diffuser.md' import contentFr from '../../../locales/pages/fr/diffuser.md' // import contentIt from '../../../locales/pages/it/diffuser.md' diff --git a/source/sites/publicodes/pages/DocumentationContexte.tsx b/source/sites/publicodes/pages/DocumentationContexte.tsx index a98dbce2f8..c4dea4109d 100644 --- a/source/sites/publicodes/pages/DocumentationContexte.tsx +++ b/source/sites/publicodes/pages/DocumentationContexte.tsx @@ -7,7 +7,7 @@ import { Link } from 'react-router-dom' import { getMarkdownInCurrentLang, Lang } from '@/locales/translation' import AutoCanonicalTag from '@/components/utils/AutoCanonicalTag' -import contentEn from '../../../locales/pages/en-us/documentation.md' +import contentEn from '../../../locales/pages/en/documentation.md' import contentFr from '../../../locales/pages/fr/documentation.md' export default () => { @@ -19,7 +19,7 @@ export default () => { [Lang.Fr, contentFr], [Lang.En, contentEn], ], - l + l, ) return ( @@ -27,7 +27,7 @@ export default () => { diff --git "a/source/sites/publicodes/pages/M\303\251thode.tsx" "b/source/sites/publicodes/pages/M\303\251thode.tsx" index 3bc8b58871..0cb019712d 100644 --- "a/source/sites/publicodes/pages/M\303\251thode.tsx" +++ "b/source/sites/publicodes/pages/M\303\251thode.tsx" @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next' import { Lang } from '../../../locales/translation' import MarkdownPage from './MarkdownPage' -import contentEn from '../../../locales/pages/en-us/méthode.md' +import contentEn from '../../../locales/pages/en/méthode.md' // import contentEs from '../../../locales/pages/es/méthode.md' import contentFr from '../../../locales/pages/fr/méthode.md' // import contentIt from '../../../locales/pages/it/méthode.md' diff --git a/source/sites/publicodes/pages/PetrogazLanding.tsx b/source/sites/publicodes/pages/PetrogazLanding.tsx index cb2ceec1c8..bb14482bc9 100644 --- a/source/sites/publicodes/pages/PetrogazLanding.tsx +++ b/source/sites/publicodes/pages/PetrogazLanding.tsx @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next' import { Lang } from '../../../locales/translation' import MarkdownPage from './MarkdownPage' -import contentEn from '../../../locales/pages/en-us/petrogazLanding.md' +import contentEn from '../../../locales/pages/en/petrogazLanding.md' import contentFr from '../../../locales/pages/fr/petrogazLanding.md' export default () => { diff --git a/source/sites/publicodes/pages/Privacy.tsx b/source/sites/publicodes/pages/Privacy.tsx index 21b33accf1..e2c55ceb8c 100644 --- a/source/sites/publicodes/pages/Privacy.tsx +++ b/source/sites/publicodes/pages/Privacy.tsx @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next' import { Lang } from '../../../locales/translation' import MarkdownPage from './MarkdownPage' -import contentEn from '../../../locales/pages/en-us/privacy.md' +import contentEn from '../../../locales/pages/en/privacy.md' // import contentEs from '../../../locales/pages/es/privacy.md' import contentFr from '../../../locales/pages/fr/privacy.md' // import contentIt from '../../../locales/pages/it/privacy.md'