feat: admin - download locale strings from graph

This commit is contained in:
NGPixel
2018-05-06 23:21:48 -04:00
parent 9f8feb6540
commit ba6b4bc4dd
8 changed files with 139 additions and 14 deletions

View File

@@ -41,14 +41,17 @@ module.exports = async (job) => {
if (WIKI.config.site.langAutoUpdate) {
const respStrings = await apollo({
query: `{
query: `query ($code: String!) {
localization {
strings(code: "${WIKI.config.site.lang}") {
strings(code: $code) {
key
value
}
}
}`
}`,
variables: {
code: WIKI.config.site.lang
}
})
const strings = _.get(respStrings, 'data.localization.strings', [])
let lcObj = {}
@@ -57,7 +60,7 @@ module.exports = async (job) => {
_.set(lcObj, row.key.replace(':', '.'), row.value)
})
WIKI.db.Locale.upsert({
await WIKI.db.Locale.upsert({
code: WIKI.config.site.lang,
strings: lcObj,
isRTL: currentLocale.isRTL,