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

このコミットが含まれているのは:
Samantaz Fox 2023-04-18 00:04:49 +02:00
コミット 0ba22ef391
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: F42821059186176E
1個のファイルの変更9行の追加0行の削除

ファイルの表示

@ -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