-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 Arabic (ar) locale #15693
base: master
Are you sure you want to change the base?
Conversation
Localization writing tips ✍️Seems you are updating localization 🌍 files. Thank you for contributing to the localization! 🎉 To make your PR perfect, here is a list of elements to check: ✔️
Deploy preview: https://deploy-preview-15693--material-ui-x.netlify.app/ |
@@ -36,4 +36,5 @@ export * from './urPK'; | |||
export * from './viVN'; | |||
export * from './zhCN'; | |||
export * from './zhHK'; | |||
export * from './ar'; |
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.
Based on other languages, it is recommended to specify the country of the language, such as arMR or arEG
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.
@ET-TOUNANI As arabic is spoken in many countries they have many dialects just like eu. So i have taken that consideration and named it. Kindly suggest!
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.
Thank you for your contribution @0xenn! 🙏
Could you please run the suggested scripts to fix CI errors?
Given that @mui/material
has localization for different Arabic dialects, should we also consider having it separate?
I'm not an expert in Arabic language, so, can't comment on the best approach.
But if it is anything similar to how Norwegian (Bokmål and Nynorsk) differ, then we should probably split it per dialect. 🤔
For languages, where a common form for certain thing is acceptable, I wouldn't mind landing on a generic locale (like having en
instead of enUS
and endGB
, etc.)
@LukasTy Done. Thanks for your feedback.😊 |
What do you think about the localization itself? ar: 'Arabic' in the |
@LukasTy as mentioned by you that @mui/material has as different localization for different countries. In this case also i think it would be much better to have that distinction because there might be slight differences between dialects You can have a look on language code and let me know. Even i don't have that much idea 😅. |
The main issue is consistency. WDYT @mui/xgrid and @mui/material-ui? Does it make sense to segment Arabic locales precisely? 🤔 |
🤣.Understood then it's better to have localization per dialect. In that case which country do i need to specify as i have used generic arabic. |
If it's ok for you, let's wait for any feedback from the tagged teams before proceeding with any changes. 😉
Whichever you need or can provide. 👍 Preferably—the most popular/common. Lines 3 to 5 in 259a3d4
|
Sure No problem. Kindly notify it
Ok. 😁 |
Hey @LukasTy, I asked the Material UI team, and we agree that we should try to keep consistency and follow https://mui.com/material-ui/guides/localization/#supported-locales, which would be best. |
Thanks for the reply @DiegoAndai. 🙏 One could say that we could even rename |
I'm not aware of that issue, but seems like there's no decision there either. |
So that means for now we can go with these three according to https://mui.com/material-ui/guides/localization/#supported-locales right. |
I'm not a native Arabic, however, I speak a language that uses the same alphabet system and many words are common with Arabic. As I understand, although different dialects exist they are very similar in terms of communication and a standard locale could cover more than 99% of the communication. Thus, the proposal in mui/material-ui#31847 makes sense to me, I'd be in favor of doing it for X line of products in v8, and possibly deprecating the country-specific ones aiming to remove them in v9. The core line of products could follow it then. |
Thank you for your input @MBilalShafi. 🙏 Besides, we already have a couple (eu and mk) country independent locales. 👍 @0xenn could you update the PR with the mentioned suggestion (#15693 (comment)) of adding an entry in the |
@LukasTy Done. Thanks |
Based on https://www.rfc-editor.org/rfc/rfc5646.html#section-4.1.2
and this list, you could say that A final note
My position hasn't changed, I would like to proceed with introducing the |
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.
Thank you for all your effort and cooperation @0xenn! 🙏
I'll wait a bit to see if there are no objections for this solution. 😉
Hello! I have noticed some issues in the translation itself. import { PickersLocaleText } from './utils/pickersLocaleTextApi';
import { getPickersLocalization } from './utils/getPickersLocalization';
import { TimeViewWithMeridiem } from '../internals/models';
// maps TimeView to its translation
const views: Record<TimeViewWithMeridiem, string> = {
hours: 'الساعة',
minutes: 'الدقيقة',
seconds: 'الثانية',
meridiem: 'صباحًا/مساءً',
};
const arPickers: Partial<PickersLocaleText> = {
// Calendar navigation
previousMonth: 'الشهر السابق',
nextMonth: 'الشهر القادم',
// View navigation
openPreviousView: 'فتح العرض السابق',
openNextView: 'فتح العرض التالي',
calendarViewSwitchingButtonAriaLabel: (view) =>
view === 'year'
? 'عرض السنوات مفتوح، بدِّل إلى عرض التقويم'
: 'عرض التقويم مفتوح، بدِّل إلى عرض السنوات',
// DateRange labels
start: 'من',
end: 'إلى',
startDate: 'تاريخ البدء',
startTime: 'وقت البدء',
endDate: 'تاريخ الانتهاء',
endTime: 'وقت الانتهاء',
// Action bar
cancelButtonLabel: 'إلغاء',
clearButtonLabel: 'مسح الاختيار',
okButtonLabel: 'تم',
todayButtonLabel: 'اليوم',
// Toolbar titles
datePickerToolbarTitle: 'اختر التاريخ',
dateTimePickerToolbarTitle: 'اختر التاريخ والوقت',
timePickerToolbarTitle: 'اختر الوقت',
dateRangePickerToolbarTitle: 'اختر التواريخ',
// Clock labels
clockLabelText: (view, formattedTime) =>
`اختر ${views[view]}. ${!formattedTime ? 'لم تختر الوقت' : `اخترت الوقت: ${formattedTime}`}`,
hoursClockNumberText: (hours) => `ساعة ${hours}`,
minutesClockNumberText: (minutes) => `دقيقة ${minutes}`,
secondsClockNumberText: (seconds) => `ثانية ${seconds}`,
// Digital clock labels
selectViewText: (view) => `اختر ${views[view]}`,
// Calendar labels
calendarWeekNumberHeaderLabel: 'رقم الأسبوع',
calendarWeekNumberHeaderText: '#',
calendarWeekNumberAriaLabelText: (weekNumber) => `أسبوع ${weekNumber}`,
calendarWeekNumberText: (weekNumber) => `${weekNumber}`,
// Open picker labels
openDatePickerDialogue: (formattedDate) =>
formattedDate ? `اختر التاريخ، اخترت التاريخ: ${formattedDate}` : 'اختر التاريخ',
openTimePickerDialogue: (formattedTime) =>
formattedTime ? `اختر الوقت، اخترت الوقت: ${formattedTime}` : 'اختر الوقت',
fieldClearLabel: 'مسح الاختيار',
// Table labels
timeTableLabel: 'اختر الوقت',
dateTableLabel: 'اختر التاريخ',
// Field section placeholders
fieldYearPlaceholder: () => 'سنة',
fieldMonthPlaceholder: () => 'شهر',
fieldDayPlaceholder: () => 'يوم',
fieldWeekDayPlaceholder: () => 'يوم-الأسبوع',
fieldHoursPlaceholder: () => 'ساعة',
fieldMinutesPlaceholder: () => 'دقيقة',
fieldSecondsPlaceholder: () => 'ثانية',
fieldMeridiemPlaceholder: () => 'ص/م',
// View names
year: 'السنوات',
month: 'الأشهر',
day: 'الأيام',
weekDay: 'أيام الأسبوع',
hours: 'الساعات',
minutes: 'الدقائق',
seconds: 'الثواني',
meridiem: 'صباحًا/مساءً',
// Common
empty: 'فارغ',
};
export const ar = getPickersLocalization(arPickers); |
@SafaAlfulaij could you do a review and provide suggestions line by line so that you could discuss them with @0xenn or someone else, who knows Arabic? 🙏 |
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.
I have added my comments line-by-line :)
const arPickers: Partial<PickersLocaleText> = { | ||
// Calendar navigation | ||
previousMonth: 'الشهر السابق', | ||
nextMonth: 'الشهر المقبل', |
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.
it's more common to the ear to hear السابق/التالي.
nextMonth: 'الشهر المقبل', | |
nextMonth: 'الشهر التالي', |
openNextView: 'افتح العرض التالي', | ||
calendarViewSwitchingButtonAriaLabel: (view) => | ||
view === 'year' | ||
? 'عرض السنة مفتوح، قم بالتبديل إلى عرض التقويم' |
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.
"year view" actually shows years, not a year, so it's better to name it in the plural form: عرض السنوات
the word "قم" is generally a weak form, we better say "بدِّل" (using the basic imperative mood)
? 'عرض السنة مفتوح، قم بالتبديل إلى عرض التقويم' | |
? 'عرض السنوات مفتوح، بدِّل إلى عرض التقويم' |
calendarViewSwitchingButtonAriaLabel: (view) => | ||
view === 'year' | ||
? 'عرض السنة مفتوح، قم بالتبديل إلى عرض التقويم' | ||
: 'عرض التقويم مفتوح، قم بالتبديل إلى عرض السنة', |
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.
: 'عرض التقويم مفتوح، قم بالتبديل إلى عرض السنة', | |
: 'عرض التقويم مفتوح، بدِّل إلى عرض السنوات', |
: 'عرض التقويم مفتوح، قم بالتبديل إلى عرض السنة', | ||
|
||
// DateRange labels | ||
start: 'يبدأ', |
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.
as this is very generic, we can use the more generic from...to form instead
start: 'يبدأ', | |
start: 'من', |
|
||
// DateRange labels | ||
start: 'يبدأ', | ||
end: 'نهاية', |
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.
end: 'نهاية', | |
end: 'إلى', |
fieldHoursPlaceholder: () => 'hh', | ||
fieldMinutesPlaceholder: () => 'mm', | ||
fieldSecondsPlaceholder: () => 'ss', | ||
fieldMeridiemPlaceholder: () => 'aa', |
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.
fieldMeridiemPlaceholder: () => 'aa', | |
fieldMeridiemPlaceholder: () => 'ص/م', |
|
||
// maps TimeView to its translation | ||
const views: Record<TimeViewWithMeridiem, string> = { | ||
hours: 'ساعات', |
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.
These are used below, and instruct the user to choose the unit.
it's better to have them singular instead (ex. "اختر الساعة")
hours: 'ساعات', | |
hours: 'الساعة', |
// maps TimeView to its translation | ||
const views: Record<TimeViewWithMeridiem, string> = { | ||
hours: 'ساعات', | ||
minutes: 'دقائق', |
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.
minutes: 'دقائق', | |
minutes: 'الدقيقة', |
const views: Record<TimeViewWithMeridiem, string> = { | ||
hours: 'ساعات', | ||
minutes: 'دقائق', | ||
seconds: 'ثواني', |
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.
seconds: 'ثواني', | |
seconds: 'الثانية', |
hours: 'ساعات', | ||
minutes: 'دقائق', | ||
seconds: 'ثواني', | ||
meridiem: 'ميريديم', |
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.
meridiem: 'ميريديم', | |
meridiem: 'صباحًا/مساءً', |
At the root, handling the locale structure for #15650 is a Base UI product decision. The closest we have to this is mui/material-ui#31847. So I'm moving the discussion there. Let's keep this here about the actual translation work. |
ar: 'Arabic', | ||
'ar-EG': 'Arabic (Egypt)', | ||
'ar-SA': 'Arabic (Saudi Arabia)', | ||
'ar-SD': 'Arabic (Sudan)', |
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.
Would this work mui/material-ui#31847 (comment)?
ar: 'Arabic', | |
'ar-EG': 'Arabic (Egypt)', | |
'ar-SA': 'Arabic (Saudi Arabia)', | |
'ar-SD': 'Arabic (Sudan)', | |
ar: 'Standard Arabic', |
@0xenn could you take a look and resolve the suggestions provided by @SafaAlfulaij? 🤔 |
Fixes #15650