Skip to content

Commit

Permalink
[pickers] Add Urdu (ur-PK) locale (#7007)
Browse files Browse the repository at this point in the history
  • Loading branch information
MBilalShafi authored Nov 28, 2022
1 parent 10d4133 commit c35efab
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/data/date-pickers/localization/localization.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ If you want to customize some translations on specific component, you can use th
| Turkish | tr-TR | `trTr` |
| Dutch | nl-NL | `nlNL` |
| Ukrainian | uk-UA | `ukUA` |
| Urdu (Pakistan) | ur-PK | `urPK` |

You can [find the source](https://github.com/mui/mui-x/tree/HEAD/packages/x-date-pickers/src/locales) in the GitHub repository.

Expand Down
1 change: 1 addition & 0 deletions packages/x-date-pickers/src/locales/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export * from './koKR';
export * from './isIS';
export * from './jaJP';
export * from './ukUA';
export * from './urPK';
export * from './utils/pickersLocaleTextApi';
2 changes: 0 additions & 2 deletions packages/x-date-pickers/src/locales/ukUA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { PickersLocaleText } from './utils/pickersLocaleTextApi';
import { getPickersLocalization } from './utils/getPickersLocalization';
import { DateView } from '../internals/models';

// This object is not Partial<PickersLocaleText> because it is the default values

const ukUAPickers: Partial<PickersLocaleText<any>> = {
// Calendar navigation
previousMonth: 'Попередній місяць',
Expand Down
77 changes: 77 additions & 0 deletions packages/x-date-pickers/src/locales/urPK.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { PickersLocaleText } from './utils/pickersLocaleTextApi';
import { getPickersLocalization } from './utils/getPickersLocalization';
import { DateView } from '../internals/models';

const urPKPickers: Partial<PickersLocaleText<any>> = {
// Calendar navigation
previousMonth: 'پچھلا مہینہ',
nextMonth: 'اگلا مہینہ',

// View navigation
openPreviousView: 'پچھلا ویو کھولیں',
openNextView: 'اگلا ویو کھولیں',
calendarViewSwitchingButtonAriaLabel: (view: DateView) =>
view === 'year'
? 'سال والا ویو کھلا ہے۔ کیلنڈر والا ویو کھولیں'
: 'کیلنڈر والا ویو کھلا ہے۔ سال والا ویو کھولیں',
inputModeToggleButtonAriaLabel: (isKeyboardInputOpen, viewType) =>
isKeyboardInputOpen
? `،ٹیکسٹ ویو کھلا ہے ${viewType} ویو کھولیں`
: `${viewType} ویو کھلا ہے، ٹیکسٹ ویو کھولیں`,

// DateRange placeholders
start: 'شروع',
end: 'ختم',

// Action bar
cancelButtonLabel: 'کینسل',
clearButtonLabel: 'کلئیر',
okButtonLabel: 'اوکے',
todayButtonLabel: 'آج',

// Toolbar titles
datePickerToolbarTitle: 'تاریخ منتخب کریں',
dateTimePickerToolbarTitle: 'تاریخ اور وقت منتخب کریں',
timePickerToolbarTitle: 'وقت منتخب کریں',
dateRangePickerToolbarTitle: 'تاریخوں کی رینج منتخب کریں',

// Clock labels
clockLabelText: (view, time, adapter) =>
`${view} منتخب کریں ${
time === null ? 'کوئی وقت منتخب نہیں' : `منتخب وقت ہے ${adapter.format(time, 'fullTime')}`
}`,
hoursClockNumberText: (hours) => `${hours} گھنٹے`,
minutesClockNumberText: (minutes) => `${minutes} منٹ`,
secondsClockNumberText: (seconds) => `${seconds} سیکنڈ`,

// Calendar labels
calendarWeekNumberHeaderLabel: 'ہفتہ نمبر',
calendarWeekNumberHeaderText: 'نمبر',
calendarWeekNumberAriaLabelText: (weekNumber) => `ہفتہ ${weekNumber}`,
calendarWeekNumberText: (weekNumber) => `${weekNumber}`,

// 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: 'تاریخ منتخب کریں',

// Field section placeholders
// fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
// fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
// fieldDayPlaceholder: () => 'DD',
// fieldHoursPlaceholder: () => 'hh',
// fieldMinutesPlaceholder: () => 'mm',
// fieldSecondsPlaceholder: () => 'ss',
// fieldMeridiemPlaceholder: () => 'aa',
};

export const urPK = getPickersLocalization(urPKPickers);
1 change: 1 addition & 0 deletions scripts/x-date-pickers-pro.exports.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@
{ "name": "unstable_useMultiInputTimeRangeField", "kind": "Variable" },
{ "name": "unstable_useSingleInputDateRangeField", "kind": "Variable" },
{ "name": "unstable_useTimeField", "kind": "Variable" },
{ "name": "urPK", "kind": "Variable" },
{ "name": "UseDateFieldComponentProps", "kind": "TypeAlias" },
{ "name": "UseDateFieldProps", "kind": "Interface" },
{ "name": "UseDateTimeFieldComponentProps", "kind": "TypeAlias" },
Expand Down
1 change: 1 addition & 0 deletions scripts/x-date-pickers.exports.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@
{ "name": "unstable_useDateField", "kind": "Variable" },
{ "name": "unstable_useDateTimeField", "kind": "Variable" },
{ "name": "unstable_useTimeField", "kind": "Variable" },
{ "name": "urPK", "kind": "Variable" },
{ "name": "UseDateFieldComponentProps", "kind": "TypeAlias" },
{ "name": "UseDateFieldProps", "kind": "Interface" },
{ "name": "UseDateTimeFieldComponentProps", "kind": "TypeAlias" },
Expand Down

0 comments on commit c35efab

Please sign in to comment.