mirror of
https://github.com/iv-org/invidious.git
synced 2024-12-22 08:09:51 +05:30
i18n: Apply code review suggestions + code cleaning
This commit is contained in:
parent
37c953e633
commit
eb7e79fdf7
@ -131,14 +131,13 @@ def translate_count(locale : String, key : String, count : Int, format = NumberF
|
|||||||
|
|
||||||
if LOCALES[locale].has_key?(key + singular_suffix)
|
if LOCALES[locale].has_key?(key + singular_suffix)
|
||||||
translation = LOCALES[locale][key + singular_suffix].as_s
|
translation = LOCALES[locale][key + singular_suffix].as_s
|
||||||
else
|
elsif locale != "en-US"
|
||||||
# Try #2: Fallback to english (or return key we're already in english)
|
# Try #2: Fallback to english
|
||||||
if locale == "en-US"
|
|
||||||
LOGGER.warn("i18n: Missing translation key \"#{key}\"")
|
|
||||||
return key
|
|
||||||
end
|
|
||||||
|
|
||||||
translation = translate_count("en-US", key, count)
|
translation = translate_count("en-US", key, count)
|
||||||
|
else
|
||||||
|
# Return key if we're already in english, as the tranlation is missing
|
||||||
|
LOGGER.warn("i18n: Missing translation key \"#{key}\"")
|
||||||
|
return key
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -139,10 +139,7 @@ module I18next::Plurals
|
|||||||
self.init_rules
|
self.init_rules
|
||||||
end
|
end
|
||||||
|
|
||||||
def init_rules # : Hash(String, PluralForms)
|
def init_rules
|
||||||
# Init
|
|
||||||
# forms = {} of String => PluralForms
|
|
||||||
|
|
||||||
# Look into sets
|
# Look into sets
|
||||||
PLURAL_SETS.each do |form, langs|
|
PLURAL_SETS.each do |form, langs|
|
||||||
langs.each { |lang| self.forms[lang] = form }
|
langs.each { |lang| self.forms[lang] = form }
|
||||||
|
Loading…
Reference in New Issue
Block a user