Adrià Vilanova MartÃnez | c14e44a | 2023-03-09 19:28:03 +0100 | [diff] [blame] | 1 | import MainWorldContentScriptBridgeClient from '../mainWorldContentScriptBridge/Client.js'; |
| 2 | |
| 3 | import {kCSTarget, kMWTarget} from './consts.js'; |
| 4 | |
| 5 | // Main World i18n client (used in scripts injected into the Main World (MW) to |
| 6 | // use the chrome.i18n API). |
| 7 | export default class MWI18nClient extends MainWorldContentScriptBridgeClient { |
| 8 | constructor(timeout) { |
| 9 | super(kCSTarget, kMWTarget, timeout); |
| 10 | } |
| 11 | |
| 12 | async getMessage(messageName, substitutions, options) { |
| 13 | return this._sendRequest( |
| 14 | 'getMessage', {messageName, substitutions, options}); |
| 15 | } |
| 16 | |
| 17 | async getUILanguage() { |
| 18 | return this._sendRequest('getUILanguage', {}); |
| 19 | } |
| 20 | } |