From c3f7972b5413925363a72809a924fb79972178c4 Mon Sep 17 00:00:00 2001 From: Gregor MacLennan Date: Tue, 24 May 2022 08:52:55 +0100 Subject: [PATCH] fix: include french translations in build --- src/main/i18n.js | 13 +++++++++++-- src/renderer/app.js | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/i18n.js b/src/main/i18n.js index 4b2ee1fcf..b2d6aa380 100644 --- a/src/main/i18n.js +++ b/src/main/i18n.js @@ -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'), @@ -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 { @@ -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] diff --git a/src/renderer/app.js b/src/renderer/app.js index fbd329510..4bb6b3fb6 100644 --- a/src/renderer/app.js +++ b/src/renderer/app.js @@ -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'),