Skip to content

Commit

Permalink
Complete the list of RTL languages
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jan 7, 2025
1 parent 926f81b commit 2112686
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions webextensions/common/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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);
}

0 comments on commit 2112686

Please sign in to comment.