MCPcopy
hub / github.com/darkreader/darkreader / getUILanguage

Function getUILanguage

src/utils/locales.ts:5–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3}
4
5export function getUILanguage(): string {
6 let code: string;
7 if ('i18n' in chrome && 'getUILanguage' in chrome.i18n && typeof chrome.i18n.getUILanguage === 'function') {
8 code = chrome.i18n.getUILanguage();
9 } else {
10 // Background service workers do not have access to "foreground" APIs like chrome.i18n
11 code = navigator.language.split('-')[0];
12 }
13 if (code.endsWith('-mac')) {
14 return code.substring(0, code.length - 4);
15 }
16 return code;
17}

Callers 2

getHelpURLFunction · 0.90
NewsGroupFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected