Skip to content

Commit 567e0c6

Browse files
committed
Add i18n.LangIsRTL func
1 parent 73bffef commit 567e0c6

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

i18n/rtl.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package i18n
2+
3+
var rtlLangs = map[string]bool{
4+
"ar": true, // Arabic
5+
"dv": true, // Divehi
6+
"fa": true, // Persian (Farsi)
7+
"ha": true, // Hausa
8+
"he": true, // Hebrew
9+
"iw": true, // Hebrew (old code)
10+
"ji": true, // Yiddish (old code)
11+
"ps": true, // Pashto, Pushto
12+
"ur": true, // Urdu
13+
"yi": true, // Yiddish
14+
}
15+
16+
func LangIsRTL(lang string) bool {
17+
if _, ok := rtlLangs[lang]; ok {
18+
return true
19+
}
20+
return false
21+
}

0 commit comments

Comments
 (0)