mirror of
https://github.com/zulip/zulip-desktop.git
synced 2025-11-03 13:33:18 +00:00
js: Explode singleton classes to modules.
Singleton classes may have a purpose. This was not that purpose. Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Anders Kaseorg
parent
d9f6cf4cc9
commit
220aac2d54
@@ -4,7 +4,6 @@ import path = require('path');
|
||||
import electron = require('electron');
|
||||
import i18n = require('i18n');
|
||||
|
||||
let instance: TranslationUtil = null;
|
||||
let app: Electron.App = null;
|
||||
|
||||
/* To make the util runnable in both main and renderer process */
|
||||
@@ -14,22 +13,10 @@ if (process.type === 'renderer') {
|
||||
app = electron.app;
|
||||
}
|
||||
|
||||
class TranslationUtil {
|
||||
constructor() {
|
||||
if (instance) {
|
||||
return this;
|
||||
}
|
||||
i18n.configure({
|
||||
directory: path.join(__dirname, '../../../translations/')
|
||||
});
|
||||
|
||||
instance = this;
|
||||
i18n.configure({
|
||||
directory: path.join(__dirname, '../../../translations/'),
|
||||
register: this
|
||||
});
|
||||
}
|
||||
|
||||
__(phrase: string): string {
|
||||
return i18n.__({ phrase, locale: app.getLocale() ? app.getLocale() : 'en' });
|
||||
}
|
||||
export function __(phrase: string): string {
|
||||
return i18n.__({ phrase, locale: app.getLocale() ? app.getLocale() : 'en' });
|
||||
}
|
||||
|
||||
export = new TranslationUtil();
|
||||
|
||||
Reference in New Issue
Block a user