mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
- add basic localisation implementation for menu items - add more strings to support localisation on menus - add more strings to support localisation on menus - add all menu items for localisation - refactor i18n code - Add localization for screen picker, basic auth and notification settings child windows - Add localization bridge - add i18n support to more strings - update translations - add events to change language and redo menu template - move config update logic to windowMgr - fix linting issues and refactor - add snipping tool messages
22 lines
577 B
JavaScript
22 lines
577 B
JavaScript
const path = require("path");
|
|
const fs = require('fs');
|
|
let language;
|
|
let loadedTranslations = {};
|
|
|
|
const getMessageFor = function(phrase) {
|
|
let translation = loadedTranslations[phrase];
|
|
if(translation === undefined) {
|
|
translation = phrase;
|
|
}
|
|
return translation;
|
|
};
|
|
|
|
const setLanguage = function(lng) {
|
|
language = lng ? lng : 'en-US';
|
|
loadedTranslations = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '..', 'locale', language + '.json'), 'utf8'));
|
|
};
|
|
|
|
module.exports = {
|
|
setLanguage: setLanguage,
|
|
getMessageFor: getMessageFor
|
|
}; |