Skip to content

Commit 14b9fbd

Browse files
a5r0nabichinger
andauthored
feat: add hebrew locale support (#60)
* add hebrew locale support * apply review changes * apply more changes * fix: run lint-fix * docs(demo): add dir attribute --------- Co-authored-by: a5r0n <a5r0n@users.noreply.github.com> Co-authored-by: Andreas Bichinger <andreas.bichinger@gmail.com>
1 parent 833013a commit 14b9fbd

File tree

5 files changed

+126
-13
lines changed

5 files changed

+126
-13
lines changed

core/src/locale/he.ts

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import type { Localization } from './types'
2+
3+
const locale: Localization = {
4+
'*': {
5+
prefix: 'בכל',
6+
suffix: '',
7+
text: 'לא ידוע',
8+
'*': {
9+
value: { text: '{{value.text}}' },
10+
range: { text: '{{start.text}}-{{end.text}}' },
11+
everyX: { text: 'כל {{every.value}}' },
12+
},
13+
month: {
14+
'*': { prefix: 'ב' },
15+
empty: { text: 'כל חודש' },
16+
value: { text: '{{value.alt}}' },
17+
range: { text: '{{start.alt}}-{{end.alt}}' },
18+
},
19+
day: {
20+
'*': { prefix: 'ב' },
21+
empty: { text: 'כל יום' },
22+
value: { text: 'יום {{value.alt}} לחודש' },
23+
noSpecific: {
24+
text: 'ללא יום מוגדר',
25+
},
26+
},
27+
dayOfWeek: {
28+
'*': { prefix: 'ב' },
29+
empty: { text: 'כל יום מימות השבוע' },
30+
value: { text: 'ימי {{value.alt}}' },
31+
range: { text: '{{start.alt}}-{{end.alt}}' },
32+
noSpecific: {
33+
text: 'ללא יום בשבוע מוגדר',
34+
},
35+
},
36+
hour: {
37+
'*': { prefix: 'ב' },
38+
empty: { text: 'כל שעה' },
39+
value: { text: 'שעה {{value.text}}' },
40+
},
41+
minute: {
42+
'*': { prefix: ':' },
43+
empty: { text: 'כל דקה' },
44+
},
45+
second: {
46+
'*': { prefix: ':' },
47+
empty: { text: 'כל שניה' },
48+
},
49+
},
50+
minute: {
51+
text: 'דקה',
52+
},
53+
hour: {
54+
text: 'שעה',
55+
minute: {
56+
'*': {
57+
prefix: 'ב',
58+
suffix: 'דקות',
59+
},
60+
empty: { text: 'כל' },
61+
},
62+
},
63+
day: {
64+
text: 'יום',
65+
},
66+
week: {
67+
text: 'שבוע',
68+
},
69+
month: {
70+
text: 'חודש',
71+
dayOfWeek: {
72+
'*': { prefix: 'ו' },
73+
},
74+
},
75+
year: {
76+
text: 'שנה',
77+
dayOfWeek: {
78+
'*': { prefix: 'ו' },
79+
},
80+
},
81+
82+
//quartz format
83+
'q-second': {
84+
text: 'שניה',
85+
},
86+
'q-minute': {
87+
text: 'דקה',
88+
second: {
89+
'*': {
90+
prefix: 'ב',
91+
suffix: 'שניות',
92+
},
93+
empty: { text: 'כל' },
94+
},
95+
},
96+
'q-hour': {
97+
text: 'שעה',
98+
minute: {
99+
'*': {
100+
prefix: 'ב',
101+
},
102+
},
103+
},
104+
}
105+
106+
export default locale

core/src/locale/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import de from './de'
77
import en from './en'
88
import es from './es'
99
import fr from './fr'
10+
import he from './he'
1011
import hi from './hi'
1112
import ja from './ja'
1213
import ko from './ko'
@@ -23,6 +24,7 @@ const locales: Record<string, Localization> = {
2324
da,
2425
zh: cn,
2526
'zh-cn': cn,
27+
he,
2628
ru,
2729
fr,
2830
hi,

demo/package-lock.json

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/src/App.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<n-config-provider :theme="theme">
3-
<main class="cron-demo">
3+
<main class="cron-demo" :dir="dir">
44
<cron-editor v-bind="props" v-model="value"></cron-editor>
55
<p>cron expression: {{ value }}</p>
66
</main>
@@ -22,13 +22,14 @@ export default defineComponent({
2222
const props = Object.fromEntries(params.entries())
2323
2424
const value = ref(params.get('initial-value') ?? '* * * * *')
25-
2625
const theme = prefersDark() ? darkTheme : lightTheme
26+
const dir = ['he'].includes(params.get('locale') ?? '') ? 'rtl' : 'ltr'
2727
2828
return {
2929
props: props,
3030
value: ref(value),
3131
theme,
32+
dir,
3233
}
3334
},
3435
})

docs/src/.vuepress/components/cron-demo.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ export default {
9090
name: 'Chinese',
9191
value: 'zh-cn',
9292
},
93+
{
94+
name: 'Hebrew',
95+
value: 'he',
96+
},
9397
{
9498
name: 'Russian (GPT-4)',
9599
value: 'ru',

0 commit comments

Comments
 (0)