Skip to content

Commit 7b33b18

Browse files
committed
feat: add Russian, French, Hindi and Japanese
1 parent da788a9 commit 7b33b18

File tree

5 files changed

+449
-0
lines changed

5 files changed

+449
-0
lines changed

core/src/locale/fr.ts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import type { Localization } from './types'
2+
3+
/**
4+
* French localization generated with GPT-4
5+
*/
6+
const locale: Localization = {
7+
'*': {
8+
prefix: 'Toutes',
9+
suffix: '',
10+
text: 'Inconnu',
11+
'*': {
12+
value: { text: '{{value.text}}' },
13+
range: { text: '{{start.text}}-{{end.text}}' },
14+
everyX: { text: 'tous les {{every.value}}' },
15+
},
16+
month: {
17+
'*': { prefix: 'en' },
18+
empty: { prefix: 'en', text: 'tous les mois' },
19+
value: { text: '{{value.alt}}' },
20+
range: { text: '{{start.alt}}-{{end.alt}}' },
21+
},
22+
day: {
23+
'*': { prefix: 'le' },
24+
empty: { prefix: 'à', text: 'tous les jours' },
25+
everyX: { prefix: '', text: 'tous les {{every.value}} jours' },
26+
noSpecific: { prefix: 'à', text: 'aucun jour particulier' },
27+
},
28+
dayOfWeek: {
29+
'*': { prefix: 'le' },
30+
empty: { prefix: 'à', text: 'tous les jours de la semaine' },
31+
value: { text: '{{value.alt}}' },
32+
range: { text: '{{start.alt}}-{{end.alt}}' },
33+
noSpecific: { prefix: 'et', text: 'aucun jour de la semaine particulier' },
34+
},
35+
hour: {
36+
'*': { prefix: 'à' },
37+
empty: { prefix: 'à', text: 'toutes les heures' },
38+
everyX: { prefix: '', text: 'toutes les {{every.value}} heures' },
39+
},
40+
minute: {
41+
'*': { prefix: ':' },
42+
empty: { text: 'toutes les minutes' },
43+
everyX: { prefix: '', text: 'toutes les {{every.value}} minutes' },
44+
},
45+
second: {
46+
'*': { prefix: ':' },
47+
empty: { text: 'toutes les secondes' },
48+
everyX: { prefix: '', text: 'toutes les {{every.value}} secondes' },
49+
},
50+
},
51+
minute: { text: 'Minute' },
52+
hour: {
53+
text: 'Heure',
54+
minute: { '*': { prefix: 'à', suffix: 'minute(s)' }, empty: { text: 'toutes' } },
55+
},
56+
day: { prefix: 'Tous', text: 'Jour' },
57+
week: { text: 'Semaine' },
58+
month: { prefix: 'Tous', text: 'Mois' },
59+
year: { prefix: 'Tous', text: 'Année' },
60+
61+
//quartz format
62+
'q-second': { text: 'Seconde' },
63+
'q-minute': { text: 'Minute', second: { '*': { prefix: 'et' } } },
64+
'q-hour': { text: 'Heure', minute: { '*': { prefix: 'et' } }, second: { '*': { prefix: 'et' } } },
65+
}
66+
67+
export default locale

