From 06ef78b9e8b188c44a386d210e927ea6ca86f352 Mon Sep 17 00:00:00 2001 From: mohamedalzaki Date: Mon, 12 Oct 2020 08:45:33 +0200 Subject: [PATCH 1/4] [i10n] Add Arabic (ar-AR) locale --- .../pages/guides/localization/localization.md | 1 + packages/material-ui/src/locale/index.ts | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/docs/src/pages/guides/localization/localization.md b/docs/src/pages/guides/localization/localization.md index f64afbea278241..3f363b23235600 100644 --- a/docs/src/pages/guides/localization/localization.md +++ b/docs/src/pages/guides/localization/localization.md @@ -34,6 +34,7 @@ const theme = createMuiTheme( | Locale | BCP 47 language tag | Import name | | :---------------------- | :------------------ | :---------- | +| Arabic | ar-AR | `arAR` | | Armenian | hy-AM | `hyAM` | | Azerbaijani | az-AZ | `azAZ` | | Bulgarian | bg-BG | `bgBG` | diff --git a/packages/material-ui/src/locale/index.ts b/packages/material-ui/src/locale/index.ts index e3615b898dcde0..4d5fed7a1f82e5 100644 --- a/packages/material-ui/src/locale/index.ts +++ b/packages/material-ui/src/locale/index.ts @@ -29,6 +29,56 @@ export interface Localization { }; } +export const arAR: Localization = { + props: { + MuiBreadcrumbs: { + expandText: 'إظهر العنوان', + }, + MuiTablePagination: { + backIconButtonText: 'الصفحة السابقة', + labelRowsPerPage: 'عدد الصفوف في الصفحة:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} من ${count !== -1 ? count : ` أكثر من${to}`}`, + nextIconButtonText: 'الصفحة التالية', + }, + MuiRating: { + getLabelText: (value) => `${value} ${value !== 1 ? 'نجوم' : 'نجمة'}`, + emptyLabelText: 'فارغ', + }, + MuiAutocomplete: { + clearText: 'مسح', + closeText: 'إغلاق', + loadingText: 'يتم التحميل…', + noOptionsText: 'لا يوجد خيارات', + openText: 'فتح', + }, + MuiAlert: { + closeText: 'إغلاق', + }, + MuiPagination: { + 'aria-label': 'التنقل عبر الصفحات', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'إذهب إلى '} صفحة ${page}`; + } + if (type === 'first') { + return 'إذهب الى الصفحة الأولى'; + } + if (type === 'last') { + return 'إذهب الي الصفحة الأخيرة'; + } + if (type === 'next') { + return 'إذهب الى الصفحة التالية'; + } + if (type === 'previous') { + return 'إذهب الى الصفحة السابقة'; + } + return undefined; + }, + }, + }, +}; + export const azAZ: Localization = { components: { MuiBreadcrumbs: { From cbd99ac9b30b365b5db760d97d770b37bcf7c595 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Mon, 12 Oct 2020 12:46:05 +0200 Subject: [PATCH 2/4] rebase --- packages/material-ui/src/locale/index.ts | 85 +++++++++++++++--------- 1 file changed, 53 insertions(+), 32 deletions(-) diff --git a/packages/material-ui/src/locale/index.ts b/packages/material-ui/src/locale/index.ts index 4d5fed7a1f82e5..1ee59ab4e3deb3 100644 --- a/packages/material-ui/src/locale/index.ts +++ b/packages/material-ui/src/locale/index.ts @@ -30,50 +30,71 @@ export interface Localization { } export const arAR: Localization = { - props: { + components: { MuiBreadcrumbs: { - expandText: 'إظهر العنوان', + defaultProps: { + expandText: 'إظهر العنوان', + }, }, MuiTablePagination: { - backIconButtonText: 'الصفحة السابقة', - labelRowsPerPage: 'عدد الصفوف في الصفحة:', - labelDisplayedRows: ({ from, to, count }) => - `${from}-${to} من ${count !== -1 ? count : ` أكثر من${to}`}`, - nextIconButtonText: 'الصفحة التالية', + defaultProps: { + getItemAriaLabel: (type) => { + if (type === 'first') { + return 'إذهب الى الصفحة الأولى'; + } + if (type === 'last') { + return 'إذهب الي الصفحة الأخيرة'; + } + if (type === 'next') { + return 'إذهب الى الصفحة التالية'; + } + // if (type === 'previous') { + return 'إذهب الى الصفحة السابقة'; + }, + labelRowsPerPage: 'عدد الصفوف في الصفحة:', + labelDisplayedRows: ({ from, to, count }) => + `${from}-${to} من ${count !== -1 ? count : ` أكثر من${to}`}`, + }, }, MuiRating: { - getLabelText: (value) => `${value} ${value !== 1 ? 'نجوم' : 'نجمة'}`, - emptyLabelText: 'فارغ', + defaultProps: { + getLabelText: (value) => `${value} ${value !== 1 ? 'نجوم' : 'نجمة'}`, + emptyLabelText: 'فارغ', + }, }, MuiAutocomplete: { - clearText: 'مسح', - closeText: 'إغلاق', - loadingText: 'يتم التحميل…', - noOptionsText: 'لا يوجد خيارات', - openText: 'فتح', + defaultProps: { + clearText: 'مسح', + closeText: 'إغلاق', + loadingText: 'يتم التحميل…', + noOptionsText: 'لا يوجد خيارات', + openText: 'فتح', + }, }, MuiAlert: { - closeText: 'إغلاق', + defaultProps: { + closeText: 'إغلاق', + }, }, MuiPagination: { - 'aria-label': 'التنقل عبر الصفحات', - getItemAriaLabel: (type, page, selected) => { - if (type === 'page') { - return `${selected ? '' : 'إذهب إلى '} صفحة ${page}`; - } - if (type === 'first') { - return 'إذهب الى الصفحة الأولى'; - } - if (type === 'last') { - return 'إذهب الي الصفحة الأخيرة'; - } - if (type === 'next') { - return 'إذهب الى الصفحة التالية'; - } - if (type === 'previous') { + defaultProps: { + 'aria-label': 'التنقل عبر الصفحات', + getItemAriaLabel: (type, page, selected) => { + if (type === 'page') { + return `${selected ? '' : 'إذهب إلى '} صفحة ${page}`; + } + if (type === 'first') { + return 'إذهب الى الصفحة الأولى'; + } + if (type === 'last') { + return 'إذهب الي الصفحة الأخيرة'; + } + if (type === 'next') { + return 'إذهب الى الصفحة التالية'; + } + // if (type === 'previous') { return 'إذهب الى الصفحة السابقة'; - } - return undefined; + }, }, }, }, From 46b52952de9c27e87ed55c31e9f339841cd123c2 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Mon, 12 Oct 2020 13:57:57 +0200 Subject: [PATCH 3/4] ar-EG --- docs/src/pages/guides/localization/localization.md | 2 +- packages/material-ui/src/locale/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/pages/guides/localization/localization.md b/docs/src/pages/guides/localization/localization.md index 3f363b23235600..fd9ce55d2be2e1 100644 --- a/docs/src/pages/guides/localization/localization.md +++ b/docs/src/pages/guides/localization/localization.md @@ -34,7 +34,7 @@ const theme = createMuiTheme( | Locale | BCP 47 language tag | Import name | | :---------------------- | :------------------ | :---------- | -| Arabic | ar-AR | `arAR` | +| Arabic | ar-EG | `arEG` | | Armenian | hy-AM | `hyAM` | | Azerbaijani | az-AZ | `azAZ` | | Bulgarian | bg-BG | `bgBG` | diff --git a/packages/material-ui/src/locale/index.ts b/packages/material-ui/src/locale/index.ts index 1ee59ab4e3deb3..5a505941535d3a 100644 --- a/packages/material-ui/src/locale/index.ts +++ b/packages/material-ui/src/locale/index.ts @@ -29,7 +29,7 @@ export interface Localization { }; } -export const arAR: Localization = { +export const arEG: Localization = { components: { MuiBreadcrumbs: { defaultProps: { From 1ab9297cc316814228db43e584948eec3d0f43b2 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Mon, 12 Oct 2020 14:00:56 +0200 Subject: [PATCH 4/4] be more precise --- docs/src/pages/guides/localization/localization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/pages/guides/localization/localization.md b/docs/src/pages/guides/localization/localization.md index fd9ce55d2be2e1..92fd0fa846e070 100644 --- a/docs/src/pages/guides/localization/localization.md +++ b/docs/src/pages/guides/localization/localization.md @@ -34,7 +34,7 @@ const theme = createMuiTheme( | Locale | BCP 47 language tag | Import name | | :---------------------- | :------------------ | :---------- | -| Arabic | ar-EG | `arEG` | +| Arabic (Egypt) | ar-EG | `arEG` | | Armenian | hy-AM | `hyAM` | | Azerbaijani | az-AZ | `azAZ` | | Bulgarian | bg-BG | `bgBG` |