From d5fc1e3092669147bcdc0168b0c38a15acc6fd3d Mon Sep 17 00:00:00 2001 From: Yann Bertrand <5855339+yannbertrand@users.noreply.github.com> Date: Mon, 9 Jan 2023 16:19:10 +0100 Subject: [PATCH 1/6] sr: migrate from 'lang' to 'localeCode' in language switcher config --- components/LanguageSwitcher/LanguageSwitcher.vue | 10 +++++----- .../LanguageSwitcher/LanguageSwitcherSubMenu.vue | 4 ++-- config/language/pix-pro.js | 6 +++--- config/language/pix-site.js | 8 ++++---- tests/config/language/pix-pro.test.js | 6 +++--- tests/config/language/pix-site.test.js | 8 ++++---- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/components/LanguageSwitcher/LanguageSwitcher.vue b/components/LanguageSwitcher/LanguageSwitcher.vue index 252975424..65a8dbefd 100644 --- a/components/LanguageSwitcher/LanguageSwitcher.vue +++ b/components/LanguageSwitcher/LanguageSwitcher.vue @@ -25,7 +25,7 @@ :key="`language-switcher-${index}`" :class="{ 'language-switcher__dropdown-menu--active': - option.lang === currentLocaleCode, + option.localeCode === currentLocaleCode, }" >
@@ -81,7 +81,7 @@ :class="{ 'language-switcher-burger-menu__lang': true, 'language-switcher-burger-menu--active': - child.lang === currentLocaleCode, + child.localeCode === currentLocaleCode, }" > @@ -95,7 +95,7 @@ :class="{ 'language-switcher-burger-menu__lang': true, 'language-switcher-burger-menu--active': - option.lang === currentLocaleCode, + option.localeCode === currentLocaleCode, }" > @@ -135,7 +135,7 @@ export default { selectedMenu() { return this.languages.menu .flatMap((menuItem) => menuItem.children ?? menuItem) - .find((locale) => locale.lang === this.currentLocaleCode) + .find((locale) => locale.localeCode === this.currentLocaleCode) }, }, mounted() { @@ -160,7 +160,7 @@ export default { }, getIndexUrl(menuItem) { const locale = language.locales.find( - (locale) => locale.code === menuItem.lang + (locale) => locale.code === menuItem.localeCode ) return getAbsoluteUrlIfSwitchWebsite({ relativeTarget: locale.code === 'fr-fr' ? '/' : `/${locale.code}`, diff --git a/components/LanguageSwitcher/LanguageSwitcherSubMenu.vue b/components/LanguageSwitcher/LanguageSwitcherSubMenu.vue index ec32a18e0..6a6ed2448 100644 --- a/components/LanguageSwitcher/LanguageSwitcherSubMenu.vue +++ b/components/LanguageSwitcher/LanguageSwitcherSubMenu.vue @@ -5,7 +5,7 @@ :key="availableLanguage.key" :class="{ 'language-switcher__dropdown-menu--active': - availableLanguage.lang === currentLocaleCode, + availableLanguage.localeCode === currentLocaleCode, }" >
@@ -44,7 +44,7 @@ export default { methods: { getIndexUrl(menuItem) { const locale = language.locales.find( - (locale) => locale.code === menuItem.lang + (locale) => locale.code === menuItem.localeCode ) return getAbsoluteUrlIfSwitchWebsite({ relativeTarget: `/${locale.code}`, diff --git a/config/language/pix-pro.js b/config/language/pix-pro.js index 7a12a74d4..9ec57fe14 100644 --- a/config/language/pix-pro.js +++ b/config/language/pix-pro.js @@ -26,13 +26,13 @@ export const language = { children: [ { name: 'french', - lang: 'fr', + localeCode: 'fr', icon: 'icon', subtitle: null, }, { name: 'english', - lang: 'en-gb', + localeCode: 'en-gb', icon: 'icon', subtitle: null, }, @@ -40,7 +40,7 @@ export const language = { }, { name: 'france', - lang: 'fr-fr', + localeCode: 'fr-fr', icon: 'flag-fr.svg', subtitle: null, }, diff --git a/config/language/pix-site.js b/config/language/pix-site.js index 300e9fa41..d66fc08e5 100644 --- a/config/language/pix-site.js +++ b/config/language/pix-site.js @@ -40,13 +40,13 @@ export const language = { children: [ { name: 'french', - lang: 'fr', + localeCode: 'fr', icon: 'icon', subtitle: null, }, { name: 'english', - lang: 'en-gb', + localeCode: 'en-gb', icon: 'icon', subtitle: null, }, @@ -54,13 +54,13 @@ export const language = { }, { name: 'france', - lang: 'fr-fr', + localeCode: 'fr-fr', icon: 'flag-fr.svg', subtitle: null, }, { name: 'fwb-acronym', - lang: 'fr-be', + localeCode: 'fr-be', icon: 'flag-be.svg', subtitle: 'fwb', }, diff --git a/tests/config/language/pix-pro.test.js b/tests/config/language/pix-pro.test.js index 046522ab8..354b68b73 100644 --- a/tests/config/language/pix-pro.test.js +++ b/tests/config/language/pix-pro.test.js @@ -60,13 +60,13 @@ describe('#language', () => { children: [ { name: 'french', - lang: 'fr', + localeCode: 'fr', icon: 'icon', subtitle: null, }, { name: 'english', - lang: 'en-gb', + localeCode: 'en-gb', icon: 'icon', subtitle: null, }, @@ -74,7 +74,7 @@ describe('#language', () => { }, { name: 'france', - lang: 'fr-fr', + localeCode: 'fr-fr', icon: 'flag-fr.svg', subtitle: null, }, diff --git a/tests/config/language/pix-site.test.js b/tests/config/language/pix-site.test.js index 6ff1eaaa5..9eb5ffde5 100644 --- a/tests/config/language/pix-site.test.js +++ b/tests/config/language/pix-site.test.js @@ -59,13 +59,13 @@ describe('#language', () => { children: [ { name: 'french', - lang: 'fr', + localeCode: 'fr', icon: 'icon', subtitle: null, }, { name: 'english', - lang: 'en-gb', + localeCode: 'en-gb', icon: 'icon', subtitle: null, }, @@ -73,13 +73,13 @@ describe('#language', () => { }, { name: 'france', - lang: 'fr-fr', + localeCode: 'fr-fr', icon: 'flag-fr.svg', subtitle: null, }, { name: 'fwb-acronym', - lang: 'fr-be', + localeCode: 'fr-be', icon: 'flag-be.svg', subtitle: 'fwb', }, From 672c5075d6119db517c9b2727b1195164e8a0d49 Mon Sep 17 00:00:00 2001 From: Yann Bertrand <5855339+yannbertrand@users.noreply.github.com> Date: Mon, 9 Jan 2023 16:32:02 +0100 Subject: [PATCH 2/6] sr: rename language-switcher component as locale-switcher --- components/BurgerMenuNav.vue | 2 +- .../LocaleSwitcher.vue} | 64 +++++++------- .../LocaleSwitcherSubMenu.vue} | 8 +- components/slices/ActionsZone.vue | 2 +- lang/en-gb.js | 2 +- lang/fr-be.js | 2 +- lang/fr-fr.js | 2 +- lang/fr.js | 2 +- tests/components/BurgerMenuNav.test.js | 6 +- ...witcher.test.js => LocaleSwitcher.test.js} | 36 ++++---- ...st.js.snap => LocaleSwitcher.test.js.snap} | 84 +++++++++---------- tests/components/slices/ActionsZone.test.js | 6 +- 12 files changed, 108 insertions(+), 108 deletions(-) rename components/{LanguageSwitcher/LanguageSwitcher.vue => LocaleSwitcher/LocaleSwitcher.vue} (84%) rename components/{LanguageSwitcher/LanguageSwitcherSubMenu.vue => LocaleSwitcher/LocaleSwitcherSubMenu.vue} (84%) rename tests/components/{LanguageSwitcher.test.js => LocaleSwitcher.test.js} (56%) rename tests/components/__snapshots__/{LanguageSwitcher.test.js.snap => LocaleSwitcher.test.js.snap} (65%) diff --git a/components/BurgerMenuNav.vue b/components/BurgerMenuNav.vue index 8962c62ef..c1d4e1e99 100644 --- a/components/BurgerMenuNav.vue +++ b/components/BurgerMenuNav.vue @@ -2,7 +2,7 @@
- +
diff --git a/components/LanguageSwitcher/LanguageSwitcher.vue b/components/LocaleSwitcher/LocaleSwitcher.vue similarity index 84% rename from components/LanguageSwitcher/LanguageSwitcher.vue rename to components/LocaleSwitcher/LocaleSwitcher.vue index 65a8dbefd..1d3e52621 100644 --- a/components/LanguageSwitcher/LanguageSwitcher.vue +++ b/components/LocaleSwitcher/LocaleSwitcher.vue @@ -1,12 +1,12 @@