From 511a56cab976d379b8006761df0953ccd23e770b Mon Sep 17 00:00:00 2001 From: vgeffer Date: Sat, 14 Dec 2024 14:30:27 +0100 Subject: [PATCH] Translation improvements --- src/components/Admin/custom/SeasonCodeField.tsx | 6 ++++-- .../competition/semester/SemesterList.tsx | 2 -- .../competition/semester/SemesterShow.tsx | 3 --- .../competition/semester/seasonCodeStrings.ts | 5 ----- src/components/Admin/seasonCodeStrings.ts | 6 +++--- src/components/Admin/translations/sk_SK.ts | 17 +++++++++++++++-- 6 files changed, 22 insertions(+), 17 deletions(-) delete mode 100644 src/components/Admin/resources/competition/semester/seasonCodeStrings.ts diff --git a/src/components/Admin/custom/SeasonCodeField.tsx b/src/components/Admin/custom/SeasonCodeField.tsx index ef821dad..5c8ed45c 100644 --- a/src/components/Admin/custom/SeasonCodeField.tsx +++ b/src/components/Admin/custom/SeasonCodeField.tsx @@ -1,14 +1,16 @@ import {FC} from 'react' -import {FunctionField, FunctionFieldProps} from 'react-admin' +import {FunctionField, FunctionFieldProps, useTranslate} from 'react-admin' import {seasonCodeStrings} from '../seasonCodeStrings' export const SeasonCodeField: FC> = ({source, ...rest}) => { + const translate = useTranslate() + return ( { - return `${seasonCodeStrings[record.season_code].name ?? ''}` + return translate(seasonCodeStrings[record.season_code].name ?? '') }} {...rest} /> diff --git a/src/components/Admin/resources/competition/semester/SemesterList.tsx b/src/components/Admin/resources/competition/semester/SemesterList.tsx index 7f2a8c06..729e617f 100644 --- a/src/components/Admin/resources/competition/semester/SemesterList.tsx +++ b/src/components/Admin/resources/competition/semester/SemesterList.tsx @@ -13,8 +13,6 @@ import { import {DateTimeField} from '@/components/Admin/custom/DateTimeField' import {SeasonCodeField} from '@/components/Admin/custom/SeasonCodeField' -import {seasonCodeStrings} from './seasonCodeStrings' - export const SemesterList: FC = () => ( diff --git a/src/components/Admin/resources/competition/semester/SemesterShow.tsx b/src/components/Admin/resources/competition/semester/SemesterShow.tsx index 61715520..30473017 100644 --- a/src/components/Admin/resources/competition/semester/SemesterShow.tsx +++ b/src/components/Admin/resources/competition/semester/SemesterShow.tsx @@ -3,7 +3,6 @@ import { ArrayField, BooleanField, Datagrid, - FunctionField, NumberField, ReferenceArrayField, ReferenceField, @@ -18,8 +17,6 @@ import {MyShow} from '@/components/Admin/custom/MyShow' import {SeasonCodeField} from '@/components/Admin/custom/SeasonCodeField' import {TruncatedTextField} from '@/components/Admin/custom/TruncatedTextField' -import {seasonCodeStrings} from './seasonCodeStrings' - export const SemesterShow: FC = () => ( diff --git a/src/components/Admin/resources/competition/semester/seasonCodeStrings.ts b/src/components/Admin/resources/competition/semester/seasonCodeStrings.ts deleted file mode 100644 index 92d94ac5..00000000 --- a/src/components/Admin/resources/competition/semester/seasonCodeStrings.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const seasonCodeStrings = [ - {id: 0, name: 'Zimný'}, - {id: 1, name: 'Letný'}, - {id: 2, name: 'Iný'}, -] diff --git a/src/components/Admin/seasonCodeStrings.ts b/src/components/Admin/seasonCodeStrings.ts index 92d94ac5..496a989d 100644 --- a/src/components/Admin/seasonCodeStrings.ts +++ b/src/components/Admin/seasonCodeStrings.ts @@ -1,5 +1,5 @@ export const seasonCodeStrings = [ - {id: 0, name: 'Zimný'}, - {id: 1, name: 'Letný'}, - {id: 2, name: 'Iný'}, + {id: 0, name: 'content.seasons.winter'}, + {id: 1, name: 'content.seasons.summer'}, + {id: 2, name: 'content.seasons.other'}, ] diff --git a/src/components/Admin/translations/sk_SK.ts b/src/components/Admin/translations/sk_SK.ts index 5563660d..46f12e6d 100644 --- a/src/components/Admin/translations/sk_SK.ts +++ b/src/components/Admin/translations/sk_SK.ts @@ -3,6 +3,14 @@ import slovakMessages from 'ra-language-slovak' export const sk_SK = { ra: { ...slovakMessages.ra, + page: { + ...slovakMessages.ra.page, + list: '%{name}', + }, + sort: { + ASC: 'Vzostupne', + DESC: 'Zostupne', + }, }, resources: { 'cms/post': { @@ -18,7 +26,7 @@ export const sk_SK = { links: 'Odkazy', }, }, - 'base/flat-page': { + 'cms/flat-page': { name: 'Ploché stránky', fields: { id: 'ID', @@ -113,7 +121,7 @@ export const sk_SK = { }, }, 'competition/event-registration': { - name: 'Registrácia do súťaží', + name: 'Registrácie do súťaží', fields: { school: { abbreviation: 'Škola', @@ -180,5 +188,10 @@ export const sk_SK = { footer: { timezone_message: 'Všetky časy sú uvedené v časovom pásme Europe/Bratislava', }, + seasons: { + winter: 'Zimný', + summer: 'Letný', + other: 'Iný', + }, }, }