mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-03-17 07:10:37 -05:00
41 lines
793 B
Vue
41 lines
793 B
Vue
<script>
|
|
import { mergeLocale } from '../i18n'
|
|
|
|
import LOCALES from '../graphql/locales.gql'
|
|
import LOCALE_ADDED from '../graphql/localeAdded.gql'
|
|
|
|
export default {
|
|
apollo: {
|
|
locales: {
|
|
query: LOCALES,
|
|
fetchPolicy: 'no-cache',
|
|
manual: true,
|
|
result ({ data: { locales } }) {
|
|
locales.forEach(this.loadLocale)
|
|
}
|
|
},
|
|
|
|
$subscribe: {
|
|
localeAdded: {
|
|
query: LOCALE_ADDED,
|
|
result ({ data }) {
|
|
this.loadLocale(data.localeAdded)
|
|
}
|
|
}
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
loadLocale (locale) {
|
|
// eslint-disable-next-line no-console
|
|
console.log(`[UI] Locale ${locale.lang} updated with new strings`)
|
|
mergeLocale(locale.lang, locale.strings)
|
|
}
|
|
},
|
|
|
|
render () {
|
|
return null
|
|
}
|
|
}
|
|
</script>
|