/** * Arabic (Saudi Arabia) language converter * * CLDR: ar-SA | Modern Standard Arabic as used in Saudi Arabia * * Self-contained converter implementing the classical rules of the Arabic * counted noun (العدد والمعدود). One engine renders a bare cardinal, a scale * word counted by its group ("ثلاثة آلاف", "أحد عشر ألفاً", "مئتا ألف") and a * currency unit counted by the whole amount ("ألفا ريال وريالان"), so the * agreement rules live in one place: * * - 1 and 2 agree with the noun and follow it: "ريال واحد", "ريالان". * - 3–10 take the *opposite* gender of the noun (polarity) and govern a * genitive plural: "ثلاثة ريالات" but "ثلاث هللات". * - 11–99 govern a singular accusative (تمييز): "أحد عشر ريالاً". The * tanwīn drops when that noun is itself a construct head, so 11,000 * riyals is "أحد عشر ألف ريال", never "ألفاً ريال". * - 100, 1000 and every larger scale word govern a singular genitive * (إضافة): "مئة ريال", "ألف ريال". The dual loses its ن as a construct * head: "مئتا ألف", "ألفا ريال". * - A compound ending in 1 or 2 repeats the noun rather than fronting a * bare numeral: "مئة ريال وريال واحد", as in "ألف ليلة وليلة". * * Case (الإعراب) is an option: the nominative (مرفوع) is the citation form, * while the accusative (منصوب) and genitive (مجرور) surface as ـين on duals * and tens ("اثنين وعشرين", "ألفين"). So is the spelling of 100: the * academy-standard مئة by default, or the traditional مائة that banknotes * and older texts use. Ordinals are the classical definite forms — "الحادي * عشر", "الحادي والعشرون", "الحادي بعد المئة" — the scheme that numbers the * nights of ألف ليلة وليلة. */ export type Gender = ('masculine' | 'feminine'); export type Case = ('nominative' | 'accusative' | 'genitive'); export type HundredSpelling = ('مئة' | 'مائة'); export type Style = { /** * - Case of the number */ grammaticalCase: Case; /** * - Spelling of 100, which 200–900 inherit */ hundred: HundredSpelling; }; export declare const cardinalMax: bigint; export declare const ordinalMax: bigint; export declare const currencyMax: bigint; export type Noun = { /** * - Bare singular: after 100/1000… and in "X واحد" */ singular: string; /** * - Nominative dual with its ن: "ريالان", "ألفان" */ dual: string; /** * - Plural counted by 3–10: "ريالات", "آلاف" */ plural: string; /** * - Singular accusative after 11–99: "ريالاً" */ tamyiz: string; /** * - Grammatical gender of the noun */ gender: Gender; /** * - Whether one is spelled out ("ريال واحد") or the bare noun stands alone ("ألف") */ countsWithOne: boolean; }; export type CardinalOptions = { /** * - Grammatical gender of the counted noun */ gender?: Gender; /** * - Grammatical case (الإعراب): nominative/مرفوع (اثنان وعشرون), accusative/منصوب or genitive/مجرور (اثنين وعشرين) */ case?: Case; /** * - Spelling of 100: the academy-standard مئة or the traditional مائة, as on banknotes */ hundredSpelling?: HundredSpelling; /** * - Custom word for negative numbers */ negativeWord?: string; }; /** * @typedef {object} CardinalOptions * @property {Gender} [gender] - Grammatical gender of the counted noun * @property {Case} [case] - Grammatical case (الإعراب): nominative/مرفوع (اثنان وعشرون), accusative/منصوب or genitive/مجرور (اثنين وعشرين) * @property {HundredSpelling} [hundredSpelling] - Spelling of 100: the academy-standard مئة or the traditional مائة, as on banknotes * @property {string} [negativeWord] - Custom word for negative numbers */ /** @type {Required} */ export declare const cardinalDefaults: Required; /** @type {{ gender: ReadonlyArray['gender']>, case: ReadonlyArray['case']>, hundredSpelling: ReadonlyArray['hundredSpelling']> }} */ export declare const cardinalValues: { gender: ReadonlyArray['gender']>; case: ReadonlyArray['case']>; hundredSpelling: ReadonlyArray['hundredSpelling']>; }; /** * Converts a numeric value to Arabic words. * @param {number | string | bigint} value - The numeric value to convert * @param {CardinalOptions} [options] - Optional configuration * @returns {string} The number in Arabic words * @example * toCardinal(1) // 'واحد' * toCardinal(1, { gender: 'feminine' }) // 'واحدة' * toCardinal(22, { case: 'genitive' }) // 'اثنين وعشرين' * toCardinal(300, { hundredSpelling: 'مائة' }) // 'ثلاثمائة' */ declare function toCardinal(value: number | string | bigint, options?: CardinalOptions): string; export type OrdinalOptions = { /** * - Grammatical gender of the ordinal */ gender?: Gender; /** * - Grammatical case (الإعراب): nominative/مرفوع (الحادي والعشرون), accusative/منصوب or genitive/مجرور (الحادي والعشرين) */ case?: Case; /** * - Spelling of 100: the academy-standard مئة or the traditional مائة, as on banknotes */ hundredSpelling?: HundredSpelling; }; /** * @typedef {object} OrdinalOptions * @property {Gender} [gender] - Grammatical gender of the ordinal * @property {Case} [case] - Grammatical case (الإعراب): nominative/مرفوع (الحادي والعشرون), accusative/منصوب or genitive/مجرور (الحادي والعشرين) * @property {HundredSpelling} [hundredSpelling] - Spelling of 100: the academy-standard مئة or the traditional مائة, as on banknotes */ /** @type {Required} */ export declare const ordinalDefaults: Required; /** @type {{ gender: ReadonlyArray['gender']>, case: ReadonlyArray['case']>, hundredSpelling: ReadonlyArray['hundredSpelling']> }} */ export declare const ordinalValues: { gender: ReadonlyArray['gender']>; case: ReadonlyArray['case']>; hundredSpelling: ReadonlyArray['hundredSpelling']>; }; /** * Converts a numeric value to Arabic ordinal words. * @param {number | string | bigint} value - The numeric value to convert (positive integer) * @param {OrdinalOptions} [options] - Optional configuration * @returns {string} The number as ordinal words * @throws {TypeError} If value is not a valid numeric type * @throws {RangeError} If value is negative, zero, or has a decimal part * @example * toOrdinal(1) // 'الأول' * toOrdinal(1, { gender: 'feminine' }) // 'الأولى' * toOrdinal(21) // 'الحادي والعشرون' * toOrdinal(101) // 'الحادي بعد المئة' */ declare function toOrdinal(value: number | string | bigint, options?: OrdinalOptions): string; export type CurrencyOptions = { /** * - ISO 4217 currency code to name the amount in */ currency?: import('./utils/currency-vocab.js').ArCurrency; /** * - Grammatical case (الإعراب): nominative/مرفوع (ريالان) or, as after مبلغ, accusative/منصوب or genitive/مجرور (ريالين) */ case?: Case; /** * - Spelling of 100: the academy-standard مئة or the traditional مائة, as on banknotes */ hundredSpelling?: HundredSpelling; }; /** * @typedef {object} CurrencyOptions * @property {import('./utils/currency-vocab.js').ArCurrency} [currency] - ISO 4217 currency code to name the amount in * @property {Case} [case] - Grammatical case (الإعراب): nominative/مرفوع (ريالان) or, as after مبلغ, accusative/منصوب or genitive/مجرور (ريالين) * @property {HundredSpelling} [hundredSpelling] - Spelling of 100: the academy-standard مئة or the traditional مائة, as on banknotes */ /** @type {Required} */ export declare const currencyDefaults: Required; /** @type {{ currency: ReadonlyArray['currency']>, case: ReadonlyArray['case']>, hundredSpelling: ReadonlyArray['hundredSpelling']> }} */ export declare const currencyValues: { currency: ReadonlyArray['currency']>; case: ReadonlyArray['case']>; hundredSpelling: ReadonlyArray['hundredSpelling']>; }; /** * Converts a numeric value to Arabic currency words (Saudi riyal by default). * @param {number | string | bigint} value - The currency amount to convert * @param {CurrencyOptions} [options] - Optional configuration * @returns {string} The amount in Arabic currency words * @throws {TypeError} If value is not a valid numeric type * @throws {RangeError} If the amount exceeds the supported range or has minor units the currency can't represent * @example * toCurrency(42.50) // 'اثنان وأربعون ريالاً وخمسون هللة' * toCurrency(1) // 'ريال واحد' * toCurrency(2000) // 'ألفا ريال' * toCurrency(0.01) // 'هللة واحدة' */ declare function toCurrency(value: number | string | bigint, options?: CurrencyOptions): string; export { toCardinal, toOrdinal, toCurrency };