Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Frontend: Localize URLS #155

Merged
merged 3 commits into from
Oct 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion gluco-check-frontend/firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@
"redirects": [
{
"source": "/demo",
"destination": "https://www.youtube.com/watch?v=o7-T2IrDJ_A",
"destination": "https://youtu.be/o7-T2IrDJ_A",
"type": 307
},
{
"source": "/routines",
"destination": "https://youtu.be/xfVby1EjmRM",
"type": 307
},
{
Expand Down
3 changes: 2 additions & 1 deletion gluco-check-frontend/public/locales/de/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"image_alt": ""
}
},
"i18nCode": "de-DE",
"languageSelector": {
"buttonLabel": "Sprache",
"contribute": "Übersetzungen beitragen",
Expand All @@ -142,4 +143,4 @@
"de": "Deutsch"
}
}
}
}
3 changes: 2 additions & 1 deletion gluco-check-frontend/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"image_alt": ""
}
},
"i18nCode": "en-US",
"languageSelector": {
"buttonLabel": "Language",
"contribute": "Contribute Translations",
Expand All @@ -142,4 +143,4 @@
"de": "Deutsch"
}
}
}
}
3 changes: 2 additions & 1 deletion gluco-check-frontend/public/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"image_alt": ""
}
},
"i18nCode": "es-ES",
"languageSelector": {
"buttonLabel": "Idioma",
"contribute": "Contribuir Traducciones",
Expand All @@ -142,4 +143,4 @@
"de": "Deutsch"
}
}
}
}
3 changes: 2 additions & 1 deletion gluco-check-frontend/public/locales/nl/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"image_alt": ""
}
},
"i18nCode": "nl-NL",
"languageSelector": {
"buttonLabel": "Taal",
"contribute": "Vertaling bijdragen",
Expand All @@ -142,4 +143,4 @@
"de": "Deutsch"
}
}
}
}
3 changes: 2 additions & 1 deletion gluco-check-frontend/public/locales/sv/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"image_alt": ""
}
},
"i18nCode": "sv-SE",
"languageSelector": {
"buttonLabel": "Språk",
"contribute": "Bidra med översättningar",
Expand All @@ -142,4 +143,4 @@
"de": "Deutsch"
}
}
}
}
2 changes: 1 addition & 1 deletion gluco-check-frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default function App() {
aria-label={t("navigation.faqs")}
color="inherit"
data-testid="navigation-home"
href={FAQS_URL}
href={`${FAQS_URL}/${t("i18nCode")}`}
>
<Help />
</IconButton>
Expand Down
6 changes: 3 additions & 3 deletions gluco-check-frontend/src/__snapshots__/App.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ exports[`App component renders the component when no user and no loading 1`] = `
aria-label="navigation.faqs"
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit"
data-testid="navigation-home"
href="/faq"
href="/faq/i18nCode"
tabindex="0"
>
<span
Expand Down Expand Up @@ -149,7 +149,7 @@ exports[`App component renders the component when user loaded 1`] = `
aria-label="navigation.faqs"
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit"
data-testid="navigation-home"
href="/faq"
href="/faq/i18nCode"
tabindex="0"
>
<span
Expand Down Expand Up @@ -258,7 +258,7 @@ exports[`App component renders the component when user loading 1`] = `
aria-label="navigation.faqs"
class="MuiButtonBase-root MuiIconButton-root MuiIconButton-colorInherit"
data-testid="navigation-home"
href="/faq"
href="/faq/i18nCode"
tabindex="0"
>
<span
Expand Down
8 changes: 6 additions & 2 deletions gluco-check-frontend/src/components/Boilerplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ function Boilerplate({ handleSignoutClicked }: BoilerplateProps) {
<Typography>
<Trans i18nKey="boilerplate.terms">
By continuing, you are indicating that you accept our{" "}
<Link href={TERMS_AND_CONDITIONS_URL}>Terms of Service</Link> and{" "}
<Link href={PRIVACY_URL}>Privacy Policy</Link>.
<Link href={`${TERMS_AND_CONDITIONS_URL}/${t("i18nCode")}`}>
Terms of Service
</Link>
and{" "}
<Link href={`${PRIVACY_URL}/${t("i18nCode")}`}>Privacy Policy</Link>
.
</Trans>
</Typography>
<Typography>{t("boilerplate.google")}</Typography>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ describe("LanguageSelector component", () => {
expect.assertions(2);
const windowOpenSpy = jest.spyOn(global.window, "open");
windowOpenSpy.mockImplementationOnce((url, target, features, replace) => {
expect(url).toMatchInlineSnapshot(`"https://translate.glucocheck.app"`);
expect(url).toMatchInlineSnapshot(
`"https://pages.glucocheck.app/translations"`
);
return null;
});

Expand Down
3 changes: 2 additions & 1 deletion gluco-check-frontend/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export const NIGHTSCOUT_PROJECT_URL = "http://nightscout.info/";
export const FAQS_URL = "/faq";
export const GLUCO_CHECK_GITHUB_URL =
"https://github.com/nielsmaerten/gluco-check";
export const CONTRIBUTE_TRANSLATIONS = "https://translate.glucocheck.app";
export const CONTRIBUTE_TRANSLATIONS =
"https://pages.glucocheck.app/translations";
export const JOIN_BETA = "/join-beta";

export const APP_DEBUG = process.env.REACT_APP_DEBUG === "true" || false;