feat(ar): add native Arabic language support (ar locale) - #656
Open
KareemHussen wants to merge 1 commit into
Open
feat(ar): add native Arabic language support (ar locale)#656KareemHussen wants to merge 1 commit into
KareemHussen wants to merge 1 commit into
Conversation
|
good job |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR introduces native Arabic (
ar) language parsing support to Chrono (chrono-node), aligning with the architecture and standards established in recently merged language locales (such as Vietnamese #641, Finnish #642, and Russian #458).Features & Implementation
src/locales/ar/):الأحدtoالسبت).يناير,فبراير,مارس,أبريل,مايو,يونيو,يوليو,أغسطس,سبتمبر,أكتوبر,نوفمبر,ديسمبر.كانون الثاني,شباط,آذار,نيسان,أيار,حزيران,تموز,آب,أيلول,تشرين الأول,تشرين الثاني,كانون الأول.يومين/يومان,ساعتين/ساعتان,أسبوعين/أسبوعان,شهرين/شهران,سنتين/عامين).0-9) and Eastern Arabic numerals (٠-٩).\p{L}and\p{N}withiuflags to properly detect Arabic word boundaries.ARCasualDateParser:اليوم,غداً,غدا,بعد غد,أمس,أول أمس,الآن.ARCasualTimeParser:هذا الصباح,الظهر,بعد الظهر,عصراً,هذا المساء,منتصف الليل.ARWeekdayParser: Modified and standalone weekdays (الجمعة القادم,الخميس الماضي,هذا الأحد,يوم ...).ARMonthNameLittleEndianParser: Expressions like15 يناير 2023,١٥ كانون الثاني ٢٠٢٣,15 من مارس, and date ranges with1 <= day <= 31bounds validation.ARMonthNameParser: Month + Year (يناير 2025,شهر مارس) with preceding day-number collision rejection.ARTimeExpressionParser: Clock times (الساعة 5:30 مساءً,8:00 ص,في تمام 6:00), Eastern numerals (الساعة ٥:٣٠ مساءً), and ranges (من 2:00 إلى 4:00 مساءً).ARTimeUnitAgoFormatParser,ARTimeUnitLaterFormatParser,ARTimeUnitWithinFormatParser: Relative durations (منذ 3 أيام,قبل ساعتين,بعد يومين,خلال 3 ساعات).ARRelativeDateFormatParser:الشهر القادم,الأسبوع الماضي,السنة القادمة.ARMergeDateTimeRefiner&ARMergeDateRangeRefiner: Merges date and time expressions and date ranges.chrono.arwithcasual,strict,parse, andparseDateinsrc/locales/ar/index.tsandsrc/index.ts.README.mdin both language lists (lines 40 and 226).Testing
test/ar/:ar_casual.test.ts: Casual dates and times, shortcuts, and strict mode.ar_weekday.test.ts: Standalone and modified weekdays.ar_month.test.ts: Standard and Levantine month dates, Eastern Arabic numerals, and ranges.ar_time_exp.test.ts: Time expressions, AM/PM, and time ranges.ar_time_units.test.ts: Past/future/within durations and dual forms.ar_negative_cases.test.ts: False positive checks against phone numbers, currencies, bare numbers, percentages, and impossible dates.