Repository navigation
feat: add Tajik (tg_TJ) locale #1028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ismoil77
wants to merge
1
commit into
react-component:master
Choose a base branch
from
ismoil77:feat/locale-tajik
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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,37 @@ | ||
| import { commonLocale } from './common'; | ||
| import type { Locale } from '../interface'; | ||
|
|
||
| const locale: Locale = { | ||
| ...commonLocale, | ||
| locale: 'tg_TJ', | ||
| today: 'Имрӯз', | ||
| now: 'Ҳозир', | ||
| backToToday: 'Бозгашт ба имрӯз', | ||
| ok: 'ХУБ', | ||
| clear: 'Пок кардан', | ||
| week: 'Ҳафта', | ||
| month: 'Моҳ', | ||
| year: 'Сол', | ||
| timeSelect: 'Вақтро интихоб кунед', | ||
| dateSelect: 'Санаро интихоб кунед', | ||
| weekSelect: 'Ҳафтаро интихоб кунед', | ||
| monthSelect: 'Моҳро интихоб кунед', | ||
| yearSelect: 'Солро интихоб кунед', | ||
| decadeSelect: 'Даҳсоларо интихоб кунед', | ||
| hourSelect: 'Соатро интихоб кунед', | ||
| minuteSelect: 'Дақиқаро интихоб кунед', | ||
| secondSelect: 'Сонияро интихоб кунед', | ||
| millisecondSelect: 'Миллисонияро интихоб кунед', | ||
| meridiemSelect: 'AM/PM-ро интихоб кунед', | ||
|
|
||
| previousMonth: 'Моҳи гузашта', | ||
| nextMonth: 'Моҳи оянда', | ||
| previousYear: 'Соли гузашта', | ||
| nextYear: 'Соли оянда', | ||
| previousDecade: 'Даҳсолаи гузашта', | ||
| nextDecade: 'Даҳсолаи оянда', | ||
| previousCentury: 'Асри гузашта', | ||
| nextCentury: 'Асри оянда', | ||
| }; | ||
|
|
||
| export default locale; | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为 date-fns 适配器补充
tg_TJ区域数据,并阻止日期面板崩溃。src/locale/tg_TJ.ts将locale设为tg_TJ。使用 date-fns 适配器(date-fns4.x)时,getLocale('tg_TJ')找不到对应的区域对象,因为 date-fns 不提供塔吉克语(tg)区域。DatePanel在渲染时调用getWeekFirstDay(locale.locale),随后getWeekFirstDay读取undefined.options,抛出 TypeError,日期面板无法打开。该缺陷位于适配器本身:
getLocale没有兜底,getWeekFirstDay也没有空值保护。本 PR 新增的tg_TJ使该路径可被用户触发。需要满足的行为:当 date-fns 适配器收到
tg_TJ时,getWeekFirstDay、getShortWeekDays、getShortMonths等方法必须返回有效结果,日期面板必须能够打开。实现方式需要在适配器中提供tg_TJ的 date-fns 兼容Locale对象,或为无对应区域的名称提供明确的兜底区域。请选择其中一种方式,并补充覆盖该场景的测试。