-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sheepzh
committed
Oct 17, 2023
1 parent
d94a1dc
commit daf7741
Showing
2 changed files
with
15 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
// Bug of chrome: | ||
// chrome.i18n.getUILanguage may not work in background | ||
export function getUILanguage(): string { | ||
return chrome.i18n.getUILanguage() | ||
return chrome?.i18n?.getUILanguage?.() | ||
} | ||
|
||
// Bug of chrome: | ||
// Bug of chrome: | ||
// chrome.i18n.getMessage may not work in background | ||
// @see https://stackoverflow.com/questions/6089707/calling-chrome-i18n-getmessage-from-a-content-script | ||
export function getMessage(messageName: string): string { | ||
return chrome.i18n.getMessage(messageName) | ||
} | ||
export const getMessage: (key: string) => string = chrome?.i18n?.getMessage |
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