Skip to content

Commit 3c77d26

Browse files
DOP-6520 Add Spanish to language header list (#1597)
1 parent d88d8c6 commit 3c77d26

File tree

5 files changed

+103
-85
lines changed

5 files changed

+103
-85
lines changed

src/context/locale.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ export const LocaleProvider: React.FC<PropsWithChildren> = ({ children }) => {
2020
const betaLocale = BETA_LOCALE[locale]?.localeCode ?? undefined;
2121

2222
useEffect(() => {
23-
const betaLocals = ['es'];
23+
const betaLocales = Object.keys(BETA_LOCALE);
2424
/**
2525
* Grab the available languages and if the current locale is included in the
2626
* beta list of locale, add it to the enable locales data which will be used by the
2727
* unified header and footer.
2828
* If not then just use the default available languages
2929
*/
3030
const data = gettingAvailableLanguages();
31-
if (betaLocals.includes(locale) && betaLocale) {
31+
if (betaLocales.includes(locale) && betaLocale) {
3232
setEnableLocalesData([...data, betaLocale]);
3333
} else {
3434
setEnableLocalesData(data);

src/utils/locale.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,14 @@ const AVAILABLE_LANGUAGES: AvailableLanguageData[] = [
3333
{ language: '한국어', localeCode: 'ko-kr', fontFamily: 'Noto Sans KR' },
3434
{ language: 'Português', localeCode: 'pt-br' },
3535
{ language: '日本語', localeCode: 'ja-jp', fontFamily: 'Noto Sans JP' },
36+
{ language: 'Español', localeCode: 'es' },
3637
];
3738

3839
// GTM locale
39-
export const BETA_LOCALE: { [key: string]: AvailableLanguageData } = {
40-
es: {
41-
language: 'Español',
42-
localeCode: 'es',
43-
},
44-
};
40+
export const BETA_LOCALE: { [key: string]: AvailableLanguageData } = {};
4541

4642
// Languages in current development that we do not want displayed publicly yet
47-
const HIDDEN_LANGUAGES: AvailableLanguageData[] = [BETA_LOCALE['es']];
43+
const HIDDEN_LANGUAGES: AvailableLanguageData[] = [];
4844

4945
/**
5046
* @param {boolean} forceAll - Bypasses feature flag requirements if necessary

tests/unit/__snapshots__/Head.test.js.snap

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ NodeList [
3232
hreflang="ja-jp"
3333
rel="alternate"
3434
/>,
35+
<link
36+
class="sl_opaque"
37+
href="https://www.mongodb.com/es/"
38+
hreflang="es"
39+
rel="alternate"
40+
/>,
3541
<link
3642
class="sl_opaque"
3743
href="https://www.mongodb.com/"
@@ -73,6 +79,12 @@ NodeList [
7379
hreflang="ja-jp"
7480
rel="alternate"
7581
/>,
82+
<link
83+
class="sl_opaque"
84+
href="https://www.mongodb.com/es/foo/"
85+
hreflang="es"
86+
rel="alternate"
87+
/>,
7688
<link
7789
class="sl_opaque"
7890
href="https://www.mongodb.com/foo/"

0 commit comments

Comments
 (0)