fix(i18n): ensure language redirects for Chinese traditional (#42020)

This commit is contained in:
Mrugesh Mohapatra
2021-05-06 20:35:27 +05:30
committed by GitHub
parent 0b5553002a
commit 5cb3465a1d
3 changed files with 98 additions and 36 deletions

View File

@@ -3,10 +3,13 @@ import envData from '../../../config/env.json';
const { forumLocation } = envData;
const createExternalRedirect = (page, { clientLocale }) => {
const isNotEnglish = clientLocale !== 'english';
if (clientLocale === 'chinese') {
// Handle Chinese
if (clientLocale === 'chinese' || clientLocale === 'chinese-traditional') {
return `https://chinese.freecodecamp.org/${page}`;
}
// Handle Others
const isNotEnglish = clientLocale !== 'english';
if (page === 'forum') {
return `${forumLocation}/${isNotEnglish ? 'c/' + clientLocale + '/' : ''}`;
}