Skip to content

Commit

Permalink
feat: add hebrew locale support (#60)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people authored Jun 30, 2024
1 parent 833013a commit 14b9fbd
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 13 deletions.
106 changes: 106 additions & 0 deletions core/src/locale/he.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import type { Localization } from './types'

const locale: Localization = {
'*': {
prefix: 'בכל',
suffix: '',
text: 'לא ידוע',
'*': {
value: { text: '{{value.text}}' },
range: { text: '{{start.text}}-{{end.text}}' },
everyX: { text: 'כל {{every.value}}' },
},
month: {
'*': { prefix: 'ב' },
empty: { text: 'כל חודש' },
value: { text: '{{value.alt}}' },
range: { text: '{{start.alt}}-{{end.alt}}' },
},
day: {
'*': { prefix: 'ב' },
empty: { text: 'כל יום' },
value: { text: 'יום {{value.alt}} לחודש' },
noSpecific: {
text: 'ללא יום מוגדר',
},
},
dayOfWeek: {
'*': { prefix: 'ב' },
empty: { text: 'כל יום מימות השבוע' },
value: { text: 'ימי {{value.alt}}' },
range: { text: '{{start.alt}}-{{end.alt}}' },
noSpecific: {
text: 'ללא יום בשבוע מוגדר',
},
},
hour: {
'*': { prefix: 'ב' },
empty: { text: 'כל שעה' },
value: { text: 'שעה {{value.text}}' },
},
minute: {
'*': { prefix: ':' },
empty: { text: 'כל דקה' },
},
second: {
'*': { prefix: ':' },
empty: { text: 'כל שניה' },
},
},
minute: {
text: 'דקה',
},
hour: {
text: 'שעה',
minute: {
'*': {
prefix: 'ב',
suffix: 'דקות',
},
empty: { text: 'כל' },
},
},
day: {
text: 'יום',
},
week: {
text: 'שבוע',
},
month: {
text: 'חודש',
dayOfWeek: {
'*': { prefix: 'ו' },
},
},
year: {
text: 'שנה',
dayOfWeek: {
'*': { prefix: 'ו' },
},
},

//quartz format
'q-second': {
text: 'שניה',
},
'q-minute': {
text: 'דקה',
second: {
'*': {
prefix: 'ב',
suffix: 'שניות',
},
empty: { text: 'כל' },
},
},
'q-hour': {
text: 'שעה',
minute: {
'*': {
prefix: 'ב',
},
},
},
}

export default locale
2 changes: 2 additions & 0 deletions core/src/locale/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import de from './de'
import en from './en'
import es from './es'
import fr from './fr'
import he from './he'
import hi from './hi'
import ja from './ja'
import ko from './ko'
Expand All @@ -23,6 +24,7 @@ const locales: Record<string, Localization> = {
da,
zh: cn,
'zh-cn': cn,
he,
ru,
fr,
hi,
Expand Down
22 changes: 11 additions & 11 deletions demo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions demo/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<n-config-provider :theme="theme">
<main class="cron-demo">
<main class="cron-demo" :dir="dir">
<cron-editor v-bind="props" v-model="value"></cron-editor>
<p>cron expression: {{ value }}</p>
</main>
Expand All @@ -22,13 +22,14 @@ export default defineComponent({
const props = Object.fromEntries(params.entries())
const value = ref(params.get('initial-value') ?? '* * * * *')
const theme = prefersDark() ? darkTheme : lightTheme
const dir = ['he'].includes(params.get('locale') ?? '') ? 'rtl' : 'ltr'
return {
props: props,
value: ref(value),
theme,
dir,
}
},
})
Expand Down
4 changes: 4 additions & 0 deletions docs/src/.vuepress/components/cron-demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export default {
name: 'Chinese',
value: 'zh-cn',
},
{
name: 'Hebrew',
value: 'he',
},
{
name: 'Russian (GPT-4)',
value: 'ru',
Expand Down

0 comments on commit 14b9fbd

Please sign in to comment.