Add i18n support to the main world

The main world didn't have access to the chrome.i18n API. This CL adds
support to access the API from the main world by using a bridge between
the main world and a server running in a content script.

Bug: twpowertools:157

Change-Id: I5b93f92156e9f658428214252c209570337c23a4
diff --git a/src/common/mainWorldI18n/Client.js b/src/common/mainWorldI18n/Client.js
new file mode 100644
index 0000000..b1b8286
--- /dev/null
+++ b/src/common/mainWorldI18n/Client.js
@@ -0,0 +1,20 @@
+import MainWorldContentScriptBridgeClient from '../mainWorldContentScriptBridge/Client.js';
+
+import {kCSTarget, kMWTarget} from './consts.js';
+
+// Main World i18n client (used in scripts injected into the Main World (MW) to
+// use the chrome.i18n API).
+export default class MWI18nClient extends MainWorldContentScriptBridgeClient {
+  constructor(timeout) {
+    super(kCSTarget, kMWTarget, timeout);
+  }
+
+  async getMessage(messageName, substitutions, options) {
+    return this._sendRequest(
+        'getMessage', {messageName, substitutions, options});
+  }
+
+  async getUILanguage() {
+    return this._sendRequest('getUILanguage', {});
+  }
+}