I18n: Add a function to determine if a given locale is RTL

pull/3763/head
Samantaz Fox 2 years ago
parent 93559cbdd5
commit 648928767c
No known key found for this signature in database
GPG Key ID: F42821059186176E

@ -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…
Cancel
Save