From 3f2d00a23076b420bec81ab29ddb4a8b452c1aa5 Mon Sep 17 00:00:00 2001 From: Antoine Jaussoin Date: Sun, 8 May 2022 21:54:37 +0100 Subject: [PATCH] Slava Ukraini (#404) --- README.md | 1 + frontend/src/Layout.tsx | 44 ++++++++++++++++++-- frontend/src/components/Flag.tsx | 36 ++++++++++++++++ frontend/src/components/LanguagePicker.tsx | 29 ++----------- frontend/src/translations/locales/ar-SA.json | 7 +++- frontend/src/translations/locales/de-DE.json | 7 +++- frontend/src/translations/locales/en-GB.json | 7 +++- frontend/src/translations/locales/es-ES.json | 7 +++- frontend/src/translations/locales/fr-FR.json | 9 +++- frontend/src/translations/locales/hu-HU.json | 7 +++- frontend/src/translations/locales/it-IT.json | 7 +++- frontend/src/translations/locales/ja-JP.json | 7 +++- frontend/src/translations/locales/nl-NL.json | 7 +++- frontend/src/translations/locales/pl-PL.json | 7 +++- frontend/src/translations/locales/pt-BR.json | 7 +++- frontend/src/translations/locales/pt-PT.json | 7 +++- frontend/src/translations/locales/uk-UA.json | 7 +++- frontend/src/translations/locales/zh-CN.json | 7 +++- frontend/src/translations/locales/zh-TW.json | 7 +++- 19 files changed, 173 insertions(+), 44 deletions(-) create mode 100644 frontend/src/components/Flag.tsx diff --git a/README.md b/README.md index d9ca40930..62d756e37 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ This will run a demo version, which you can turn into a fully licenced version b ### Version 4.16.0 - Complete overhaul of the translations. Switching to [i18next](https://www.i18next.com). Translated all languages using Machine Learning (via Crowdin). +- Added translations for the Ukrainian language, and a link to provide help for Ukraine. - Fix the empty file download when logging using Google OAuth - Upgrade the documentation to the latest version of Docusaurus - Add more integration tests, covering password accounts and account deletion diff --git a/frontend/src/Layout.tsx b/frontend/src/Layout.tsx index 4ea36b736..caa38e8c5 100644 --- a/frontend/src/Layout.tsx +++ b/frontend/src/Layout.tsx @@ -26,6 +26,8 @@ import { Alert, AlertTitle, Button, Hidden } from '@mui/material'; import useBackendCapabilities from './global/useBackendCapabilities'; import useIsPro from 'auth/useIsPro'; import ProButton from 'components/ProButton'; +import { Flag } from 'components/Flag'; +import { useTranslation } from 'react-i18next'; const Home = lazy(() => import('./views/Home' /* webpackChunkName: "home" */)); const Game = lazy(() => import('./views/Game' /* webpackChunkName: "game" */)); @@ -103,6 +105,7 @@ function App() { const goToHome = useCallback(() => navigate('/'), [navigate]); const location = useLocation(); const isOnGamePage = !!useMatch('game/:gameId/*'); + const { t } = useTranslation(); // Tracks page views on every location change useEffect(() => { @@ -113,7 +116,7 @@ function App() {
{!backend.licenced ? ( - Retrospected is Unlicenced + {t('Main.unlicenced.title')} This software is unlicenced. You can obtain a licence{' '} ) : null} - + + {t('Main.helpUkraine')} + + + + {isOnGamePage ? : null} {isInitialised ? ( ) : ( - Loading... + {t('Main.loading')} )} @@ -225,4 +244,23 @@ const Spacer = styled.div` flex: 1; `; +const HelpUkraine = styled.div` + display: flex; + align-items: center; + justify-content: center; + margin: 0 20px; + a { + font-style: unset; + text-decoration: unset; + font-size: 1.2rem; + font-weight: 100; + color: #0057b7; + } + border: 1px solid #0057b7; + border-radius: 5px; + padding: 10px; + backdrop-filter: blur(10px); + background-color: rgba(255, 255, 255, 0.3); +`; + export default App; diff --git a/frontend/src/components/Flag.tsx b/frontend/src/components/Flag.tsx new file mode 100644 index 000000000..50a90fe23 --- /dev/null +++ b/frontend/src/components/Flag.tsx @@ -0,0 +1,36 @@ +import styled from '@emotion/styled'; +import 'flag-icons/css/flag-icons.min.css'; + +type FlagProps = { + country: string; +}; + +export function Flag({ country }: FlagProps) { + return ( + + + + ); +} + +const FlagIcon = styled.div` + font-size: 32px; + margin-left: 10px; + height: 32px; + margin-right: 8px; + position: relative; +`; + +const FlagOverlay = styled.div` + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + height: 32px; + background: linear-gradient( + to bottom, + rgba(255, 255, 255, 0.5) 0%, + rgba(255, 255, 255, 0) 100% + ); +`; diff --git a/frontend/src/components/LanguagePicker.tsx b/frontend/src/components/LanguagePicker.tsx index 0c25e5ff4..917ee2026 100644 --- a/frontend/src/components/LanguagePicker.tsx +++ b/frontend/src/components/LanguagePicker.tsx @@ -4,7 +4,7 @@ import Select from '@mui/material/Select'; import { SelectChangeEvent } from '@mui/material'; import MenuItem from '@mui/material/MenuItem'; import { languages } from '../translations'; -import 'flag-icons/css/flag-icons.min.css'; +import { Flag } from './Flag'; interface LanguagePickerProps { value: string; @@ -33,9 +33,7 @@ const LanguagePicker = ({ value, onChange }: LanguagePickerProps) => { data-cy={`language-picker-item-${language.locale}`} > - - - + {language.name} {language.englishName} @@ -56,34 +54,15 @@ const LanguageItem = styled.div` align-items: center; `; -const Flag = styled.div` - font-size: 32px; - margin-left: 10px; - height: 32px; - margin-right: 8px; - position: relative; -`; - -const FlagOverlay = styled.div` - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - height: 32px; - background: linear-gradient( - to bottom, - rgba(255, 255, 255, 0.5) 0%, - rgba(255, 255, 255, 0) 100% - ); -`; const Names = styled.div` margin-left: 5px; display: flex; flex-direction: column; font-size: 0.8em; `; + const Name = styled.div``; + const EnglishName = styled.div` color: grey; `; diff --git a/frontend/src/translations/locales/ar-SA.json b/frontend/src/translations/locales/ar-SA.json index 8c03cb190..819ecfb6f 100644 --- a/frontend/src/translations/locales/ar-SA.json +++ b/frontend/src/translations/locales/ar-SA.json @@ -11,7 +11,12 @@ "header": "إختيار اللُّغة" }, "Main": { - "hint": "يمكنُكَ دعوة أشخاص إلى هذه الجلسة عن طريق نسخ عنوان هذه الصفحة" + "hint": "يمكنُكَ دعوة أشخاص إلى هذه الجلسة عن طريق نسخ عنوان هذه الصفحة", + "helpUkraine": "ساعد أوكرانيا!", + "loading": "تحميل...", + "unlicenced": { + "title": "الاستطلاع التراجعي غير مرخص" + } }, "Home": { "welcome": "مرحبا، {{name}}" diff --git a/frontend/src/translations/locales/de-DE.json b/frontend/src/translations/locales/de-DE.json index 8cffb89c7..baabe0011 100644 --- a/frontend/src/translations/locales/de-DE.json +++ b/frontend/src/translations/locales/de-DE.json @@ -11,7 +11,12 @@ "header": "Sprache auswählen" }, "Main": { - "hint": "Du kannst Andere zu dieser Session einladen indem Du ihnen die URL schickst" + "hint": "Du kannst Andere zu dieser Session einladen indem Du ihnen die URL schickst", + "helpUkraine": "Hilf der Ukraine!", + "loading": "Wird geladen...", + "unlicenced": { + "title": "Retrospected ist nicht lizenziert" + } }, "Home": { "welcome": "Willkommen, {{name}}" diff --git a/frontend/src/translations/locales/en-GB.json b/frontend/src/translations/locales/en-GB.json index e607597fc..2726e3218 100644 --- a/frontend/src/translations/locales/en-GB.json +++ b/frontend/src/translations/locales/en-GB.json @@ -11,7 +11,12 @@ "header": "Choose a language" }, "Main": { - "hint": "You can invite others to this session by copy-pasting the URL" + "hint": "You can invite others to this session by copy-pasting the URL", + "helpUkraine": "Help Ukraine!", + "loading": "Loading...", + "unlicenced": { + "title": "Retrospected is Unlicenced" + } }, "Home": { "welcome": "Welcome, {{name}}" diff --git a/frontend/src/translations/locales/es-ES.json b/frontend/src/translations/locales/es-ES.json index d83ffaa44..4b9605d8b 100644 --- a/frontend/src/translations/locales/es-ES.json +++ b/frontend/src/translations/locales/es-ES.json @@ -11,7 +11,12 @@ "header": "Escoje un idioma" }, "Main": { - "hint": "Puedes invitar a otros a esta sesión compartiendo la URL" + "hint": "Puedes invitar a otros a esta sesión compartiendo la URL", + "helpUkraine": "¡Ayuda a Ucrania!", + "loading": "Cargando...", + "unlicenced": { + "title": "El retrospectivo está sin licencia" + } }, "Home": { "welcome": "Bienvenido, {{name}}" diff --git a/frontend/src/translations/locales/fr-FR.json b/frontend/src/translations/locales/fr-FR.json index e563bc85a..6829cee14 100644 --- a/frontend/src/translations/locales/fr-FR.json +++ b/frontend/src/translations/locales/fr-FR.json @@ -11,7 +11,12 @@ "header": "Changez de langue" }, "Main": { - "hint": "Vous pouvez inviter d'autres participants en leur envoyant l'URL de cette page" + "hint": "Vous pouvez inviter d'autres participants en leur envoyant l'URL de cette page", + "helpUkraine": "Aidez l'Ukraine!", + "loading": "Chargement en cours...", + "unlicenced": { + "title": "Retrospected est sans licence" + } }, "Home": { "welcome": "Bienvenue, {{name}}" @@ -140,7 +145,7 @@ "sailboat": "Bateau" }, "Clients": { - "header": "Participants:", + "header": "Participants :", "joined": "{{users}} connecté.", "left": "{{users}} déconnecté." }, diff --git a/frontend/src/translations/locales/hu-HU.json b/frontend/src/translations/locales/hu-HU.json index dfe3a8f26..9b2c51117 100644 --- a/frontend/src/translations/locales/hu-HU.json +++ b/frontend/src/translations/locales/hu-HU.json @@ -11,7 +11,12 @@ "header": "Válassz nyelvet" }, "Main": { - "hint": "Ha meg akarsz hívni másokat, másold ki és oszd meg velük az URL-t" + "hint": "Ha meg akarsz hívni másokat, másold ki és oszd meg velük az URL-t", + "helpUkraine": "Segíts Ukrajnának!", + "loading": "Betöltés...", + "unlicenced": { + "title": "Az utólag jogosítvány nélküli" + } }, "Home": { "welcome": "Isten hozott, {{name}}" diff --git a/frontend/src/translations/locales/it-IT.json b/frontend/src/translations/locales/it-IT.json index a7b04b9ce..6f14224e7 100644 --- a/frontend/src/translations/locales/it-IT.json +++ b/frontend/src/translations/locales/it-IT.json @@ -11,7 +11,12 @@ "header": "Scegli una lingua" }, "Main": { - "hint": "Puoi invitare altre persone a questa sessione copiando ed incollando la URL" + "hint": "Puoi invitare altre persone a questa sessione copiando ed incollando la URL", + "helpUkraine": "Aiuta Ucraina!", + "loading": "Caricamento...", + "unlicenced": { + "title": "Retrospected is Unlicenced" + } }, "Home": { "welcome": "Benvenuto, {{name}}" diff --git a/frontend/src/translations/locales/ja-JP.json b/frontend/src/translations/locales/ja-JP.json index 0eaf0b003..cb3c5166d 100644 --- a/frontend/src/translations/locales/ja-JP.json +++ b/frontend/src/translations/locales/ja-JP.json @@ -11,7 +11,12 @@ "header": "言語を選択" }, "Main": { - "hint": "URLを共有すれば新たな参加者を本セッションに招待できます" + "hint": "URLを共有すれば新たな参加者を本セッションに招待できます", + "helpUkraine": "ウクライナを助けよう!", + "loading": "読み込み中...", + "unlicenced": { + "title": "Retrospected is unlicenced" + } }, "Home": { "welcome": "ようこそ、 {{name}}" diff --git a/frontend/src/translations/locales/nl-NL.json b/frontend/src/translations/locales/nl-NL.json index 917d7e87b..a4e59adaf 100644 --- a/frontend/src/translations/locales/nl-NL.json +++ b/frontend/src/translations/locales/nl-NL.json @@ -11,7 +11,12 @@ "header": "Kies een taal" }, "Main": { - "hint": "Je kan anderen uitnodigen voor deze sessie door de URL te kopiëren en te plakken" + "hint": "Je kan anderen uitnodigen voor deze sessie door de URL te kopiëren en te plakken", + "helpUkraine": "Help Oekraïne", + "loading": "Laden...", + "unlicenced": { + "title": "Retrospected is niet toegestaan" + } }, "Home": { "welcome": "Welkom, {{name}}" diff --git a/frontend/src/translations/locales/pl-PL.json b/frontend/src/translations/locales/pl-PL.json index 4ad40c07d..76902895e 100644 --- a/frontend/src/translations/locales/pl-PL.json +++ b/frontend/src/translations/locales/pl-PL.json @@ -11,7 +11,12 @@ "header": "Wybierz język" }, "Main": { - "hint": "Możesz zaprosić inne osoby do tej sesji wysyłając im URL" + "hint": "Możesz zaprosić inne osoby do tej sesji wysyłając im URL", + "helpUkraine": "Pomóż Ukrainie!", + "loading": "Ładowanie...", + "unlicenced": { + "title": "Retrospected jest nielicencjonowany" + } }, "Home": { "welcome": "Witaj, {{name}}" diff --git a/frontend/src/translations/locales/pt-BR.json b/frontend/src/translations/locales/pt-BR.json index 02b922bd2..f95849424 100644 --- a/frontend/src/translations/locales/pt-BR.json +++ b/frontend/src/translations/locales/pt-BR.json @@ -11,7 +11,12 @@ "header": "Escolha uma língua" }, "Main": { - "hint": "Você pode convidar outras pessoas para esta seção compartilhando a URL" + "hint": "Você pode convidar outras pessoas para esta seção compartilhando a URL", + "helpUkraine": "Ajude a Ucrânia!", + "loading": "Carregandochar@@0", + "unlicenced": { + "title": "Retrospectiva Não Autorizada" + } }, "Home": { "welcome": "Bem-vindo, {{name}}" diff --git a/frontend/src/translations/locales/pt-PT.json b/frontend/src/translations/locales/pt-PT.json index f01f4a9cb..6cf9bfbdc 100644 --- a/frontend/src/translations/locales/pt-PT.json +++ b/frontend/src/translations/locales/pt-PT.json @@ -11,7 +11,12 @@ "header": "Escolha um idioma" }, "Main": { - "hint": "Você pode convidar outros para esta sessão copiando a URL" + "hint": "Você pode convidar outros para esta sessão copiando a URL", + "helpUkraine": "Ajude a Ucrânia!", + "loading": "Carregandochar@@0", + "unlicenced": { + "title": "Retrospectiva Não Autorizada" + } }, "Home": { "welcome": "Bem-vindo, {{name}}" diff --git a/frontend/src/translations/locales/uk-UA.json b/frontend/src/translations/locales/uk-UA.json index 81f47c26f..e2107653e 100644 --- a/frontend/src/translations/locales/uk-UA.json +++ b/frontend/src/translations/locales/uk-UA.json @@ -11,7 +11,12 @@ "header": "Виберіть мову" }, "Main": { - "hint": "Ви можете запросити інших до цього сеансу, скопіювавши URL" + "hint": "Ви можете запросити інших до цього сеансу, скопіювавши URL", + "helpUkraine": "Допоможіть Україні!", + "loading": "Завантажується...", + "unlicenced": { + "title": "Ретроспекція не ліцензована" + } }, "Home": { "welcome": "Ласкаво просимо, {{name}}" diff --git a/frontend/src/translations/locales/zh-CN.json b/frontend/src/translations/locales/zh-CN.json index 65517fd10..5323fa2ea 100644 --- a/frontend/src/translations/locales/zh-CN.json +++ b/frontend/src/translations/locales/zh-CN.json @@ -11,7 +11,12 @@ "header": "切换语言" }, "Main": { - "hint": "复制并分享网址,即可让别人加入此议程" + "hint": "复制并分享网址,即可让别人加入此议程", + "helpUkraine": "帮助乌克兰!", + "loading": "加载中...", + "unlicenced": { + "title": "返回是未授权的" + } }, "Home": { "welcome": "欢迎, {{name}}" diff --git a/frontend/src/translations/locales/zh-TW.json b/frontend/src/translations/locales/zh-TW.json index b8e4da7b2..497e53212 100644 --- a/frontend/src/translations/locales/zh-TW.json +++ b/frontend/src/translations/locales/zh-TW.json @@ -11,7 +11,12 @@ "header": "切換語言" }, "Main": { - "hint": "複製並分享網址,即可讓別人加入此議程" + "hint": "複製並分享網址,即可讓別人加入此議程", + "helpUkraine": "幫助烏克蘭!", + "loading": "正在加載...", + "unlicenced": { + "title": "追溯是未經許可的" + } }, "Home": { "welcome": "歡迎, {{name}}"