core/src/locale/hi.ts

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import type { Localization } from './types'
2+
3+
/**
4+
* Hindi localization generated with GPT-4
5+
*/
6+
const locale: Localization = {
7+
'*': {
8+
prefix: 'हर',
9+
suffix: '',
10+
text: 'अज्ञात',
11+
'*': {
12+
value: { text: '{{value.text}}' },
13+
range: { text: '{{start.text}}-{{end.text}}' },
14+
everyX: { text: '{{every.value}} हर' },
15+
},
16+
month: {
17+
'*': { prefix: 'में' },
18+
empty: { prefix: 'के', text: 'हर महीने' },
19+
value: { text: '{{value.alt}}' },
20+
range: { text: '{{start.alt}}-{{end.alt}}' },
21+
},
22+
day: {
23+
'*': { prefix: 'के' },
24+
empty: { prefix: 'पर', text: 'हर दिन' },
25+
everyX: { prefix: '', text: '{{every.value}} दिन हर' },
26+
noSpecific: { prefix: 'पर', text: 'कोई विशेष दिन नहीं' },
27+
},
28+
dayOfWeek: {
29+
'*': { prefix: 'पर' },
30+
empty: { prefix: 'पर', text: 'हर सप्ताह' },
31+
value: { text: '{{value.alt}}' },
32+
range: { text: '{{start.alt}}-{{end.alt}}' },
33+
noSpecific: { prefix: 'और', text: 'कोई विशेष सप्ताह नहीं' },
34+
},
35+
hour: {
36+
'*': { prefix: 'को' },
37+
empty: { prefix: 'पर', text: 'हर घंटे' },
38+
everyX: { prefix: '', text: '{{every.value}} घंटे हर' },
39+
},
40+
minute: {
41+
'*': { prefix: ':' },
42+
empty: { text: 'हर मिनट' },
43+
everyX: { prefix: '', text: '{{every.value}} मिनट हर' },
44+
},
45+
second: {
46+
'*': { prefix: ':' },
47+
empty: { text: 'हर सेकंड' },
48+
everyX: { prefix: '', text: '{{every.value}} सेकंड हर' },
49+
},
50+
},
51+
minute: { text: 'मिनट' },
52+
hour: { text: 'घंटा', minute: { '*': { prefix: 'पर', suffix: 'मिनट' }, empty: { text: 'हर' } } },
53+
day: { prefix: 'हर', text: 'दिन' },
54+
week: { text: 'सप्ताह' },
55+
month: { prefix: 'हर', text: 'महीना' },
56+
year: { prefix: 'हर', text: 'साल' },
57+
58+
//quartz format
59+
'q-second': { text: 'सेकंड' },
60+
'q-minute': { text: 'मिनट', second: { '*': { prefix: 'और' } } },
61+
'q-hour': { text: 'घंटा', minute: { '*': { prefix: 'और' } }, second: { '*': { prefix: 'और' } } },
62+
}
63+
64+
export default locale

core/src/locale/index.ts

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import da from './da'
66
import de from './de'
77
import en from './en'
88
import es from './es'
9+
import fr from './fr'
10+
import hi from './hi'
11+
import ja from './ja'
912
import pt from './pt'
13+
import ru from './ru'
1014
import type { Localization } from './types'
1115

