Skip to content

Commit

Permalink
fix: include french translations in build
Browse files Browse the repository at this point in the history
  • Loading branch information
gmaclennan committed May 24, 2022
1 parent b2d9926 commit c3f7972
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const store = require('../store')
const translations = {
en: require('../../messages/main/en.json'),
es: require('../../messages/main/es.json'),
fr: require('../../messages/main/fr.json'),
pt: require('../../messages/main/pt.json'),
th: require('../../messages/main/th.json'),
vi: require('../../messages/main/vi.json'),
Expand All @@ -14,7 +15,9 @@ const translations = {

// We only support generalized locales for now (i.e., no difference between
// Spanish/Espana and Spanish/Latin America)
function getSystemLocale () { return app.getLocale().substr(0, 2) }
function getSystemLocale () {
return app.getLocale().substr(0, 2)
}

// defaultLocale is the default local of the app, not the user's locale.
class I18n extends EventEmitter {
Expand Down Expand Up @@ -53,7 +56,13 @@ class I18n extends EventEmitter {
}

setLocale (newLocale) {
if (!newLocale || newLocale.length !== 2) return logger.error(new Error('Tried to set locale and failed, must be a 2 character string', newLocale))
if (!newLocale || newLocale.length !== 2)
return logger.error(
new Error(
'Tried to set locale and failed, must be a 2 character string',
newLocale
)
)
logger.info('Changing locale to', newLocale)
this.locale = newLocale
this.genericLocale = newLocale.split('-')[0]
Expand Down
1 change: 1 addition & 0 deletions src/renderer/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const initialLocale = ipcRenderer.sendSync('get-locale') // navigator.language.s
const msgs = {
en: require('../../translations/en.json'),
es: require('../../translations/es.json'),
fr: require('../../translations/fr.json'),
pt: require('../../translations/pt.json'),
vi: require('../../translations/vi.json'),
km: require('../../translations/km.json'),
Expand Down

0 comments on commit c3f7972

Please sign in to comment.