mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-07 08:23:55 +00:00
refactor: deprecate languages
This commit is contained in:
committed by
Carlos Valente
parent
6f34e1006b
commit
8d68a4554d
@@ -1,12 +1,12 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useForm } from 'react-hook-form';
|
||||
import { Select } from '@chakra-ui/react';
|
||||
import { Settings } from 'ontime-types';
|
||||
|
||||
import { postSettings } from '../../../../common/api/settings';
|
||||
import { maybeAxiosError } from '../../../../common/api/utils';
|
||||
import Button from '../../../../common/components/buttons/Button';
|
||||
import Input from '../../../../common/components/input/input/Input';
|
||||
import Select from '../../../../common/components/select/Select';
|
||||
import useSettings from '../../../../common/hooks-query/useSettings';
|
||||
import { preventEscape } from '../../../../common/utils/keyEvent';
|
||||
import { isOnlyNumbers } from '../../../../common/utils/regex';
|
||||
@@ -22,6 +22,8 @@ export default function GeneralSettings() {
|
||||
register,
|
||||
reset,
|
||||
setError,
|
||||
watch,
|
||||
setValue,
|
||||
formState: { isSubmitting, isDirty, isValid, errors },
|
||||
} = useForm<Settings>({
|
||||
mode: 'onChange',
|
||||
@@ -133,10 +135,15 @@ export default function GeneralSettings() {
|
||||
description='Default time format to show in views 12 /24 hours'
|
||||
error={errors.timeFormat?.message}
|
||||
/>
|
||||
<Select variant='ontime' size='sm' width='auto' isDisabled={disableInputs} {...register('timeFormat')}>
|
||||
<option value='12'>12 hours 11:00:10 PM</option>
|
||||
<option value='24'>24 hours 23:00:10</option>
|
||||
</Select>
|
||||
<Select
|
||||
value={watch('timeFormat')}
|
||||
onValueChange={(value) => setValue('timeFormat', value as '12' | '24', { shouldDirty: true })}
|
||||
defaultValue='24'
|
||||
options={[
|
||||
{ value: '12', label: '12 hours 11:00:10 PM' },
|
||||
{ value: '24', label: '24 hours 23:00:10' },
|
||||
]}
|
||||
/>
|
||||
</Panel.ListItem>
|
||||
<Panel.ListItem>
|
||||
<Panel.Field
|
||||
@@ -144,19 +151,20 @@ export default function GeneralSettings() {
|
||||
description='Language to be displayed in views'
|
||||
error={errors.language?.message}
|
||||
/>
|
||||
<Select variant='ontime' size='sm' width='auto' isDisabled={disableInputs} {...register('language')}>
|
||||
<option value='en'>English</option>
|
||||
<option value='fr'>French</option>
|
||||
<option value='de'>German</option>
|
||||
<option value='hu'>Hungarian</option>
|
||||
<option value='it'>Italian</option>
|
||||
<option value='no'>Norwegian</option>
|
||||
<option value='pt'>Portuguese</option>
|
||||
<option value='es'>Spanish</option>
|
||||
<option value='sv'>Swedish</option>
|
||||
<option value='pl'>Polish</option>
|
||||
<option value='zh'>Chinese (Simplified)</option>
|
||||
</Select>
|
||||
<Select
|
||||
value={watch('language')}
|
||||
onValueChange={(value) => setValue('language', value, { shouldDirty: true })}
|
||||
disabled={disableInputs}
|
||||
defaultValue='en'
|
||||
options={[
|
||||
{ value: 'en', label: 'English' },
|
||||
{ value: 'fr', label: 'French' },
|
||||
{ value: 'de', label: 'German' },
|
||||
{ value: 'it', label: 'Italian' },
|
||||
{ value: 'pt', label: 'Portuguese' },
|
||||
{ value: 'es', label: 'Spanish' },
|
||||
]}
|
||||
/>
|
||||
</Panel.ListItem>
|
||||
</Panel.ListGroup>
|
||||
</Panel.Section>
|
||||
|
||||
@@ -96,14 +96,9 @@ export default function QuickStart({ isOpen, onClose }: QuickStartProps) {
|
||||
{ value: 'en', label: 'English' },
|
||||
{ value: 'fr', label: 'French' },
|
||||
{ value: 'de', label: 'German' },
|
||||
{ value: 'hu', label: 'Hungarian' },
|
||||
{ value: 'it', label: 'Italian' },
|
||||
{ value: 'no', label: 'Norwegian' },
|
||||
{ value: 'pt', label: 'Portuguese' },
|
||||
{ value: 'es', label: 'Spanish' },
|
||||
{ value: 'sv', label: 'Swedish' },
|
||||
{ value: 'pl', label: 'Polish' },
|
||||
{ value: 'zh', label: 'Chinese (Simplified)' },
|
||||
]}
|
||||
/>
|
||||
</Panel.ListItem>
|
||||
|
||||
@@ -6,26 +6,16 @@ import { langDe } from './languages/de';
|
||||
import { langEn } from './languages/en';
|
||||
import { langEs } from './languages/es';
|
||||
import { langFr } from './languages/fr';
|
||||
import { langHu } from './languages/hu';
|
||||
import { langIt } from './languages/it';
|
||||
import { langNo } from './languages/no';
|
||||
import { langPl } from './languages/pl';
|
||||
import { langPt } from './languages/pt';
|
||||
import { langSv } from './languages/sv';
|
||||
import { langZhCn } from './languages/zh';
|
||||
|
||||
const translationsList = {
|
||||
en: langEn,
|
||||
es: langEs,
|
||||
fr: langFr,
|
||||
hu: langHu,
|
||||
it: langIt,
|
||||
de: langDe,
|
||||
no: langNo,
|
||||
pt: langPt,
|
||||
sv: langSv,
|
||||
pl: langPl,
|
||||
zh: langZhCn,
|
||||
};
|
||||
|
||||
export type TranslationKey = keyof typeof langEn;
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import { TranslationObject } from './en';
|
||||
|
||||
export const langHu: TranslationObject = {
|
||||
'common.expected_finish': 'Várható befejezés',
|
||||
'common.minutes': 'perc',
|
||||
'common.now': 'Most',
|
||||
'common.next': 'Következő',
|
||||
'common.scheduled_start': 'Ütemezett kezdés',
|
||||
'common.scheduled_end': 'Ütemezett befejezés',
|
||||
'common.projected_start': 'Várható kezdés',
|
||||
'common.projected_end': 'Várható befejezés',
|
||||
'common.stage_timer': 'Színpadi időzítő',
|
||||
'common.started_at': 'Kezdődött',
|
||||
'common.time_now': 'Jelenlegi idő',
|
||||
'common.no_data': 'Nincsenek adatok',
|
||||
'countdown.ended': 'Esemény véget ért',
|
||||
'countdown.running': 'Esemény folyamatban',
|
||||
'countdown.select_event': 'Válassza ki a követendő eseményt',
|
||||
'countdown.to_start': 'Idő kezdésig',
|
||||
'countdown.waiting': 'Várakozás az esemény kezdetére',
|
||||
'countdown.overtime': 'csúszik',
|
||||
'timeline.live': 'élő',
|
||||
'timeline.done': 'kész',
|
||||
'timeline.due': 'esedékes',
|
||||
'timeline.followedby': 'Követi',
|
||||
'project.title': 'Cím',
|
||||
'project.description': 'Leírás',
|
||||
'project.backstage_info': 'Kulisszák mögötti információ',
|
||||
'project.backstage_url': 'Kulisszák mögötti URL',
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
import { TranslationObject } from './en';
|
||||
|
||||
export const langNo: TranslationObject = {
|
||||
'common.expected_finish': 'Forventet slutt',
|
||||
'common.minutes': 'min',
|
||||
'common.now': 'Nå',
|
||||
'common.next': 'Neste',
|
||||
'common.scheduled_start': 'Planlagt start',
|
||||
'common.scheduled_end': 'Planlagt slutt',
|
||||
'common.projected_start': 'Forventet start',
|
||||
'common.projected_end': 'Forventet slutt',
|
||||
'common.stage_timer': 'Scenetimer',
|
||||
'common.started_at': 'Startet',
|
||||
'common.time_now': 'Klokken nå',
|
||||
'common.no_data': 'Ingen data tilgjengelig',
|
||||
'countdown.ended': 'Hendelse avsluttet',
|
||||
'countdown.running': 'Hendelse pågår',
|
||||
'countdown.select_event': 'Velg en hendelse å følge',
|
||||
'countdown.to_start': 'Tid til start',
|
||||
'countdown.waiting': 'Venter på start',
|
||||
'countdown.overtime': 'i overtiden',
|
||||
'timeline.live': 'live',
|
||||
'timeline.done': 'Ferdig',
|
||||
'timeline.due': 'Venter',
|
||||
'timeline.followedby': 'Etterfulgt av',
|
||||
'project.title': 'Tittel',
|
||||
'project.description': 'Beskrivelse',
|
||||
'project.backstage_info': 'Backstage-informasjon',
|
||||
'project.backstage_url': 'Backstage-URL',
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
import { TranslationObject } from './en';
|
||||
|
||||
export const langPl: TranslationObject = {
|
||||
'common.expected_finish': 'Zakładany czas zakończenia',
|
||||
'common.minutes': 'min',
|
||||
'common.now': 'Teraz',
|
||||
'common.next': 'Następnie',
|
||||
'common.scheduled_start': 'Planowany początek',
|
||||
'common.scheduled_end': 'Planowany koniec',
|
||||
'common.projected_start': 'Przewidywany początek',
|
||||
'common.projected_end': 'Przewidywany koniec',
|
||||
'common.stage_timer': 'Timer Scena',
|
||||
'common.started_at': 'Rozpoczęte o',
|
||||
'common.time_now': 'Aktualny czas',
|
||||
'common.no_data': 'Brak danych',
|
||||
'countdown.ended': 'Zakończone o',
|
||||
'countdown.running': 'Trwa',
|
||||
'countdown.select_event': 'Wybierz event który chcesz śledzić',
|
||||
'countdown.to_start': 'Do rozpoczęcia',
|
||||
'countdown.waiting': 'Oczekiwanie na start',
|
||||
'countdown.overtime': 'ponad czasem',
|
||||
'timeline.live': 'live',
|
||||
'timeline.done': 'Zakończony',
|
||||
'timeline.due': 'termin',
|
||||
'timeline.followedby': 'Następnie',
|
||||
'project.title': 'Tytuł',
|
||||
'project.description': 'Opis',
|
||||
'project.backstage_info': 'Informacje zaplecza',
|
||||
'project.backstage_url': 'URL zaplecza',
|
||||
};
|
||||
@@ -25,6 +25,6 @@ export const langPt: TranslationObject = {
|
||||
'timeline.followedby': 'Seguido por',
|
||||
'project.title': 'Título',
|
||||
'project.description': 'Descrição',
|
||||
'project.backstage_info': 'Informações de bastidores',
|
||||
'project.backstage_url': 'URL de bastidores',
|
||||
'project.info': 'Informações do projeto',
|
||||
'project.url': 'URL do projeto',
|
||||
};
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
import { TranslationObject } from './en';
|
||||
|
||||
export const langSv: TranslationObject = {
|
||||
'common.expected_finish': 'Förväntat slut',
|
||||
'common.minutes': 'min',
|
||||
'common.now': 'Nu',
|
||||
'common.next': 'Nästa',
|
||||
'common.scheduled_start': 'Planerad start',
|
||||
'common.scheduled_end': 'Planerad slut',
|
||||
'common.projected_start': 'Beräknad start',
|
||||
'common.projected_end': 'Beräknad slut',
|
||||
'common.stage_timer': 'Timer för scenen',
|
||||
'common.started_at': 'Började vid',
|
||||
'common.time_now': 'Klockan nu',
|
||||
'common.no_data': 'Inga tillgängliga data',
|
||||
'countdown.ended': 'Evenemanget avslutades vid',
|
||||
'countdown.running': 'Evenemang pågår',
|
||||
'countdown.select_event': 'Välj ett evenemang att följa',
|
||||
'countdown.to_start': 'Tid till start',
|
||||
'countdown.waiting': 'Väntar på att evenemanget ska starta',
|
||||
'countdown.overtime': 'i övertid',
|
||||
'timeline.live': 'live',
|
||||
'timeline.done': 'Avslutad',
|
||||
'timeline.due': 'Väntande',
|
||||
'timeline.followedby': 'Följt av',
|
||||
'project.title': 'Titel',
|
||||
'project.description': 'Beskrivning',
|
||||
'project.backstage_info': 'Backstageinformation',
|
||||
'project.backstage_url': 'Backstage-URL',
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
import { TranslationObject } from './en';
|
||||
|
||||
export const langZhCn: TranslationObject = {
|
||||
'common.expected_finish': '预计完成',
|
||||
'common.minutes': '分钟',
|
||||
'common.now': '现在',
|
||||
'common.next': '接下来',
|
||||
'common.scheduled_start': '计划开始',
|
||||
'common.scheduled_end': '计划结束',
|
||||
'common.projected_start': '预计开始',
|
||||
'common.projected_end': '预计结束',
|
||||
'common.stage_timer': '舞台计时器',
|
||||
'common.started_at': '开始于',
|
||||
'common.time_now': '当前时间',
|
||||
'common.no_data': '无数据',
|
||||
'countdown.ended': '事件结束于',
|
||||
'countdown.running': '事件进行中',
|
||||
'countdown.select_event': '选择要关注的事件',
|
||||
'countdown.to_start': '到开始时间',
|
||||
'countdown.waiting': '等待事件开始',
|
||||
'countdown.overtime': '超时了',
|
||||
'timeline.live': '当前进行',
|
||||
'timeline.done': '已结束',
|
||||
'timeline.due': '即将开始',
|
||||
'timeline.followedby': '随后是',
|
||||
'project.title': '标题',
|
||||
'project.description': '描述',
|
||||
'project.backstage_info': '后台信息',
|
||||
'project.backstage_url': '后台网址',
|
||||
};
|
||||
Reference in New Issue
Block a user