mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-13 22:00:33 +05:30
Locales: Fix broken i18Next v3/v4 plurals
Languages impacted: es, fa, pt
This commit is contained in:
parent
d1dddc1adc
commit
60f6a345d9
@ -17,7 +17,7 @@ FORM_TESTS = {
|
|||||||
"cy" => I18next::Plurals::PluralForms::Special_Welsh,
|
"cy" => I18next::Plurals::PluralForms::Special_Welsh,
|
||||||
"fr" => I18next::Plurals::PluralForms::Special_French_Portuguese,
|
"fr" => I18next::Plurals::PluralForms::Special_French_Portuguese,
|
||||||
"en" => I18next::Plurals::PluralForms::Single_not_one,
|
"en" => I18next::Plurals::PluralForms::Single_not_one,
|
||||||
"es" => I18next::Plurals::PluralForms::Single_not_one,
|
"es" => I18next::Plurals::PluralForms::Special_Spanish_Italian,
|
||||||
"ga" => I18next::Plurals::PluralForms::Special_Irish,
|
"ga" => I18next::Plurals::PluralForms::Special_Irish,
|
||||||
"gd" => I18next::Plurals::PluralForms::Special_Scottish_Gaelic,
|
"gd" => I18next::Plurals::PluralForms::Special_Scottish_Gaelic,
|
||||||
"he" => I18next::Plurals::PluralForms::Special_Hebrew,
|
"he" => I18next::Plurals::PluralForms::Special_Hebrew,
|
||||||
@ -33,7 +33,8 @@ FORM_TESTS = {
|
|||||||
"mt" => I18next::Plurals::PluralForms::Special_Maltese,
|
"mt" => I18next::Plurals::PluralForms::Special_Maltese,
|
||||||
"or" => I18next::Plurals::PluralForms::Special_Odia,
|
"or" => I18next::Plurals::PluralForms::Special_Odia,
|
||||||
"pl" => I18next::Plurals::PluralForms::Special_Polish_Kashubian,
|
"pl" => I18next::Plurals::PluralForms::Special_Polish_Kashubian,
|
||||||
"pt" => I18next::Plurals::PluralForms::Single_gt_one,
|
"pt" => I18next::Plurals::PluralForms::Special_French_Portuguese,
|
||||||
|
"pt-PT" => I18next::Plurals::PluralForms::Single_gt_one,
|
||||||
"pt-BR" => I18next::Plurals::PluralForms::Special_French_Portuguese,
|
"pt-BR" => I18next::Plurals::PluralForms::Special_French_Portuguese,
|
||||||
"ro" => I18next::Plurals::PluralForms::Special_Romanian,
|
"ro" => I18next::Plurals::PluralForms::Special_Romanian,
|
||||||
"sk" => I18next::Plurals::PluralForms::Special_Czech_Slovak,
|
"sk" => I18next::Plurals::PluralForms::Special_Czech_Slovak,
|
||||||
@ -77,10 +78,10 @@ SUFFIX_TESTS = {
|
|||||||
{num: 10, suffix: "_plural"},
|
{num: 10, suffix: "_plural"},
|
||||||
],
|
],
|
||||||
"es" => [
|
"es" => [
|
||||||
{num: 0, suffix: "_plural"},
|
{num: 0, suffix: "_2"},
|
||||||
{num: 1, suffix: ""},
|
{num: 1, suffix: "_0"},
|
||||||
{num: 10, suffix: "_plural"},
|
{num: 10, suffix: "_2"},
|
||||||
{num: 6_000_000, suffix: "_plural"},
|
{num: 6_000_000, suffix: "_1"},
|
||||||
],
|
],
|
||||||
"fr" => [
|
"fr" => [
|
||||||
{num: 0, suffix: "_0"},
|
{num: 0, suffix: "_0"},
|
||||||
|
@ -47,19 +47,19 @@ module I18next::Plurals
|
|||||||
|
|
||||||
private PLURAL_SETS = {
|
private PLURAL_SETS = {
|
||||||
PluralForms::Single_gt_one => [
|
PluralForms::Single_gt_one => [
|
||||||
"ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg",
|
"ach", "ak", "am", "arn", "br", "fa", "fil", "gun", "ln", "mfe", "mg",
|
||||||
"mi", "oc", "pt", "tg", "tl", "ti", "tr", "uz", "wa",
|
"mi", "oc", "pt-PT", "tg", "tl", "ti", "tr", "uz", "wa",
|
||||||
],
|
],
|
||||||
PluralForms::Single_not_one => [
|
PluralForms::Single_not_one => [
|
||||||
"af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en",
|
"af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en",
|
||||||
"eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi",
|
"eo", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi",
|
||||||
"hu", "hy", "ia", "kk", "kn", "ku", "lb", "mai", "ml", "mn", "mr",
|
"hu", "hy", "ia", "kk", "kn", "ku", "lb", "mai", "ml", "mn", "mr",
|
||||||
"nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms",
|
"nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms",
|
||||||
"ps", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw",
|
"ps", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw",
|
||||||
"ta", "te", "tk", "ur", "yo",
|
"ta", "te", "tk", "ur", "yo",
|
||||||
],
|
],
|
||||||
PluralForms::None => [
|
PluralForms::None => [
|
||||||
"ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "km", "ko", "ky",
|
"ay", "bo", "cgg", "ht", "id", "ja", "jbo", "ka", "km", "ko", "ky",
|
||||||
"lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh",
|
"lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh",
|
||||||
],
|
],
|
||||||
PluralForms::Dual_Slavic => [
|
PluralForms::Dual_Slavic => [
|
||||||
@ -90,11 +90,13 @@ module I18next::Plurals
|
|||||||
"sk" => PluralForms::Special_Czech_Slovak,
|
"sk" => PluralForms::Special_Czech_Slovak,
|
||||||
"sl" => PluralForms::Special_Slovenian,
|
"sl" => PluralForms::Special_Slovenian,
|
||||||
# Mixed v3/v4 rules
|
# Mixed v3/v4 rules
|
||||||
"fr" => PluralForms::Special_French_Portuguese,
|
"es" => PluralForms::Special_Spanish_Italian,
|
||||||
"hr" => PluralForms::Special_Hungarian_Serbian,
|
"fr" => PluralForms::Special_French_Portuguese,
|
||||||
"it" => PluralForms::Special_Spanish_Italian,
|
"hr" => PluralForms::Special_Hungarian_Serbian,
|
||||||
"pt-BR" => PluralForms::Special_French_Portuguese,
|
"it" => PluralForms::Special_Spanish_Italian,
|
||||||
"sr" => PluralForms::Special_Hungarian_Serbian,
|
"pt" => PluralForms::Special_French_Portuguese,
|
||||||
|
"pt" => PluralForms::Special_French_Portuguese,
|
||||||
|
"sr" => PluralForms::Special_Hungarian_Serbian,
|
||||||
}
|
}
|
||||||
|
|
||||||
# These are the v1 and v2 compatible suffixes.
|
# These are the v1 and v2 compatible suffixes.
|
||||||
@ -165,7 +167,7 @@ module I18next::Plurals
|
|||||||
|
|
||||||
def get_plural_form(locale : String) : PluralForms
|
def get_plural_form(locale : String) : PluralForms
|
||||||
# Extract the ISO 639-1 or 639-2 code from an RFC 5646 language code
|
# Extract the ISO 639-1 or 639-2 code from an RFC 5646 language code
|
||||||
if !locale.matches?(/^pt-BR$/)
|
if !locale.matches?(/^pt-PT$/)
|
||||||
locale = locale.split('-')[0]
|
locale = locale.split('-')[0]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user