-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing telemetry fields (#1863)
- Loading branch information
Showing
4 changed files
with
63 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
extension-manifest-v3/src/background/telemetry/language.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* Ghostery Browser Extension | ||
* https://www.ghostery.com/ | ||
* | ||
* Copyright 2017-present Ghostery GmbH. All rights reserved. | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0 | ||
*/ | ||
|
||
const SUPPORTED_LANGUAGES = new Set([ | ||
'de', | ||
'en', | ||
'es', | ||
'fr', | ||
'hu', | ||
'it', | ||
'ja', | ||
'ko', | ||
'nl', | ||
'pl', | ||
'pt_BR', | ||
'ru', | ||
'zh_CN', | ||
'zh_TW', | ||
]); | ||
|
||
export default function getDefaultLanguage() { | ||
let lang = navigator.language.replace('-', '_'); | ||
|
||
if (SUPPORTED_LANGUAGES.has(lang)) { | ||
return lang; | ||
} | ||
|
||
lang = lang.slice(0, 2); | ||
|
||
if (SUPPORTED_LANGUAGES.has(lang)) { | ||
return lang; | ||
} | ||
|
||
return 'en'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters