Skip to content
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

[l10n] Add Japanese (ja-JP) locale to pickers (#6365) #6382

Merged
merged 1 commit into from Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/data/date-pickers/localization/localization.md
Expand Up @@ -124,6 +124,7 @@ import bgLocale from 'date-fns/locale/bg';
| German | de-DE | `deDE` |
| Icelandic | is-IS | `isIS` |
| Italian | it-IT | `itIT` |
| Japanese | ja-JP | `jaJP` |
| Korean | ko-KR | `koKR` |
| Norwegian (Bokmål) | nb-NO | `nbNO` |
| Persian | fa-IR | `faIR` |
Expand Down
1 change: 1 addition & 0 deletions packages/x-date-pickers/src/locales/index.ts
Expand Up @@ -14,4 +14,5 @@ export * from './itIT';
export * from './zhCN';
export * from './koKR';
export * from './isIS';
export * from './jaJP';
export * from './utils/pickersLocaleTextApi';
77 changes: 77 additions & 0 deletions packages/x-date-pickers/src/locales/jaJP.ts
@@ -0,0 +1,77 @@
import { PickersLocaleText } from './utils/pickersLocaleTextApi';
import { getPickersLocalization } from './utils/getPickersLocalization';
import { CalendarPickerView } from '../internals/models';

// maps ClockPickerView to its translation
const clockViews = {
hours: '時間',
minutes: '分',
seconds: '秒',
};

// maps PickersToolbar["viewType"] to its translation
const pickerViews = {
calendar: 'カレンダー表示',
clock: '時計表示',
};

const jaJPPickers: Partial<PickersLocaleText<any>> = {
// Calendar navigation
previousMonth: '先月',
nextMonth: '来月',

// View navigation
openPreviousView: '前の表示を開く',
openNextView: '次の表示を開く',
calendarViewSwitchingButtonAriaLabel: (view: CalendarPickerView) =>
view === 'year'
? '年選択表示からカレンダー表示に切り替える'
: 'カレンダー表示から年選択表示に切り替える',
inputModeToggleButtonAriaLabel: (isKeyboardInputOpen: boolean, viewType: 'calendar' | 'clock') =>
isKeyboardInputOpen
? `テキスト入力表示から${pickerViews[viewType]}に切り替える`
: `${pickerViews[viewType]}からテキスト入力表示に切り替える`,

// DateRange placeholders
start: '開始',
end: '終了',

// Action bar
cancelButtonLabel: 'キャンセル',
clearButtonLabel: 'クリア',
okButtonLabel: '確定',
todayButtonLabel: '今日',

// Toolbar titles
datePickerDefaultToolbarTitle: '日付を選択',
dateTimePickerDefaultToolbarTitle: '日時を選択',
timePickerDefaultToolbarTitle: '時間を選択',
dateRangePickerDefaultToolbarTitle: '日付の範囲を選択',

// Clock labels
clockLabelText: (view, time, adapter) =>
`${clockViews[view] ?? view}を選択してください ${
time === null
? '時間が選択されていません'
: `選択した時間は ${adapter.format(time, 'fullTime')} です`
}`,
hoursClockNumberText: (hours) => `${hours} ${clockViews.hours}`,
minutesClockNumberText: (minutes) => `${minutes} ${clockViews.minutes}`,
secondsClockNumberText: (seconds) => `${seconds} ${clockViews.seconds}`,

// Open picker labels
openDatePickerDialogue: (value, utils) =>
value !== null && utils.isValid(value)
? `日付を選択してください。選択した日付は ${utils.format(value, 'fullDate')} です`
: '日付を選択してください',
openTimePickerDialogue: (value, utils) =>
value !== null && utils.isValid(value)
? `時間を選択してください。選択した時間は ${utils.format(value, 'fullTime')} です`
: '時間を選択してください',

// Table labels
timeTableLabel: '時間を選択',
dateTableLabel: '日付を選択',
};

export const jaJP = getPickersLocalization(jaJPPickers);
1 change: 1 addition & 0 deletions scripts/x-date-pickers-pro.exports.json
Expand Up @@ -102,6 +102,7 @@
{ "name": "getYearPickerUtilityClass", "kind": "Function" },
{ "name": "isIS", "kind": "Variable" },
{ "name": "itIT", "kind": "Variable" },
{ "name": "jaJP", "kind": "Variable" },
{ "name": "koKR", "kind": "Variable" },
{ "name": "LicenseInfo", "kind": "Class" },
{ "name": "LocalizationProvider", "kind": "Function" },
Expand Down
1 change: 1 addition & 0 deletions scripts/x-date-pickers.exports.json
Expand Up @@ -77,6 +77,7 @@
{ "name": "getYearPickerUtilityClass", "kind": "Function" },
{ "name": "isIS", "kind": "Variable" },
{ "name": "itIT", "kind": "Variable" },
{ "name": "jaJP", "kind": "Variable" },
{ "name": "koKR", "kind": "Variable" },
{ "name": "LocalizationProvider", "kind": "Function" },
{ "name": "LocalizationProviderProps", "kind": "Interface" },
Expand Down