feat: add localization to admin nav + locale sections

This commit is contained in:
NGPixel
2018-06-17 17:29:19 -04:00
parent 4b0428212d
commit 99d7078c2c
12 changed files with 136 additions and 63 deletions

View File

@@ -3,10 +3,11 @@ import i18nextXHR from 'i18next-xhr-backend'
import i18nextCache from 'i18next-localstorage-cache'
import VueI18Next from '@panter/vue-i18next'
import _ from 'lodash'
import gql from 'graphql-tag'
/* global siteConfig, graphQL */
import localeQuery from 'gql/common-locale-query.gql'
module.exports = {
VueI18Next,
init() {
@@ -20,14 +21,7 @@ module.exports = {
ajax: (url, opts, cb, data) => {
let langParams = url.split('/')
graphQL.query({
query: gql`
query($locale: String!, $namespace: String!) {
translations(locale:$locale, namespace:$namespace) {
key
value
}
}
`,
query: localeQuery,
variables: {
locale: langParams[0],
namespace: langParams[1]