summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamantaz Fox <coding@samantaz.fr>2024-08-11 11:41:36 +0200
committerSamantaz Fox <coding@samantaz.fr>2024-08-11 11:41:36 +0200
commiteb2dfe0ab1c8294281ab898d158a98e533432750 (patch)
treec26560fe57c03fd97fd40ed9e62307b89efd169c /src
parent90e94d4e6cc126a8b7a091d12d7a5556bfe369d5 (diff)
parent6506b8dbfce93f9761999b8d91b182350b64b0ff (diff)
downloadinvidious-eb2dfe0ab1c8294281ab898d158a98e533432750.tar.gz
invidious-eb2dfe0ab1c8294281ab898d158a98e533432750.tar.bz2
invidious-eb2dfe0ab1c8294281ab898d158a98e533432750.zip
Ameba: i18next.cr fixes (#4806)
Related to issue 2231
Diffstat (limited to 'src')
-rw-r--r--src/invidious/helpers/i18next.cr17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/invidious/helpers/i18next.cr b/src/invidious/helpers/i18next.cr
index 9f4077e1..684e6d14 100644
--- a/src/invidious/helpers/i18next.cr
+++ b/src/invidious/helpers/i18next.cr
@@ -95,7 +95,6 @@ module I18next::Plurals
"hr" => PluralForms::Special_Hungarian_Serbian,
"it" => PluralForms::Special_Spanish_Italian,
"pt" => PluralForms::Special_French_Portuguese,
- "pt" => PluralForms::Special_French_Portuguese,
"sr" => PluralForms::Special_Hungarian_Serbian,
}
@@ -189,7 +188,7 @@ module I18next::Plurals
# Emulate the `rule.numbers.size == 2 && rule.numbers[0] == 1` check
# from original i18next code
- private def is_simple_plural(form : PluralForms) : Bool
+ private def simple_plural?(form : PluralForms) : Bool
case form
when .single_gt_one? then return true
when .single_not_one? then return true
@@ -211,7 +210,7 @@ module I18next::Plurals
idx = SuffixIndex.get_index(plural_form, count)
# Simple plurals are handled differently in all versions (but v4)
- if @simplify_plural_suffix && is_simple_plural(plural_form)
+ if @simplify_plural_suffix && simple_plural?(plural_form)
return (idx == 1) ? "_plural" : ""
end
@@ -262,9 +261,9 @@ module I18next::Plurals
when .special_hebrew? then return special_hebrew(count)
when .special_odia? then return special_odia(count)
# Mixed v3/v4 forms
- when .special_spanish_italian? then return special_cldr_Spanish_Italian(count)
- when .special_french_portuguese? then return special_cldr_French_Portuguese(count)
- when .special_hungarian_serbian? then return special_cldr_Hungarian_Serbian(count)
+ when .special_spanish_italian? then return special_cldr_spanish_italian(count)
+ when .special_french_portuguese? then return special_cldr_french_portuguese(count)
+ when .special_hungarian_serbian? then return special_cldr_hungarian_serbian(count)
else
# default, if nothing matched above
return 0_u8
@@ -535,7 +534,7 @@ module I18next::Plurals
#
# This rule is mostly compliant to CLDR v42
#
- def self.special_cldr_Spanish_Italian(count : Int) : UInt8
+ def self.special_cldr_spanish_italian(count : Int) : UInt8
return 0_u8 if (count == 1) # one
return 1_u8 if (count != 0 && count % 1_000_000 == 0) # many
return 2_u8 # other
@@ -545,7 +544,7 @@ module I18next::Plurals
#
# This rule is mostly compliant to CLDR v42
#
- def self.special_cldr_French_Portuguese(count : Int) : UInt8
+ def self.special_cldr_french_portuguese(count : Int) : UInt8
return 0_u8 if (count == 0 || count == 1) # one
return 1_u8 if (count % 1_000_000 == 0) # many
return 2_u8 # other
@@ -555,7 +554,7 @@ module I18next::Plurals
#
# This rule is mostly compliant to CLDR v42
#
- def self.special_cldr_Hungarian_Serbian(count : Int) : UInt8
+ def self.special_cldr_hungarian_serbian(count : Int) : UInt8
n_mod_10 = count % 10
n_mod_100 = count % 100