This repository has been archived by the owner on Apr 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #797 from LiskHQ/768-electron-menu-i18n
Implement i18n for electron wrapper menu - Closes #768
- Loading branch information
Showing
11 changed files
with
273 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import i18n from 'i18next'; // eslint-disable-line import/no-extraneous-dependencies | ||
import languages from './languages'; | ||
|
||
const resources = Object.keys(languages).reduce((accumulator, key) => { | ||
accumulator[key] = { | ||
common: languages[key].common, | ||
}; | ||
return accumulator; | ||
}, {}); | ||
|
||
i18n | ||
.init({ | ||
fallbackLng: 'en', | ||
resources, | ||
lang: 'en', | ||
ns: ['common'], | ||
defaultNS: 'common', | ||
saveMissing: true, | ||
debug: false, | ||
}, (err, t) => { | ||
t('key'); | ||
// initialized and ready to go! | ||
console.log(`Current language used: ${i18n.language}`); //eslint-disable-line | ||
}); | ||
|
||
export default i18n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const languages = { | ||
en: { | ||
name: 'English', | ||
common: require('../build/locales/en/common.json'), | ||
}, | ||
de: { | ||
name: 'Deutsch', | ||
common: require('../build/locales/de/common.json'), | ||
}, | ||
}; | ||
|
||
export default languages; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.