Service Worker: Extract messages to own module.

This commit is contained in:
lain 2020-06-16 13:27:36 +02:00
parent 1e57adf6d4
commit 14540e2a07
2 changed files with 36 additions and 31 deletions

View file

@ -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

View file

@ -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({