From 4157bd13bb5780df6c5b81e05773d3d7059a154f Mon Sep 17 00:00:00 2001 From: timwessman Date: Mon, 11 Mar 2024 14:34:54 +0200 Subject: [PATCH 1/2] fix: translations --- src/constants.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index e623a9b4..d1b9eaa7 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -11,16 +11,20 @@ import { export const uiRuleLabels: { [key in RuleType]: { [x in Language]: string }; } = { - week_every: { fi: 'Joka viikko', sv: 'Joka viikko', en: 'Joka viikko' }, + week_every: { + fi: 'Joka viikko', + sv: 'Varje vecka', + en: 'Every week', + }, week_even: { fi: 'Parilliset viikot', - sv: 'Parilliset viikot', - en: 'Parilliset viikot', + sv: 'Jämna veckor', + en: 'Even weeks ', }, week_odd: { fi: 'Parittomat viikot', - sv: 'Parittomat viikot', - en: 'Parittomat viikot', + sv: 'Udda veckor', + en: 'Odd weeks', }, }; From 3cfaf7eb8510a816c24502d656cd5cb974add3ad Mon Sep 17 00:00:00 2001 From: timwessman Date: Mon, 11 Mar 2024 14:36:59 +0200 Subject: [PATCH 2/2] fix: try Finnish resource name if the desired language is not available --- src/components/resource-title/ResourceTitle.tsx | 1 + src/pages/ResourceBatchUpdatePage.tsx | 4 ++-- src/pages/ResourcePage.tsx | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/resource-title/ResourceTitle.tsx b/src/components/resource-title/ResourceTitle.tsx index 45eb3259..5815dbd1 100644 --- a/src/components/resource-title/ResourceTitle.tsx +++ b/src/components/resource-title/ResourceTitle.tsx @@ -25,6 +25,7 @@ const ResourceTitle = ({ const title = useRef(null); const name = resource?.name[language] || + resource?.name?.fi || displayLangVersionNotFound({ language, label: `${ diff --git a/src/pages/ResourceBatchUpdatePage.tsx b/src/pages/ResourceBatchUpdatePage.tsx index ded0c6ec..161a9e87 100644 --- a/src/pages/ResourceBatchUpdatePage.tsx +++ b/src/pages/ResourceBatchUpdatePage.tsx @@ -274,12 +274,12 @@ const ResourceBatchUpdatePage = ({ .filter((r) => r.resource) .map((r) => ({ id: r.id, - name: r?.resource?.name[language], + name: r?.resource?.name[language] || r?.resource?.name?.fi, })); const newData = { mainResourceId: resource.id, - mainResourceName: resource?.name[language], + mainResourceName: resource?.name[language] || resource?.name.fi, targetResources, }; diff --git a/src/pages/ResourcePage.tsx b/src/pages/ResourcePage.tsx index ca31525b..950077c8 100644 --- a/src/pages/ResourcePage.tsx +++ b/src/pages/ResourcePage.tsx @@ -97,7 +97,7 @@ const ResourcePage = ({ const targetResourceIDs = targetResourcesString.split(','); const newData = { mainResourceId: resource.id, - mainResourceName: resource?.name[language], + mainResourceName: resource?.name[language] || resource?.name?.fi, targetResources: targetResourceIDs.map((id) => ({ id, name: '', @@ -244,6 +244,7 @@ const ResourcePage = ({ href={`/resource/${parentResource.id}`} text={ parentResource?.name[language] || + parentResource?.name?.fi || displayLangVersionNotFound({ language, label: 'toimipisteen nimi', @@ -279,6 +280,7 @@ const ResourcePage = ({ language={language} heading={ childResource?.name[language] || + childResource?.name?.fi || displayLangVersionNotFound({ language, label: 'alakohteen nimi',