[MM-14058] Add support for i18n (#2190)

* Add language files

* Add react-intl, mmjstool, setup for adding translations

* Translated main module

* Translations for renderer

* A few minor fixes

* More fixes

* Add CI, add missing menu translations, other cleanup

* Added setting to manually select the language of the app

* Force English for E2e

* Unit tests

* Fix mmjstool

* Move set language to before update menu

* PR feedback
This commit is contained in:
Devin Binnie
2022-07-14 11:04:18 -04:00
committed by GitHub
parent 22c97591d5
commit 59e4e7e516
92 changed files with 3554 additions and 2375 deletions

View File

@@ -47,6 +47,7 @@ import {setupBadge} from 'main/badge';
import CertificateManager from 'main/certificateManager';
import {updatePaths} from 'main/constants';
import CriticalErrorHandler from 'main/CriticalErrorHandler';
import i18nManager, {localizeMessage} from 'main/i18nManager';
import {displayDownloadCompleted} from 'main/notifications';
import parseArgs from 'main/ParseArgs';
import TrustedOriginsStore from 'main/trustedOrigins';
@@ -359,7 +360,7 @@ function initializeAfterAppReady() {
const filters = [];
if (fileElements.length > 1) {
filters.push({
name: 'All files',
name: localizeMessage('main.app.initialize.downloadBox.allFiles', 'All files'),
extensions: ['*'],
});
}
@@ -376,6 +377,14 @@ function initializeAfterAppReady() {
});
});
// needs to be done after app ready
// must be done before update menu
if (Config.appLanguage) {
i18nManager.setLocale(Config.appLanguage);
} else if (!i18nManager.setLocale(app.getLocale())) {
i18nManager.setLocale(app.getLocaleCountryCode());
}
handleUpdateMenuEvent();
ipcMain.emit('update-dict');