()
| 3 | } |
| 4 | |
| 5 | export 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 | } |
no outgoing calls
no test coverage detected