From 8e0191a9e6c2a647aef5a4a8367d66f95c707df8 Mon Sep 17 00:00:00 2001 From: greymoth <246701683+greymoth-jp@users.noreply.github.com> Date: Tue, 30 Jun 2026 05:02:50 +0900 Subject: [PATCH] fix(hr-HR): feminine number words before -arda scale words MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Croatian milijarda and bilijarda, and the higher -arda scale words, are feminine like tisuća, so the count in front of them takes the feminine form: jedna milijarda, dvije milijarde, not jedan milijarda. Only thousands were marked feminine, so every -arda scale (10^9, 10^15, ...) printed the masculine count. Change the gender test from scaleIndex === 1 to scaleIndex % 2 === 1, feminine at each -arda scale and masculine at the -un scales (milijun, bilijun, ...), in both the cardinal and ordinal builders. This is the same fix #413 made for sr-Cyrl-RS and sr-Latn-RS, which share this grammar. Adds cardinal and ordinal cases for milijarda and bilijarda. --- src/hr-HR.js | 14 ++++++++------ test/fixtures/hr-HR.js | 8 ++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/hr-HR.js b/src/hr-HR.js index d8cc666d..aded042c 100644 --- a/src/hr-HR.js +++ b/src/hr-HR.js @@ -5,7 +5,8 @@ * * Key features: * - Three-form pluralization (one/few/many) - * - Gender: thousands are feminine, millions+ are masculine + * - Gender by scale word: tisuća and the -arda forms (milijarda, bilijarda, ...) + * are feminine; the -un forms (milijun, bilijun, ...) are masculine * - Irregular hundreds (dvjesto, tristo, etc.) * - Long scale naming with -ard forms */ @@ -63,7 +64,8 @@ const EURO_FORMS = ['euro', 'eura', 'eura'] const CENT_FORMS = ['cent', 'centa', 'centi'] // Scale words: [singular, few, many] -// Thousands (index 0) are feminine, rest are masculine +// Indexed [scaleIndex - 1]; odd scales (tisuća, milijarda, bilijarda, ...) are +// feminine, the -un forms (milijun, bilijun, ...) masculine const SCALE_FORMS = [ ['tisuća', 'tisuće', 'tisuća'], ['milijun', 'milijuna', 'milijuna'], @@ -221,8 +223,8 @@ function buildLargeNumberWords(n, gender) { else { const scaleForms = SCALE_FORMS[scaleIndex - 1] const scaleWord = pluralize(segment, scaleForms) - // Thousands (scaleIndex=1) are feminine, others masculine - const isFeminine = scaleIndex === 1 + // tisuća and the -arda forms (milijarda, bilijarda, ...) are feminine; -un words masculine + const isFeminine = scaleIndex % 2 === 1 const segmentWord = isFeminine ? buildSegmentFem(segment) : buildSegmentMasc(segment) parts.push(segmentWord + ' ' + scaleWord) } @@ -429,7 +431,7 @@ function buildLargeOrdinal(n) { parts.push(ORDINAL_SCALES[scaleIndex - 1]) } else { - const isFeminine = scaleIndex === 1 + const isFeminine = scaleIndex % 2 === 1 // feminine at odd scales (tisuća, milijarda, ...) const segmentWord = isFeminine ? buildSegmentFem(segment) : buildSegmentMasc(segment) parts.push(segmentWord + ' ' + ORDINAL_SCALES[scaleIndex - 1]) } @@ -437,7 +439,7 @@ function buildLargeOrdinal(n) { else { const scaleForms = SCALE_FORMS[scaleIndex - 1] const scaleWord = pluralize(segment, scaleForms) - const isFeminine = scaleIndex === 1 + const isFeminine = scaleIndex % 2 === 1 const segmentWord = isFeminine ? buildSegmentFem(segment) : buildSegmentMasc(segment) parts.push(segmentWord + ' ' + scaleWord) } diff --git a/test/fixtures/hr-HR.js b/test/fixtures/hr-HR.js index ae2951d5..3ba145a8 100644 --- a/test/fixtures/hr-HR.js +++ b/test/fixtures/hr-HR.js @@ -69,8 +69,12 @@ export const cardinal = [ [1_000_000, 'jedan milijun'], [1_000_001, 'jedan milijun jedan'], [4_000_000, 'četiri milijuna'], + [1_000_000_000, 'jedna milijarda'], + [2_000_000_000, 'dvije milijarde'], + [5_000_000_000, 'pet milijarda'], [10_000_000_000_000, 'deset bilijuna'], [100_000_000_000_000, 'sto bilijuna'], + [1_000_000_000_000_000n, 'jedna bilijarda'], [1_000_000_000_000_000_000n, 'jedan trilijun'], // Feminine gender tests @@ -130,6 +134,10 @@ export const ordinal = [ // Millions [1000000, 'milijunti'], [2000000, 'dva milijunti'], + + // Billions (milijarda is feminine, like tisuća) + [1_000_000_000, 'milijarditi'], + [2_000_000_000, 'dvije milijarditi'], ] /**