mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-03 21:43:18 +00:00
And enable the import/unambiguous ESLint rule as a check on our
partition between scripts and modules. After this commit, if you add
a new file and get this error:
✖ 1:1 This module could be parsed as a valid script. import/unambiguous
* For a module, add an `import` or `export` declaration to make the
file unambiguously a module (the empty `export {};` declaration
suffices).
* For a script, add the file to the xo overrides section of
package.json that marks it "sourceType": "script", and add a 'use
strict' declaration.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
21 lines
484 B
TypeScript
21 lines
484 B
TypeScript
import path from 'path';
|
|
import electron from 'electron';
|
|
import i18n from 'i18n';
|
|
|
|
let app: Electron.App = null;
|
|
|
|
/* To make the util runnable in both main and renderer process */
|
|
if (process.type === 'renderer') {
|
|
app = electron.remote.app;
|
|
} else {
|
|
app = electron.app;
|
|
}
|
|
|
|
i18n.configure({
|
|
directory: path.join(__dirname, '../../../translations/')
|
|
});
|
|
|
|
export function __(phrase: string): string {
|
|
return i18n.__({ phrase, locale: app.getLocale() ? app.getLocale() : 'en' });
|
|
}
|