-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Locale): language file migration (#1756)
Co-authored-by: anlyyao <[email protected]>
- Loading branch information
Showing
11 changed files
with
732 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default { | ||
classPrefix: 't', | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# How to add a language pack | ||
|
||
English | [简体中文](./CONTRIBUTING_zh-CN.md) | ||
|
||
Follow these two steps: | ||
|
||
## Add translation language pack | ||
|
||
### Language pack file naming | ||
|
||
Language packs are uniformly named in English. The naming follows the locale regional setting specification and is divided into two parts: language code and region code. The format is `language__country_region`. For example, `en` represents the language code, `US` represents the area code, and the final complete language package name is `en_US`, which represents "English spoken in the United States". Other common locale examples: | ||
|
||
| Area Description | Corresponding Code | | ||
|---|---| | ||
| English | en | | ||
| English - United States | en-US | | ||
| Simplified Chinese | zh-CN | | ||
| Traditional Chinese in Taiwan | zh-TW | | ||
| Singapore Simplified Chinese | zh-SG | | ||
| General Arabic | ar-001 | | ||
| Kuwaiti Arabic | ar-KW | | ||
|
||
Complete language pack naming reference: https://zh.wikipedia.org/wiki/%E5%8C%BA%E5%9F%9F%E8%AE%BE%E7%BD%AE | ||
|
||
### start translating | ||
|
||
A large number of string variables have been extracted from the component for replacement when the language pack is switched. You can refer to [en_US](./locale/en_US.ts) to translate the corresponding language. If you find an unsupported component string variable, please open a new issue for discussion, and implement the language pack after the component is implemented. | ||
|
||
Added new language pack information description in the document: https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/config-provider/config-provider.md. | ||
|
||
After implementing the language pack, you can initiate a PR in the tdesign-mobile-vue repository. | ||
|
||
## About RTL | ||
|
||
There are many languages that follow the writing direction from right to left, such as Arabic, Hebrew, etc., which are not supported in TDesign at present. RTL adaptation may involve the adjustment of the default UI implementation of components. If you need RTL language support Or have experience in RTL adaptation, welcome to discuss in [GitHub discussion](https://github.com/Tencent/tdesign/discussions/343). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# 如何新增语言包 | ||
|
||
[English](./CONTRIBUTING.md) | 简体中文 | ||
|
||
参照以下两个步骤: | ||
|
||
## 新增翻译语言包 | ||
|
||
### 语言包文件命名 | ||
|
||
语言包统一以英文命名,命名遵循 locale 区域设置规范,分为语言编码和地区编码两部分,格式为 `language_CountryRegion`。比如 `en` 表示语言编码,`US` 表示地区编码,最终完整语言包名为 `en_US` 表示“美国讲的英语”。其他常见 locale 例子: | ||
|
||
| 区域描述 | 对应 Code | | ||
| ---------------- | --------- | | ||
| 英语 | en | | ||
| 英语 - 美国 | en_US | | ||
| 简体中文 | zh_CN | | ||
| 台湾地区繁体中文 | zh_TW | | ||
| 新加坡简体中文 | zh_SG | | ||
| 通用阿拉伯语 | ar_001 | | ||
| 科威特阿拉伯语 | ar_KW | | ||
|
||
完整语言包命名参考:https://zh.wikipedia.org/wiki/%E5%8C%BA%E5%9F%9F%E8%AE%BE%E7%BD%AE | ||
|
||
### 着手翻译 | ||
|
||
组件中已经抽取了大量字符串变量,供语言包切换时替换,你可以参考 [en_US](./locale/en_US.ts) 来进行对应语言的翻译工作。如果你发现有未支持的组件字符串变量,请新开一个 issue 讨论,待组件实现后再实现语言包。 | ||
|
||
文档中补充新增语言包信息描述:https://github.com/Tencent/tdesign-mobile-vue/blob/develop/src/config-provider/config-provider.md。 | ||
|
||
实现语言包后可以在仓库中发起 PR。 | ||
|
||
## 关于 RTL | ||
|
||
有很多语言遵循由右到左的书写方向,如 阿拉伯语、希伯来语等,目前 TDesign 中还未支持,RTL 适配可能涉及对组件默认 UI 实现的调整,如果你对 RTL 语言支持有需求或者对 RTL 适配有经验,欢迎在 [GitHub discussion](https://github.com/Tencent/tdesign/discussions/343) 讨论。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// 文件有效,为国际化做准备 | ||
import 'dayjs/locale/ar'; | ||
|
||
export default { | ||
actionSheet: { | ||
cancel: 'الإلغاء', | ||
}, | ||
calendar: { | ||
confirm: 'أكد', | ||
title: 'انتقِ التاريخ', | ||
weekdays: ['يوم الأحد', 'الاثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت'], | ||
monthTitle: '{شهر واحد} {سنة واحدة}', | ||
months: [ | ||
'يناير', | ||
'فبراير', | ||
'مارس', | ||
'أبريل', | ||
'مايو', | ||
'يونيو', | ||
'يوليو', | ||
'أغسطس', | ||
'سبتمبر', | ||
'أكتوبر', | ||
'نوفمبر', | ||
'ديسمبر', | ||
], | ||
}, | ||
cascader: { | ||
title: 'العنوان', | ||
placeholder: 'اختر الخيارات', | ||
}, | ||
dropdownMenu: { | ||
reset: 'إعادة الضبط', | ||
confirm: 'أكد', | ||
}, | ||
dateTimePicker: { | ||
title: 'انتقِ التاريخ', | ||
cancel: 'الإلغاء', | ||
confirm: 'أكد', | ||
format: 'DD-MM-YYYY', | ||
yearLabel: 'سنة', | ||
monthLabel: 'الشهر', | ||
dateLabel: 'التاريخ', | ||
hourLabel: 'الساعة', | ||
minuteLabel: 'دقيقة', | ||
secondLabel: 'ثانيا', | ||
}, | ||
picker: { | ||
cancel: 'الإلغاء', | ||
confirm: 'أكد', | ||
}, | ||
pullDownRefresh: { | ||
loadingTexts: ['اسحب للتحديث', 'مرتخية للتجديد', 'منعش', 'اكتمل التحديث'], | ||
}, | ||
rate: { | ||
valueText: '{القيمة} نتيجة', | ||
noValueText: 'لا توجد نقاط', | ||
}, | ||
tabBar: { | ||
newsAriaLabel: 'هناك أخبار جديدة', | ||
moreNewsAriaLabel: 'هناك الكثير من الأخبار السيئة', | ||
haveMoreNewsAriaLabel: 'هناك { قيمة }+ أخبار', | ||
haveNewsAriaLabel: 'هناك { قيمة } أخبار', | ||
}, | ||
table: { | ||
empty: 'البيانات الفارغة', | ||
}, | ||
list: { | ||
loading: 'التحميل...', | ||
loadingMoreText: 'انقر لتحميل المزيد', | ||
pulling: 'اسحب للتحديث...', | ||
loosing: 'مرتخية للتجديد...', | ||
success: 'تم التحديث بنجاح', | ||
}, | ||
upload: { | ||
progress: { | ||
uploadingText: 'جارٍ التحميل...', | ||
waitingText: 'الانتظار', | ||
failText: 'فشل', | ||
successText: 'النجاح', | ||
}, | ||
}, | ||
guide: { | ||
next: 'التالي', | ||
skip: 'تخطي', | ||
finish: 'أنهي', | ||
back: 'العودة', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// 文件有效,为国际化做准备 | ||
import 'dayjs/locale/en'; | ||
|
||
export default { | ||
actionSheet: { | ||
cancel: 'Cancel', | ||
}, | ||
calendar: { | ||
confirm: 'Confirm', | ||
title: 'Select Date', | ||
weekdays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], | ||
monthTitle: '{month} {year}', | ||
months: [ | ||
'January', | ||
'February', | ||
'March', | ||
'April', | ||
'May', | ||
'June', | ||
'July', | ||
'August', | ||
'September', | ||
'October', | ||
'November', | ||
'December', | ||
], | ||
}, | ||
cascader: { | ||
title: 'Title', | ||
placeholder: 'Select options', | ||
}, | ||
dropdownMenu: { | ||
reset: 'Reset', | ||
confirm: 'Confirm', | ||
}, | ||
dateTimePicker: { | ||
title: 'Select Date', | ||
cancel: 'Cancel', | ||
confirm: 'Confirm', | ||
format: 'YYYY-MM-DD', | ||
yearLabel: 'Year', | ||
monthLabel: 'Month', | ||
dateLabel: 'Date', | ||
hourLabel: 'Hour', | ||
minuteLabel: 'Minute', | ||
secondLabel: 'Second', | ||
}, | ||
picker: { | ||
cancel: 'Cancel', | ||
confirm: 'Confirm', | ||
}, | ||
pullDownRefresh: { | ||
loadingTexts: ['Pull to refresh', 'Loose to refresh', 'Refreshing ', 'Refresh completed'], | ||
}, | ||
rate: { | ||
valueText: '{value} score', | ||
noValueText: 'No score', | ||
}, | ||
tabBar: { | ||
newsAriaLabel: 'There is new news', | ||
moreNewsAriaLabel: 'There is a lot of news', | ||
haveMoreNewsAriaLabel: 'There are {value}+ news', | ||
haveNewsAriaLabel: 'There are {value} news', | ||
}, | ||
table: { | ||
empty: 'Empty Data', | ||
}, | ||
list: { | ||
loading: 'Loading...', | ||
loadingMoreText: 'Click to load more', | ||
pulling: 'Pull to refresh...', | ||
loosing: 'Loose to refresh...', | ||
success: 'Refresh successful', | ||
}, | ||
upload: { | ||
progress: { | ||
uploadingText: 'Uploading...', | ||
waitingText: 'Waiting', | ||
failText: 'Failed', | ||
successText: 'Success', | ||
}, | ||
}, | ||
guide: { | ||
next: 'Next', | ||
skip: 'Skip', | ||
finish: 'Finish', | ||
back: 'Back', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// 文件有效,为国际化做准备 | ||
import 'dayjs/locale/it'; | ||
|
||
export default { | ||
actionSheet: { | ||
cancel: 'Annulla', | ||
}, | ||
calendar: { | ||
confirm: 'Conferma', | ||
title: 'Seleziona Data', | ||
weekdays: ['Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato'], | ||
monthTitle: '{mese} {anno}', | ||
months: [ | ||
'Gennaio', | ||
'Febbraio', | ||
'Marzo', | ||
'Aprile', | ||
'Maggio', | ||
'Giugno', | ||
'Luglio', | ||
'Agosto', | ||
'Settembre', | ||
'Ottobre', | ||
'Novembre', | ||
'Dicembre', | ||
], | ||
}, | ||
cascader: { | ||
title: 'Titolo', | ||
placeholder: 'Seleziona opzioni', | ||
}, | ||
dropdownMenu: { | ||
reset: 'Reimposta', | ||
confirm: 'Conferma', | ||
}, | ||
dateTimePicker: { | ||
title: 'Seleziona Data', | ||
cancel: 'Annulla', | ||
confirm: 'Conferma', | ||
format: 'DD-MM-YYYY', | ||
yearLabel: 'Anno', | ||
monthLabel: 'Mese', | ||
dateLabel: 'Data', | ||
hourLabel: 'Ora', | ||
minuteLabel: 'Minuto', | ||
secondLabel: 'Secondo', | ||
}, | ||
picker: { | ||
cancel: 'Annulla', | ||
confirm: 'Conferma', | ||
}, | ||
pullDownRefresh: { | ||
loadingTexts: ['Tirare per aggiornare', 'Libera da aggiornare', 'Rinfrescante', 'Aggiornamento completato'], | ||
}, | ||
rate: { | ||
valueText: '{valore} punteggio', | ||
noValueText: 'Nessun punteggio', | ||
}, | ||
tabBar: { | ||
newsAriaLabel: 'Ci sono nuove notizie', | ||
moreNewsAriaLabel: 'Ci sono molte notizie', | ||
haveMoreNewsAriaLabel: 'Ci sono {valore}+ notizie', | ||
haveNewsAriaLabel: 'Ci sono {valore} notizie', | ||
}, | ||
table: { | ||
empty: 'Dati Vuoti', | ||
}, | ||
list: { | ||
loading: 'Caricamento...', | ||
loadingMoreText: 'Fai clic per caricare di più', | ||
pulling: 'Estrai per aggiornare...', | ||
loosing: 'Libera da aggiornare...', | ||
success: 'Aggiorna riuscito', | ||
}, | ||
upload: { | ||
progress: { | ||
uploadingText: 'Invio...', | ||
waitingText: 'Attesa', | ||
failText: 'Fallito', | ||
successText: 'Successo', | ||
}, | ||
}, | ||
guide: { | ||
next: 'Successivo', | ||
skip: 'Salta', | ||
finish: 'Finisci', | ||
back: 'Indietro', | ||
}, | ||
}; |
Oops, something went wrong.