Skip to content

Commit

Permalink
- Support Arabic, FrCanadian/Belgian in User Interface (#3271)
Browse files Browse the repository at this point in the history
  • Loading branch information
Natixe authored Dec 10, 2024
1 parent 483a289 commit a4a1a7d
Show file tree
Hide file tree
Showing 16 changed files with 1,716 additions and 20 deletions.
2 changes: 1 addition & 1 deletion packages/neuron-ui/.storybook/electron.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const sendSyncValues = {
'get-locale': ('zh', 'fr', 'es'),
'get-locale': ('zh', 'fr', 'es', 'ar'),
'get-version': '0.103.1',
}

Expand Down
14 changes: 13 additions & 1 deletion packages/neuron-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,17 @@
},
"resolutions": {
"react-i18next": "14.0.0"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
}
1,330 changes: 1,330 additions & 0 deletions packages/neuron-ui/src/locales/ar.json

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions packages/neuron-ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,13 @@
},
"locale": {
"en": "English",
"en-US": "English(United States)",
"zh": "中文(简体)",
"zh-TW": "中文(繁體)",
"en-US": "English (United States)",
"zh": "中文 (简体)",
"zh-TW": "中文 (繁體)",
"ar": "العربية",
"fr": "Français",
"fr-CA": "Français (Canada)",
"fr-BE": "Français (Belgique)",
"es": "Español"
},
"data": {
Expand Down
9 changes: 6 additions & 3 deletions packages/neuron-ui/src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,13 @@
},
"locale": {
"en": "English",
"en-US": "English(United States)",
"zh": "中文(简体)",
"zh-TW": "中文(繁體)",
"en-US": "English (United States)",
"zh": "中文 (简体)",
"zh-TW": "中文 (繁體)",
"ar": "العربية",
"fr": "Français",
"fr-CA": "Français (Canada)",
"fr-BE": "Français (Belgique)",
"es": "Español"
},
"data": {
Expand Down
9 changes: 6 additions & 3 deletions packages/neuron-ui/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,13 @@
},
"locale": {
"en": "English",
"en-US": "English(United States)",
"zh": "中文(简体)",
"zh-TW": "中文(繁體)",
"en-US": "English (United States)",
"zh": "中文 (简体)",
"zh-TW": "中文 (繁體)",
"ar": "العربية",
"fr": "Français",
"fr-CA": "Français (Canada)",
"fr-BE": "Français (Belgique)",
"es": "Español"
},
"data": {
Expand Down
9 changes: 6 additions & 3 deletions packages/neuron-ui/src/locales/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -464,10 +464,13 @@
},
"locale": {
"en": "English",
"en-US": "English(United States)",
"zh": "中文(简体)",
"zh-TW": "中文(繁體)",
"en-US": "English (United States)",
"zh": "中文 (简体)",
"zh-TW": "中文 (繁體)",
"ar": "العربية",
"fr": "Français",
"fr-CA": "Français (Canada)",
"fr-BE": "Français (Belgique)",
"es": "Español"
},
"data": {
Expand Down
9 changes: 6 additions & 3 deletions packages/neuron-ui/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,13 @@
},
"locale": {
"en": "English",
"en-US": "English(United States)",
"zh": "中文(简体)",
"zh-TW": "中文(繁體)",
"en-US": "English (United States)",
"zh": "中文 (简体)",
"zh-TW": "中文 (繁體)",
"ar": "العربية",
"fr": "Français",
"fr-CA": "Français (Canada)",
"fr-BE": "Français (Belgique)",
"es": "Español"
},
"data": {
Expand Down
28 changes: 28 additions & 0 deletions packages/neuron-ui/src/tests/calendar/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ describe('Get Local Month Short Names', () => {
expect(getLocalMonthShortNames('fr')).toEqual(names)
})

it('Arabic', () => {
const names = ['ينا.', 'فبر.', 'مارس.', 'أبر.', 'مايو.', 'يون.', 'يول.', 'أغس.', 'سبت.', 'أكت.', 'نوف.', 'ديس.']
expect(getLocalMonthShortNames('ar')).toEqual(names)
})

it('Spanish', () => {
const names = ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sept', 'oct', 'nov', 'dic']
expect(getLocalMonthShortNames('es')).toEqual(names)
Expand Down Expand Up @@ -157,6 +162,24 @@ describe('Get Local Month Names', () => {
expect(getLocalMonthNames('fr')).toEqual(names)
})

it('Arabic', () => {
const names = [
'يناير',
'فبراير',
'مارس',
'أبريل',
'مايو',
'يونيو',
'يوليو',
'أغسطس',
'سبتمبر',
'أكتوبر',
'نوفمبر',
'ديسمبر',
]
expect(getLocalMonthNames('ar')).toEqual(names)
})

it('Spanish', () => {
const names = [
'enero',
Expand Down Expand Up @@ -197,6 +220,11 @@ describe('Get Local Week Names', () => {
expect(getLocalWeekNames('fr')).toEqual(names)
})

it('Arabic', () => {
const names = ['ح', 'إ', 'ث', 'أ', 'خ', 'ج', 'س']
expect(getLocalWeekNames('ar')).toEqual(names)
})

it('Traditional Chinese', () => {
const names = ['日', '一', '二', '三', '四', '五', '六']
expect(getLocalWeekNames('zh-TW')).toEqual(names)
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/utils/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const DEFAULT_SUDT_FIELDS = {
CKBSymbol: 'CKB',
CKBDecimal: '8',
}
export const LOCALES = ['zh', 'zh-TW', 'en', 'en-US', 'fr', 'es'] as const
export const LOCALES = ['zh', 'zh-TW', 'en', 'en-US', 'ar', 'fr', 'fr-CA', 'fr-BE', 'es'] as const

// address property
export const SHORT_ADDR_LENGTH = 46
Expand Down
4 changes: 4 additions & 0 deletions packages/neuron-ui/src/utils/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ import en from 'locales/en.json'
import zhTW from 'locales/zh-tw.json'
import fr from 'locales/fr.json'
import es from 'locales/es.json'
import ar from 'locales/ar.json'

i18n.use(initReactI18next).init({
resources: {
en,
fr,
ar,
es,
zh,
'zh-TW': zhTW,
'fr-CA': fr,
'fr-BE': fr,
},
lng: getLocale(),
fallbackLng: {
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-wallet/electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ mac:
gatekeeperAssess: false
entitlements: assets/entitlements.plist
entitlementsInherit: assets/entitlements.plist
electronLanguages: ["en", "zh", "zh_CN", "zh_TW"]
electronLanguages: ["en", "zh", "zh_CN", "zh_TW", "ar", "fr"]
target:
- target: default
arch:
Expand Down
Loading

1 comment on commit a4a1a7d

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packaging for test is done in 12250168457

Please sign in to comment.