diff --git a/app/src/components/HistoryTable.tsx b/app/src/components/HistoryTable.tsx index f912d45..fef1d24 100644 --- a/app/src/components/HistoryTable.tsx +++ b/app/src/components/HistoryTable.tsx @@ -101,11 +101,19 @@ export default function HistoryTable({ {duration && {duration}} {plannedTotal > 0 && ( - norma {plannedDone}/{plannedTotal} + {t('history.quota', { done: plannedDone, total: plannedTotal })} + + )} + {extraSets > 0 && ( + + {t('history.bonusValue', { n: extraSets })} + + )} + {deficit > 0 && ( + + {t('history.deficitValue', { n: deficit })} )} - {extraSets > 0 && +{extraSets} bonus} - {deficit > 0 && deficyt {deficit}}
diff --git a/app/src/i18n/index.ts b/app/src/i18n/index.ts index f0da552..f118d65 100644 --- a/app/src/i18n/index.ts +++ b/app/src/i18n/index.ts @@ -86,20 +86,28 @@ const resources = { const initial = detectInitialLanguage(); applyDocumentLanguage(initial); -void i18n.use(initReactI18next).init({ - lng: initial, - fallbackLng: 'pl', - supportedLngs: ['pl', 'en'], - defaultNS: 'common', - ns: [...NAMESPACES], - resources, - interpolation: { escapeValue: false }, - react: { useSuspense: false }, -}); +void i18n + .use(initReactI18next) + .init({ + lng: initial, + fallbackLng: 'pl', + supportedLngs: ['pl', 'en'], + defaultNS: 'common', + ns: [...NAMESPACES], + resources, + interpolation: { escapeValue: false }, + react: { useSuspense: false }, + }) + .then(() => { + document.title = i18n.t('common:documentTitle'); + }); -// podąża za językiem także przy zmianie przez i18n.changeLanguage -// (testy, przełącznik), nie tylko przez changeLanguage() z tego modułu. -i18n.on('languageChanged', (lng) => applyDocumentLanguage(lng === 'en' ? 'en' : 'pl')); +// i document.title podążają za językiem także przy zmianie przez +// i18n.changeLanguage (testy, przełącznik), nie tylko przez changeLanguage() z tego modułu. +i18n.on('languageChanged', (lng) => { + applyDocumentLanguage(lng === 'en' ? 'en' : 'pl'); + document.title = i18n.t('common:documentTitle'); +}); export function changeLanguage(lang: Language) { setStoredLanguage(lang); diff --git a/app/src/i18n/locales/en/common.json b/app/src/i18n/locales/en/common.json index 34b1271..50b2df2 100644 --- a/app/src/i18n/locales/en/common.json +++ b/app/src/i18n/locales/en/common.json @@ -1,5 +1,6 @@ { "appName": "FitOS", + "documentTitle": "FitOS", "errorPrefix": "Error: ", "cancel": "Cancel", "confirm": "Confirm", @@ -160,6 +161,9 @@ "addComment": "Add a comment", "difficultyWord": "difficulty {{n}}", "deleteCommentAria": "Delete {{author}}'s comment", - "commentForAria": "Comment for {{name}}" + "commentForAria": "Comment for {{name}}", + "quota": "quota {{done}}/{{total}}", + "bonusValue": "+{{n}} bonus", + "deficitValue": "deficit {{n}}" } } diff --git a/app/src/i18n/locales/pl/common.json b/app/src/i18n/locales/pl/common.json index 8b3dd52..8290697 100644 --- a/app/src/i18n/locales/pl/common.json +++ b/app/src/i18n/locales/pl/common.json @@ -1,5 +1,6 @@ { "appName": "FitOS", + "documentTitle": "FitOS", "errorPrefix": "Błąd: ", "cancel": "Anuluj", "confirm": "Potwierdź", @@ -173,6 +174,9 @@ "addComment": "Dodaj komentarz", "difficultyWord": "trudność {{n}}", "deleteCommentAria": "Usuń komentarz {{author}}", - "commentForAria": "Komentarz dla ćwiczenia {{name}}" + "commentForAria": "Komentarz dla ćwiczenia {{name}}", + "quota": "norma {{done}}/{{total}}", + "bonusValue": "+{{n}} bonus", + "deficitValue": "deficyt {{n}}" } }