Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rtl): Sync list of RTL languages with server backend #801

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 7 additions & 30 deletions lib/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,40 +33,17 @@ export function getLanguage(): string {
export function isRTL(language?: string): boolean {
const languageCode = language || getLanguage()

// Source: https://meta.wikimedia.org/wiki/Template:List_of_language_names_ordered_by_code
const rtlLanguages = [
/* eslint-disable no-multi-spaces */
'ae', // Avestan
'ar', // 'العربية', Arabic
'arc', // Aramaic
'arz', // 'مصرى', Egyptian
'bcc', // 'بلوچی مکرانی', Southern Balochi
'bqi', // 'بختياري', Bakthiari
'ckb', // 'Soranî / کوردی', Sorani
'dv', // Dhivehi
'fa', // 'فارسی', Persian
'glk', // 'گیلکی', Gilaki
'ha', // 'هَوُسَ', Hausa
'he', // 'עברית', Hebrew
'khw', // 'کھوار', Khowar
'ks', // 'कॉशुर / کٲشُر', Kashmiri
'ku', // 'Kurdî / كوردی', Kurdish
'mzn', // 'مازِرونی', Mazanderani
'nqo', // 'ߒߞߏ', N’Ko
'pnb', // 'پنجابی', Western Punjabi
'ps', // 'پښتو', Pashto,
'sd', // 'سنڌي', Sindhi
'ug', // 'Uyghurche / ئۇيغۇرچە', Uyghur
'ur', // 'اردو', Urdu
'uzs', // 'اوزبیکی', Uzbek Afghan
'yi', // 'ייִדיש', Yiddish
'ar', // Arabic
'fa', // Persian
'he', // Hebrew
'ps', // Pashto,
'ug', // 'Uyghurche / Uyghur
'ur_PK', // Urdu
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will never be the case as the lang tag on the HTML element which we use to set the language only allows BCP47.
Meaning it must be ur-PK.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'uz', // Uzbek Afghan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats wrong, 'uz' is Uzbek which is LTR using latin script.
What you mean is uz_AF which is the afghan dialect writtin RTL.

/* eslint-enable no-multi-spaces */
]

// special case for Uzbek Afghan
if ((language || getCanonicalLocale()).startsWith('uz-AF')) {
return true
}

return rtlLanguages.includes(languageCode)
}
Loading