1216
const locales: Record<string, Localization> = {
@@ -18,6 +22,10 @@ const locales: Record<string, Localization> = {
1822
da,
1923
zh: cn,
2024
'zh-cn': cn,
25+
ru,
26+
fr,
27+
hi,
28+
ja,
2129
}
2230

2331
class Locale {
@@ -58,3 +66,182 @@ function getLocale(localeCode: string, mixin?: Localization) {
5866
}
5967

6068
export { Locale, getLocale }
69+
70+
// The following prompt was used for localizations translated with GPT-4:
71+
//
72+
// You are a service that translates user requests into JSON objects of type "Localizations" according to the following TypeScript definitions:
73+
// ```typescript
74+
// export type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>
75+
76+
// export type PositionedLocalization = PartialRecord<TextPosition, string>
77+
// export type CronLocalization = PartialRecord<CronType | '*', PositionedLocalization>
78+
79+
// export interface FieldLocalization {
80+
// // Allow custom field ids
81+
// [fieldId: string]: unknown
82+
83+
// /** `*` is used as a wildcard and matches any field id */
84+
// '*'?: CronLocalization
85+
// second?: CronLocalization
86+
// minute?: CronLocalization
87+
// hour?: CronLocalization
88+
// day?: CronLocalization
89+
// month?: CronLocalization
90+
// dayOfWeek?: CronLocalization
91+
// }
92+
93+
// export type PeriodLocalization = PositionedLocalization | FieldLocalization
94+
95+
// /**
96+
// * Interface to define localizations for vue-js-cron
97+
// * The localization strings are accessed by {periodId}.{fieldId}.{cronType}.{position}
98+
// */
99+
// export interface Localization {
100+
// /** Allows custom period ids */
101+
// [periodId: string]: unknown
102+
103+
// /** `*` is used as a wildcard and matches any period id */
104+
// '*'?: PeriodLocalization
105+
// minute?: PeriodLocalization
106+
// hour?: PeriodLocalization
107+
// day?: PeriodLocalization
108+
// week?: PeriodLocalization
109+
// month?: PeriodLocalization
110+
// year?: PeriodLocalization
111+
// }
112+
// ```
113+
// The following is a user request:
114+
// """
115+
// Translate the following Javascript object from German into Russian:
116+
// {
117+
// '*': {
118+
// prefix: 'Jede',
119+
// suffix: '',
120+
// text: 'Unknown',
121+
// '*': {
122+
// value: { text: '{{value.text}}' },
123+
// range: { text: '{{start.text}}-{{end.text}}' },
124+
// everyX: { text: 'alle {{every.value}}' },
125+
// },
126+
// month: {
127+
// '*': { prefix: 'im' },
128+
// empty: {
129+
// prefix: 'in',
130+
// text: 'jedem Monat',
131+
// },
132+
// value: { text: '{{value.alt}}' },
133+
// range: { text: '{{start.alt}}-{{end.alt}}' },
134+
// },
135+
// day: {
136+
// '*': { prefix: 'den' },
137+
// empty: {
138+
// prefix: 'an',
139+
// text: 'jedem Tag',
140+
// },
141+
// everyX: {
142+
// prefix: '',
143+
// text: 'alle {{every.value}} Tage',
144+
// },
145+
// noSpecific: {
146+
// prefix: 'an',
147+
// text: 'keinem bestimmten Tag',
148+
// },
149+
// },
150+
// dayOfWeek: {
151+
// '*': { prefix: 'am' },
152+
// empty: {
153+
// prefix: 'an',
154+
// text: 'jedem Wochentag',
155+
// },
156+
// value: { text: '{{value.alt}}' },
157+
// range: { text: '{{start.alt}}-{{end.alt}}' },
158+
// noSpecific: {
159+
// prefix: 'und',
160+
// text: 'keinem bestimmten Wochentag',
161+
// },
162+
// },
163+
// hour: {
164+
// '*': { prefix: 'um' },
165+
// empty: {
166+
// prefix: 'zu',
167+
// text: 'jeder Stunde',
168+
// },
169+
// everyX: {
170+
// prefix: '',
171+
// text: 'alle {{every.value}} Stunden',
172+
// },
173+
// },
174+
// minute: {
175+
// '*': { prefix: ':' },
176+
// empty: { text: 'jede Minute' },
177+
// everyX: {
178+
// prefix: '',
179+
// text: 'alle {{every.value}} Minuten',
180+
// },
181+
// },
182+
// second: {
183+
// '*': { prefix: ':' },
184+
// empty: { text: 'jede Sekunde' },
185+
// everyX: {
186+
// prefix: '',
187+
// text: 'alle {{every.value}} Sekunden',
188+
// },
189+
// },
190+
// },
191+
// minute: {
192+
// text: 'Minute',
193+
// },
194+
// hour: {
195+
// text: 'Stunde',
196+
// minute: {
197+
// '*': {
198+
// prefix: 'zu',
199+
// suffix: 'Minute(n)',
200+
// },
201+
// empty: { text: 'jeder' },
202+
// },
203+
// },
204+
// day: {
205+
// prefix: 'Jeden',
206+
// text: 'Tag',
207+
// },
208+
// week: {
209+
// text: 'Woche',
210+
// },
211+
// month: {
212+
// prefix: 'Jedes',
213+
// text: 'Monat',
214+
// },
215+
// year: {
216+
// prefix: 'Jedes',
217+
// text: 'Jahr',
218+
// },
219+
220+
// //quartz format
221+
// 'q-second': {
222+
// text: 'Sekunde',
223+
// },
224+
// 'q-minute': {
225+
// text: 'Minute',
226+
// second: {
227+
// '*': {
228+
// prefix: 'und',
229+
// },
230+
// },
231+
// },
232+
// 'q-hour': {
233+
// text: 'Stunde',
234+
// minute: {
235+
// '*': {
236+
// prefix: 'und',
237+
// },
238+
// },
239+
// second: {
240+
// '*': {
241+
// prefix: 'und',
242+
// },
243+
// },
244+
// },
245+
// }
246+
// """
247+
// The following is the user request translated into a JSON object with 2 spaces of indentation and no properties with the value undefined:

0 commit comments

Comments
 (0)