diff --git a/components/Hooks/index.tsx b/components/Hooks/index.tsx index 5cd90433d..2e2c60c25 100644 --- a/components/Hooks/index.tsx +++ b/components/Hooks/index.tsx @@ -42,8 +42,9 @@ export const useWindowWidth = () => { export function useTranslation(key?: string): T { const { locale } = useRouter() + const newLocale = locale === 'default' ? 'en' : locale if (key) { - return webDictionary[locale][key] + return webDictionary[newLocale][key] } - return webDictionary[locale] + return webDictionary[newLocale] } diff --git a/components/QuestionsPage/index.tsx b/components/QuestionsPage/index.tsx index eafafe2b3..69cd71e3e 100644 --- a/components/QuestionsPage/index.tsx +++ b/components/QuestionsPage/index.tsx @@ -59,7 +59,10 @@ export const QuestionsPage: React.VFC = ({}) => { const router = useRouter() const tsln = useTranslation() const isMobile = useMediaQuery(992) - const language = useRouter().locale as Language + + const langx = useRouter().locale as Language + const language = + langx === Language.EN || langx === Language.FR ? langx : Language.EN const allFieldConfigs: FieldConfig[] = BenefitHandler.getAllFieldData(language) diff --git a/i18n/api/index.ts b/i18n/api/index.ts index 5562284cb..60ab17cb6 100644 --- a/i18n/api/index.ts +++ b/i18n/api/index.ts @@ -146,6 +146,8 @@ export function getTranslations(language: Language): Translations { return apiTranslationsDict.en case Language.FR: return apiTranslationsDict.fr + default: + return apiTranslationsDict.en } } diff --git a/next.config.js b/next.config.js index 8eeb73457..8e9f28c5f 100644 --- a/next.config.js +++ b/next.config.js @@ -4,9 +4,8 @@ module.exports = { defaultLocale: 'default', }, reactStrictMode: true, - // this supposed to work outputStandalone: true, - // . + // async redirects() { return [ { diff --git a/pages/results/index.tsx b/pages/results/index.tsx index 2d6390678..d68b2803b 100644 --- a/pages/results/index.tsx +++ b/pages/results/index.tsx @@ -36,7 +36,10 @@ const Results: NextPage<{ adobeAnalyticsUrl: string }> = ({ (value: FieldInputsObject) => void ] = useSessionStorage('inputs', {}) - const language = useRouter().locale as Language + const langx = useRouter().locale as Language + const language = + langx === Language.EN || langx === Language.FR ? langx : Language.EN + const inputHelper = new InputHelper(inputs, setInputs, language) const mainHandler = new MainHandler(inputHelper.asObjectWithLanguage) const response: ResponseSuccess | ResponseError = mainHandler.results