diff --git a/src/i18n/service_worker_messages.js b/src/i18n/service_worker_messages.js new file mode 100644 index 0000000000..270ed043c5 --- /dev/null +++ b/src/i18n/service_worker_messages.js @@ -0,0 +1,35 @@ +/* eslint-disable import/no-webpack-loader-syntax */ +// This module exports only the notification part of the i18n, +// which is useful for the service worker + +const messages = { + ar: require('../lib/notification-i18n-loader.js!./ar.json'), + ca: require('../lib/notification-i18n-loader.js!./ca.json'), + cs: require('../lib/notification-i18n-loader.js!./cs.json'), + de: require('../lib/notification-i18n-loader.js!./de.json'), + eo: require('../lib/notification-i18n-loader.js!./eo.json'), + es: require('../lib/notification-i18n-loader.js!./es.json'), + et: require('../lib/notification-i18n-loader.js!./et.json'), + eu: require('../lib/notification-i18n-loader.js!./eu.json'), + fi: require('../lib/notification-i18n-loader.js!./fi.json'), + fr: require('../lib/notification-i18n-loader.js!./fr.json'), + ga: require('../lib/notification-i18n-loader.js!./ga.json'), + he: require('../lib/notification-i18n-loader.js!./he.json'), + hu: require('../lib/notification-i18n-loader.js!./hu.json'), + it: require('../lib/notification-i18n-loader.js!./it.json'), + ja: require('../lib/notification-i18n-loader.js!./ja_pedantic.json'), + ja_easy: require('../lib/notification-i18n-loader.js!./ja_easy.json'), + ko: require('../lib/notification-i18n-loader.js!./ko.json'), + nb: require('../lib/notification-i18n-loader.js!./nb.json'), + nl: require('../lib/notification-i18n-loader.js!./nl.json'), + oc: require('../lib/notification-i18n-loader.js!./oc.json'), + pl: require('../lib/notification-i18n-loader.js!./pl.json'), + pt: require('../lib/notification-i18n-loader.js!./pt.json'), + ro: require('../lib/notification-i18n-loader.js!./ro.json'), + ru: require('../lib/notification-i18n-loader.js!./ru.json'), + te: require('../lib/notification-i18n-loader.js!./te.json'), + zh: require('../lib/notification-i18n-loader.js!./zh.json'), + en: require('../lib/notification-i18n-loader.js!./en.json') +} + +export default messages diff --git a/src/sw.js b/src/sw.js index 6e31516a80..c971222ed9 100644 --- a/src/sw.js +++ b/src/sw.js @@ -1,41 +1,11 @@ /* eslint-env serviceworker */ -/* eslint-disable import/no-webpack-loader-syntax */ import localForage from 'localforage' import { parseNotification } from './services/entity_normalizer/entity_normalizer.service.js' import { prepareNotificationObject } from './services/notification_utils/notification_utils.js' import Vue from 'vue' import VueI18n from 'vue-i18n' - -const messages = { - ar: require('./lib/notification-i18n-loader.js!./i18n/ar.json'), - ca: require('./lib/notification-i18n-loader.js!./i18n/ca.json'), - cs: require('./lib/notification-i18n-loader.js!./i18n/cs.json'), - de: require('./lib/notification-i18n-loader.js!./i18n/de.json'), - eo: require('./lib/notification-i18n-loader.js!./i18n/eo.json'), - es: require('./lib/notification-i18n-loader.js!./i18n/es.json'), - et: require('./lib/notification-i18n-loader.js!./i18n/et.json'), - eu: require('./lib/notification-i18n-loader.js!./i18n/eu.json'), - fi: require('./lib/notification-i18n-loader.js!./i18n/fi.json'), - fr: require('./lib/notification-i18n-loader.js!./i18n/fr.json'), - ga: require('./lib/notification-i18n-loader.js!./i18n/ga.json'), - he: require('./lib/notification-i18n-loader.js!./i18n/he.json'), - hu: require('./lib/notification-i18n-loader.js!./i18n/hu.json'), - it: require('./lib/notification-i18n-loader.js!./i18n/it.json'), - ja: require('./lib/notification-i18n-loader.js!./i18n/ja_pedantic.json'), - ja_easy: require('./lib/notification-i18n-loader.js!./i18n/ja_easy.json'), - ko: require('./lib/notification-i18n-loader.js!./i18n/ko.json'), - nb: require('./lib/notification-i18n-loader.js!./i18n/nb.json'), - nl: require('./lib/notification-i18n-loader.js!./i18n/nl.json'), - oc: require('./lib/notification-i18n-loader.js!./i18n/oc.json'), - pl: require('./lib/notification-i18n-loader.js!./i18n/pl.json'), - pt: require('./lib/notification-i18n-loader.js!./i18n/pt.json'), - ro: require('./lib/notification-i18n-loader.js!./i18n/ro.json'), - ru: require('./lib/notification-i18n-loader.js!./i18n/ru.json'), - te: require('./lib/notification-i18n-loader.js!./i18n/te.json'), - zh: require('./lib/notification-i18n-loader.js!./i18n/zh.json'), - en: require('./lib/notification-i18n-loader.js!./i18n/en.json') -} +import messages from './i18n/service_worker_messages.js' Vue.use(VueI18n) const i18n = new VueI18n({