diff --git a/webextensions/common/common.js b/webextensions/common/common.js index ac2349651..fbbdb80a7 100644 --- a/webextensions/common/common.js +++ b/webextensions/common/common.js @@ -126,13 +126,30 @@ export const obsoleteConfigs = new Set(mapAndFilter(` return key && key.indexOf('//') != 0 && key; })); + const RTL_LANGUAGES = new Set([ 'ar', 'he', 'fa', 'ur', + 'ps', + 'sd', + 'ckb', + 'prs', + 'rhg', ]); +export function isRTL() { + const lang = ( + navigator.language || + navigator.userLanguage || + //(new Intl.DateTimeFormat()).resolvedOptions().locale || + '' + ).split('-')[0]; + return RTL_LANGUAGES.has(lang); +} + + export const configs = new Configs({ optionsExpandedSections: [ 'section-appearance', @@ -1209,13 +1226,3 @@ export function isMacOS() { export function isWindows() { return configs.enableWindowsBehaviors || /^Win/i.test(navigator.platform); } - -export function isRTL() { - const lang = ( - navigator.language || - navigator.userLanguage || - //(new Intl.DateTimeFormat()).resolvedOptions().locale || - '' - ).split('-')[0]; - return RTL_LANGUAGES.has(lang); -}