mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2023-06-08.git
synced 2024-08-15 00:53:38 +00:00
I18n: Add a function to determine if a given locale is RTL
This commit is contained in:
parent
bbf16279bb
commit
624dcb103e
1 changed files with 9 additions and 0 deletions
|
@ -165,3 +165,12 @@ def translate_bool(locale : String?, translation : Bool)
|
|||
return translate(locale, "No")
|
||||
end
|
||||
end
|
||||
|
||||
def locale_is_rtl?(locale : String?)
|
||||
# Fallback to en-US
|
||||
return false if locale.nil?
|
||||
|
||||
# Arabic, Persian, Hebrew
|
||||
# See https://en.wikipedia.org/wiki/Right-to-left_script#List_of_RTL_scripts
|
||||
return {"ar", "fa", "he"}.includes? locale
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue