feat: add i18n setup to all preloaders

pull/3206/head
Ryan Miller 7 months ago
parent 5717876b22
commit 90d3158ba7

@ -7,13 +7,12 @@ const os = require('os');
const { setupI18n } = require('./ts/util/i18n/i18n');
const config = url.parse(window.location.toString(), true).query;
const { locale } = config;
const localeMessages = ipcRenderer.sendSync('locale-data');
const { dictionary, locale } = ipcRenderer.sendSync('locale-data');
window.theme = config.theme;
window.i18n = setupI18n({
locale,
translationDictionary: localeMessages,
translationDictionary: dictionary,
});
window.getOSRelease = () =>

@ -6,13 +6,15 @@ const url = require('url');
const { setupI18n } = require('./ts/util/i18n/i18n');
const config = url.parse(window.location.toString(), true).query;
const { locale } = config;
const localeMessages = ipcRenderer.sendSync('locale-data');
const { dictionary, locale } = ipcRenderer.sendSync('locale-data');
// If the app is locked we can't access the database to check the theme.
window.theme = 'classic-dark';
window.primaryColor = 'green';
window.i18n = setupI18n({ locale, translationDictionary: localeMessages });
window.i18n = setupI18n({
locale,
translationDictionary: dictionary,
});
window.getEnvironment = () => config.environment;
window.getVersion = () => config.version;

@ -1,5 +1,5 @@
// eslint:disable: no-require-imports no-var-requires
const { clipboard, ipcRenderer, webFrame } = require('electron/main');
const { clipboard, ipcRenderer: ipc, webFrame } = require('electron/main');
const { Storage } = require('./ts/util/storage');
const { isTestNet, isTestIntegration } = require('./ts/shared/env_vars');
@ -9,9 +9,15 @@ const url = require('url');
const _ = require('lodash');
const { setupI18n } = require('./ts/util/i18n/i18n');
const { dictionary, locale } = ipc.sendSync('locale-data');
const config = url.parse(window.location.toString(), true).query;
const configAny = config;
window.i18n = setupI18n({ locale, translationDictionary: dictionary });
let title = config.name;
if (config.environment !== 'production') {
title += ` - ${config.environment}`;
@ -29,7 +35,7 @@ window.getCommitHash = () => configAny.commitHash;
window.getNodeVersion = () => configAny.node_version;
window.getOSRelease = () =>
`${os.type()} ${os.release()}, Node.js ${config.node_version} ${os.platform()} ${os.arch()}`;
window.saveLog = additionalText => ipcRenderer.send('save-debug-log', additionalText);
window.saveLog = additionalText => ipc.send('save-debug-log', additionalText);
window.sessionFeatureFlags = {
useOnionRequests: true,
@ -53,9 +59,6 @@ window.versionInfo = {
appInstance: window.getAppInstance(),
};
const ipc = ipcRenderer;
const localeMessages = ipc.sendSync('locale-data');
window.updateZoomFactor = () => {
const zoomFactor = window.getSettingValue('zoom-factor-setting') || 100;
window.setZoomFactor(zoomFactor / 100);
@ -236,7 +239,6 @@ if (config.proxyUrl) {
window.nodeSetImmediate = setImmediate;
const data = require('./ts/data/dataInit');
const { setupI18n } = require('./ts/util/i18n/i18n');
window.Signal = data.initData();
const { getConversationController } = require('./ts/session/conversations/ConversationController');
@ -258,9 +260,6 @@ window.getSeedNodeList = () =>
'https://seed3.getsession.org:4443/',
];
const { locale } = config;
window.i18n = setupI18n({ locale, translationDictionary: localeMessages });
window.addEventListener('contextmenu', e => {
const editable = e && e.target.closest('textarea, input, [contenteditable="true"]');
const link = e && e.target.closest('a');

Loading…
Cancel
Save