feat(ar-SA): rewrite the counted-noun engine and add a case option - #449
Merged
Merged
Conversation
Rebuild the Arabic converter around the classical rules of العدد والمعدود,
one engine for bare cardinals, scale words and currency units:
- 100/1000/million head a genitive singular: "مائة ريال", "ألف ريال",
never "مائة ريالاً"; a dual head drops its ن: "مئتا ألف", "ألفا ريال"
- 11-99 keep the tamyīz tanwīn only when nothing follows: "أحد عشر ألفاً"
but "أحد عشر ألف ريال"
- a trailing 1 or 2 repeats the noun: "مائة ريال وريال واحد",
"مائة ألف وألفان" — previously "مائة وألف ألف" and "مائة واثنان ألف"
- scale words are masculine nouns, so 3000 is "ثلاثة آلاف" whatever the
gender option; feminine 8 is "ثماني" as a construct head and "إحدى"
stands in compounds ("إحدى وعشرون")
- ordinals get their dedicated forms: "الحادي عشر", "الحادي والعشرون",
and "الحادي بعد المائة" past 99 instead of a bare "ال" on the cardinal
- new `case` option (nominative | accusative | genitive) on every form:
"اثنين وعشرين", "ألفين", "ريالين", "الحادي والعشرين"
- currency reads majorGender from the matrix, and the matrix gains the
rest of the Arab-world set: AED, DZD, EGP, LBP, QAR, SDG, SYP, YER
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
مئة is the spelling the Arabic language academies standardise on; the traditional مائة (still printed on banknotes) stays available through `hundredSpelling: 'مائة'`, which 200–900 follow (مائتان, ثلاثمائة). The case option's description now names each case in Arabic (مرفوع, منصوب, مجرور) next to the Latin term. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
forzagreen
force-pushed
the
feat/ar-grammar
branch
from
September 11, 2026 09:23
f74785b to
0ac5929
Compare
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
Rewrites the Arabic converter around the classical rules of the counted noun (العدد والمعدود) so one engine renders bare cardinals, scale words and currency units. Adds
caseandhundredSpellingoptions to every Arabic form, and fills in the remaining Arab-world currencies.Also carries the
fix(deps-dev)commit from #450 so the audit check passes here; it will drop out on rebase once #450 merges.Grammar fixes (all were producing malformed Arabic)
toCurrency(100)toCurrency(1000)toCurrency(2000)toCurrency(11000)toCurrency(101)toCurrency(0)toCurrency(0.08)toCardinal(200000)toCardinal(101000)toCardinal(105000)toCardinal(121000)toCardinal(3000, feminine)toCardinal(21, feminine)toOrdinal(11)toOrdinal(21)toOrdinal(101)The rules now encoded, each in one place:
New options (cardinal, ordinal and currency)
case:nominative(مرفوع, default) |accusative(منصوب) |genitive(مجرور). The oblique cases put ـين on duals and tens ("اثنين وعشرين", "ألفين", "ريالين", "الحادي والعشرين"), which is what an amount needs after مبلغ or a preposition. Accusative and genitive coincide in unvocalised text except for the defective feminine 8 (ثمانيَ vs ثمانٍ).hundredSpelling:'مئة'(default, the academies' standard) |'مائة'(the traditional orthography, still printed on banknotes). 200–900 follow it: مئتان / مائتان, ثلاثمئة / ثلاثمائة.Currency matrix
toCurrencynow readsmajorGenderfrom the matrix instead of assuming masculine, and the matrix gains AED, DZD, EGP, LBP, QAR, SDG, SYP and YER. The Lebanese and Syrian ليرة is the first feminine major unit, which exercises every agreement rule from the other side ("ثلاث ليرات", "إحدى عشرة ليرة", "ألف ليرة وليرة واحدة").Test plan
npm test(845 tests) andnpm run lintpassLANGUAGES.mdregenerated; CLI picks up--caseand--hundred-spellingautomatically🤖 Generated with Claude Code