Skip to content

Commit

Permalink
Merge pull request #384 from City-of-Helsinki/HAUKI-610-language-fixes
Browse files Browse the repository at this point in the history
fix: Hauki 610 language fixes
  • Loading branch information
timwessman authored Mar 11, 2024
2 parents f77b347 + 3cfaf7e commit 8f14c63
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/components/resource-title/ResourceTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const ResourceTitle = ({
const title = useRef<HTMLHeadingElement>(null);
const name =
resource?.name[language] ||
resource?.name?.fi ||
displayLangVersionNotFound({
language,
label: `${
Expand Down
14 changes: 9 additions & 5 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
};

Expand Down
4 changes: 2 additions & 2 deletions src/pages/ResourceBatchUpdatePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
4 changes: 3 additions & 1 deletion src/pages/ResourcePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
Expand Down Expand Up @@ -244,6 +244,7 @@ const ResourcePage = ({
href={`/resource/${parentResource.id}`}
text={
parentResource?.name[language] ||
parentResource?.name?.fi ||
displayLangVersionNotFound({
language,
label: 'toimipisteen nimi',
Expand Down Expand Up @@ -279,6 +280,7 @@ const ResourcePage = ({
language={language}
heading={
childResource?.name[language] ||
childResource?.name?.fi ||
displayLangVersionNotFound({
language,
label: 'alakohteen nimi',
Expand Down

0 comments on commit 8f14c63

Please sign in to comment.