Skip to content

Commit

Permalink
Added label translations
Browse files Browse the repository at this point in the history
  • Loading branch information
vgeffer committed Nov 24, 2024
1 parent 0fe7dbb commit 5ffc255
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/components/Admin/custom/LatexPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const LatexPreview: FC<FieldProps> = ({source}) => {
if (!source) return null

return (
<Labeled label="Preview">
<Labeled label="content.labels.preview">
<FormDataConsumer>
{({formData}) => {
const data = formData[source]
Expand Down
2 changes: 1 addition & 1 deletion src/components/Admin/custom/MyEditActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const MyEditActions: FC = () => {
TODO: try again after RA upgrade */}
{/* @ts-ignore */}
<ShowButton to={to} />
<ListButton label="Back to list" />
<ListButton label="content.labels.back_to_list" />
</TopToolbar>
)
}
2 changes: 1 addition & 1 deletion src/components/Admin/custom/MyShowActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const MyShowActions: FC = () => {
return (
<TopToolbar>
<EditButton to={to} />
<ListButton label="Back to list" />
<ListButton label="content.labels.back_to_list" />
</TopToolbar>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const CompetitionEdit: FC = () => (
<NumberInput source="start_year" fullWidth disabled />
<TextInput source="description" multiline fullWidth />
<TextInput source="rules" multiline fullWidth />
<TextInput source="competition_type.name" label="Competition type" fullWidth disabled />
<TextInput source="competition_type.name" label="content.labels.competition_type" fullWidth disabled />
<SitesCheckboxInput source="sites" disabled />
<TextInput source="who_can_participate" fullWidth />
<NumberInput source="min_years_until_graduation" fullWidth disabled />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ export const CompetitionList: FC = () => (
<TextField source="start_year" />
<TruncatedTextField source="description" maxTextWidth={30} />
<TruncatedTextField source="rules" maxTextWidth={30} />
<TextField source="competition_type.name" label="Competition type" />
<TextField source="competition_type.name" label="content.labels.competition_type" />
<SitesArrayField source="sites" />
<TextField source="who_can_participate" />
<NumberField source="min_years_until_graduation" />
<FunctionField<RaRecord>
source="history_events"
label="History events count"
label="content.labels.history_events_count"
render={(record) => record && <span>{record['history_events'].length}</span>}
/>
</Datagrid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const CompetitionShow: FC = () => (
<TextField source="start_year" />
<TruncatedTextField source="description" maxTextWidth={100} expandable />
<TruncatedTextField source="rules" maxTextWidth={200} expandable />
<TextField source="competition_type.name" label="Competition type" />
<TextField source="competition_type.name" label="content.labels.competition_type" />
<SitesArrayField source="sites" />
<TextField source="who_can_participate" />
<NumberField source="min_years_until_graduation" />
Expand All @@ -49,7 +49,6 @@ export const CompetitionShow: FC = () => (
<DateTimeField source="end" />
<FunctionField<RaRecord>
source="publication_set"
label="Publication count"
render={(record) => record && <span>{record['publication_set'].length}</span>}
/>
</Datagrid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const UpcomingOrCurrentEvent: FC = () => {

return (
<Labeled
label="Prebiehajúca alebo najbližšia akcia"
label="content.labels.next_event"
onClick={() => redirect('show', 'competition/event', record.upcoming_or_current_event.competition)}
sx={{cursor: 'pointer'}}
>
Expand All @@ -37,7 +37,6 @@ export const UpcomingOrCurrentEvent: FC = () => {

<FunctionField<RaRecord>
source="publication_set"
label="Publication count"
// optional access because of weird behavior of nested FunctionFields for null record
render={(record) => record && <span>{record['publication_set']?.length}</span>}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const EventRegistrationList: FC = () => (
<Datagrid rowClick="show">
<FunctionField
source="profile.last_name"
label="Meno a priezvisko"
label="content.labels.name"
render={(record: EventRegistration) => `${record.profile.first_name} ${record.profile.last_name}`}
/>
<TextField source="school.abbreviation" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const EventRegistrationShow: FC = () => (
<SimpleShowLayout>
<FunctionField
source="profile.last_name"
label="Meno a priezvisko"
label="content.labels.name"
render={(record: EventRegistration) => `${record.profile.first_name} ${record.profile.last_name}`}
/>
<TextField source="school.abbreviation" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export const EventCreate: FC = () => {
<TextInput source="location" fullWidth />
<FormControlLabel
control={<Checkbox checked={includeRegLink} onChange={(e) => setIncludeRegLink(e.target.checked)} />}
label="Pridať registračný link"
label="content.labels.reg_link_add"
/>
{includeRegLink && (
<Labeled label="Registration link">
<Labeled label="content.labels.reg_link">
<>
<NumberInput source="registration_link.id" fullWidth disabled />
<TextInput source="registration_link.url" fullWidth validate={required()} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ export const EventEdit: FC = () => {
<TextInput source="location" fullWidth />
<FormControlLabel
control={<Checkbox checked={includeRegLink} onChange={(e) => setIncludeRegLink(e.target.checked)} />}
label="Upraviť registračný link"
label="content.labels.reg_link_add"
/>
{includeRegLink && (
<Labeled label="Registration link">
<Labeled label="content.labels.reg_link">
<>
<NumberInput source="registration_link.id" fullWidth disabled />
<TextInput source="registration_link.url" fullWidth validate={required()} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const ProblemList: FC = () => (
<TruncatedTextField source="text" maxTextWidth={50} />
<ImageField source="image" sx={{'& .RaImageField-image': {width: 100, height: 75}}} />
<FunctionField<RaRecord>
label="Má vzorák"
label="content.labels.has_vzorak"
render={(record) => record && <BooleanField record={{xxx: !!record['solution_pdf']}} source="xxx" />}
/>
<NumberField source="num_comments" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const SeriesList: FC = () => (
<TextField source="order" />
<BooleanField source="complete" />
<FunctionField<RaRecord>
label="Problem count"
label="content.labels.problem_count"
render={(record) => record && <span>{record['problems'].length}</span>}
/>
</Datagrid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export const SolutionCreate: FC = () => (
<FileInput source="solution" accept="application/pdf">
<MyFileField />
</FileInput>
<ReferenceInput source="late_tag" reference="competition/late-tag" label="Je riešenie po termíne?">
<ReferenceInput source="late_tag" reference="competition/late-tag" label="content.labels.is_late">
<AutocompleteInput optionText="name" fullWidth />
</ReferenceInput>
<BooleanInput source="is_online" label="Je to internetové riešenie?" />
<BooleanInput source="is_online" label="content.labels.is_online" />
</SimpleForm>
</MyCreate>
)
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export const SolutionEdit: FC = () => (
<FileInput source="solution" accept="application/pdf">
<MyFileField />
</FileInput>
<ReferenceInput source="late_tag" reference="competition/late-tag" label="Je riešenie po termíne?">
<ReferenceInput source="late_tag" reference="competition/late-tag" label="content.labels.is_late">
<AutocompleteInput optionText="name" fullWidth />
</ReferenceInput>
<BooleanInput source="is_online" label="Je to internetové riešenie?" />
<BooleanInput source="is_online" label="content.labels.is_online" />
</SimpleForm>
</MyEdit>
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const SolutionList: FC = () => (
<ReferenceField source="problem" reference="competition/problem" link={false} />
<ReferenceField source="semester_registration" reference="competition/event-registration" link={false} />
<FunctionField<RaRecord>
label="Má nahraté riešenie"
label="content.labels.has_solution"
render={(record) => record && <BooleanField record={{xxx: !!record['solution']}} source="xxx" />}
/>
<ReferenceField source="late_tag" reference="competition/late-tag" link={false} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const SolutionShow: FC = () => (
<ReferenceField source="problem" reference="competition/problem" link="show" />
<ReferenceField source="semester_registration" reference="competition/event-registration" link="show" />
<FileField source="solution" title="Riešenie" />
<ReferenceField source="late_tag" reference="competition/late-tag" label="Po termíne" link="show" />
<BooleanField source="is_online" label="Internetové riešenie" />
<ReferenceField source="late_tag" reference="competition/late-tag" label="content.labels.is_late" link="show" />
<BooleanField source="is_online" label="content.labels.is_online" />
</SimpleShowLayout>
</MyShow>
)
12 changes: 12 additions & 0 deletions src/components/Admin/translations/sk_SK.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ export const sk_SK = {
late_tags: 'Late_tags',
problems: 'Úlohy',
history_events: 'History_Events',
back_to_list: 'Späť na list',
competition_type: 'competition_type',
history_events_count: 'HE count',
name: 'Meno a priezvisko',
reg_link: 'Odkaz na registráciu',
reg_link_add: 'Pridať odkaz na registráciu',
problem_count: 'Počet úloh',
is_online: 'Internetové riešenie?',
is_late: 'Riešenie po termíne?',
next_event: 'Prebiehajúca alebo najbližšia akcia',
has_vzorak: 'Má vzorák',
has_solution: 'Má nahraté riešenie',
},
footer: {
timezone_message: 'Všetky časy sú uvedené v časovom pásme Europe/Bratislava',
Expand Down

0 comments on commit 5ffc255

Please sign in to comment.