mirror of
https://github.com/romancm/gamebrary
synced 2025-02-17 11:38:24 +00:00
Moved translate script to build folder and added script to package.json
This commit is contained in:
parent
1387909678
commit
0341bb16c3
2 changed files with 4 additions and 2 deletions
|
@ -2,8 +2,9 @@
|
|||
|
||||
const fs = require('fs');
|
||||
const translate = require('translate-json-object')();
|
||||
const baseJson = require('./en.json');
|
||||
const baseJson = require('../src/i18n/en.json');
|
||||
|
||||
// translate.init({ googleApiKey: 'GOOGLE_API_KEY_HERE' });
|
||||
translate.init({ googleApiKey: 'AIzaSyCknvhooDrmNf9SJ5hdZKPkqR0pntXJ6cU' });
|
||||
|
||||
const supportedLanguages = ['es', 'pl', 'de', 'ar', 'fr', 'it', 'eu', 'cs', 'ja'];
|
||||
|
@ -14,7 +15,7 @@ for (let i = 0, promise = Promise.resolve(); i < supportedLanguages.length; i++)
|
|||
|
||||
translate.translate(baseJson, language)
|
||||
.then((data) => {
|
||||
fs.writeFile(`${language}.json`, JSON.stringify(data, null, 4), () => {
|
||||
fs.writeFile(`src/i18n/${language}.json`, JSON.stringify(data, null, 4), () => {
|
||||
console.log(`Translation to ${language} completed`);
|
||||
resolve();
|
||||
});
|
|
@ -12,6 +12,7 @@
|
|||
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
|
||||
"test": "npm run unit",
|
||||
"lint": "eslint --ext .js,.vue src test/unit",
|
||||
"translate": "node build/translate.js",
|
||||
"build": "node build/build.js",
|
||||
"deploy": "node ./node_modules/vue-gh-pages/index.js"
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue