@hawkersgroup/parser-shopify-locales
v1.0.6
Published
If you have a line like this:
Downloads
1
Keywords
Readme
Known problems
If you have a line like this:
{{ 'miTexto' | t: username: 'Usuario }}' }}
It crashes!
Dependencies
npm i @brainly/onesky-utils
Usage in gulp task
let gulp = require('gulp');
let parser_locales = require('./index');
const upload_file = require('./upload');
const downloadAndSaveFile = require('./download');
const SKYONE_SECRET = '<YOUR SECRET>';
const SKYONE_API_KEY = '<YOUR API KEY>';
const SKYONE_PROJECT_ID = '<YOUR PROJECT ID>';
const languages = ['es-ES', 'es-PE', 'pt-BR'];
const json_dir_path = './example-src/locales';
const language_base = 'es-ES';
gulp.task('parser', function() {
let filename = language_base + '.json';
let json_path = json_dir_path + '/' + filename;
let options = {
language: language_base,
secret: SKYONE_SECRET,
apiKey: SKYONE_API_KEY,
projectId: SKYONE_PROJECT_ID,
fileName: filename,
format: 'HIERARCHICAL_JSON',
keepStrings: false,
};
gulp
.src('./example-src/**/*.liquid')
.pipe(parser_locales(json_path))
.pipe(gulp.dest(json_dir_path))
.pipe(upload_file(options));
});
gulp.task('downloadLocales', function() {
for (let j = 0; j < languages.length; j++) {
let json_path = json_dir_path + '/' + languages[j] + '.json';
let options = {
language: languages[j],
secret: SKYONE_SECRET,
apiKey: SKYONE_API_KEY,
projectId: SKYONE_PROJECT_ID,
fileName: language_base + '.json',
format: 'HIERARCHICAL_JSON',
};
downloadAndSaveFile(options, json_path);
}
});