Files
SymphonyElectron/js/translation/i18n.js
Vishwas Shashidhar a26a1d609c ELECTRON-519: support Japanese localization for menus, dialogs and windows (#401)
- 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
2018-06-19 20:26:04 +05:30

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
};