Skip to content
Snippets Groups Projects
Commit fefe3f0c authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[enh] Add i18n JSON check (jsonlint)

[fix] Fix i18n ES json format
parent 5a52b390
No related branches found
No related tags found
No related merge requests found
Pipeline #8892 failed
...@@ -33,7 +33,8 @@ const gulp = require('gulp'), ...@@ -33,7 +33,8 @@ const gulp = require('gulp'),
colors = require('ansi-colors'), colors = require('ansi-colors'),
argv = require('yargs').argv, argv = require('yargs').argv,
sriHash = require('gulp-sri-hash'), sriHash = require('gulp-sri-hash'),
sort = require('gulp-sort'); sort = require('gulp-sort'),
jsonlint = require("@prantlf/gulp-jsonlint");
const paths = { const paths = {
license_md: ['./www/license/*.md'], license_md: ['./www/license/*.md'],
...@@ -160,6 +161,8 @@ function appNgTranslate() { ...@@ -160,6 +161,8 @@ function appNgTranslate() {
log(colors.green('Building App translation file...')); log(colors.green('Building App translation file...'));
return gulp.src('www/i18n/locale-*.json') return gulp.src('www/i18n/locale-*.json')
.pipe(jsonlint())
.pipe(jsonlint.reporter())
.pipe(sort()) .pipe(sort())
.pipe(ngTranslate({standalone:true, module: 'cesium.translations'})) .pipe(ngTranslate({standalone:true, module: 'cesium.translations'}))
.pipe(gulp.dest('www/dist/dist_js/app')); .pipe(gulp.dest('www/dist/dist_js/app'));
...@@ -221,6 +224,8 @@ function pluginNgTranslate() { ...@@ -221,6 +224,8 @@ function pluginNgTranslate() {
log(colors.green('Building Plugins translation file...')); log(colors.green('Building Plugins translation file...'));
return gulp.src(paths.ng_translate_plugin) return gulp.src(paths.ng_translate_plugin)
.pipe(jsonlint())
.pipe(jsonlint.reporter())
.pipe(sort()) .pipe(sort())
.pipe(ngTranslate({standalone:true, module: 'cesium.plugins.translations'})) .pipe(ngTranslate({standalone:true, module: 'cesium.plugins.translations'}))
.pipe(gulp.dest('www/dist/dist_js/plugins')); .pipe(gulp.dest('www/dist/dist_js/plugins'));
...@@ -324,6 +329,8 @@ function webCopyFiles() { ...@@ -324,6 +329,8 @@ function webCopyFiles() {
// Copy i18n // Copy i18n
gulp.src('./www/i18n/locale-*.json') gulp.src('./www/i18n/locale-*.json')
.pipe(jsonlint())
.pipe(jsonlint.reporter())
.pipe(sort()) .pipe(sort())
.pipe(ngTranslate({standalone:true, module: 'cesium.translations'})) .pipe(ngTranslate({standalone:true, module: 'cesium.translations'}))
.pipe(gulp.dest(tmpPath + '/js')), .pipe(gulp.dest(tmpPath + '/js')),
...@@ -336,10 +343,6 @@ function webCopyFiles() { ...@@ -336,10 +343,6 @@ function webCopyFiles() {
gulp.src('./www/manifest.json') gulp.src('./www/manifest.json')
.pipe(gulp.dest(tmpPath)), .pipe(gulp.dest(tmpPath)),
// Copy feed*.json
//gulp.src('./www/feed*.json')
// .pipe(gulp.dest(tmpPath)),
// Copy lib (JS, CSS and fonts) // Copy lib (JS, CSS and fonts)
gulp.src(['./www/lib/**/*.js', './www/lib/**/*.css', './www/lib/**/fonts/**/*.*']) gulp.src(['./www/lib/**/*.js', './www/lib/**/*.css', './www/lib/**/fonts/**/*.*'])
.pipe(gulp.dest(tmpPath + '/lib')), .pipe(gulp.dest(tmpPath + '/lib')),
...@@ -400,6 +403,8 @@ function webPluginCopyFiles() { ...@@ -400,6 +403,8 @@ function webPluginCopyFiles() {
// Transform i18n into JS // Transform i18n into JS
gulp.src(paths.ng_translate_plugin) gulp.src(paths.ng_translate_plugin)
.pipe(jsonlint())
.pipe(jsonlint.reporter())
.pipe(sort()) .pipe(sort())
.pipe(ngTranslate({standalone:true, module: 'cesium.plugins.translations'})) .pipe(ngTranslate({standalone:true, module: 'cesium.plugins.translations'}))
.pipe(gulp.dest(tmpPath + '/dist/dist_js/plugins')), .pipe(gulp.dest(tmpPath + '/dist/dist_js/plugins')),
......
...@@ -109,6 +109,7 @@ ...@@ -109,6 +109,7 @@
"devDependencies": { "devDependencies": {
"@ionic/cli": "^6.7.0", "@ionic/cli": "^6.7.0",
"@ionic/v1-toolkit": "^3.2.0", "@ionic/v1-toolkit": "^3.2.0",
"@prantlf/gulp-jsonlint": "^2.4.0",
"cordova-uglify": "^0.3.4", "cordova-uglify": "^0.3.4",
"del": "^5.1.0", "del": "^5.1.0",
"delete-empty": "^0.1.3", "delete-empty": "^0.1.3",
......
...@@ -1004,4 +1004,4 @@ ...@@ -1004,4 +1004,4 @@
"END_NOT_LOGIN": "¡La visita guiada ha <b>terminado</b>!<br/><br/>Si quiere utilizar la moneda {{currency|capitalize}}, tiene que hacer un clic en <b>{{'LOGIN.CREATE_ACCOUNT'|translate}}</b> más abajo." "END_NOT_LOGIN": "¡La visita guiada ha <b>terminado</b>!<br/><br/>Si quiere utilizar la moneda {{currency|capitalize}}, tiene que hacer un clic en <b>{{'LOGIN.CREATE_ACCOUNT'|translate}}</b> más abajo."
} }
} }
}, }
...@@ -448,6 +448,26 @@ ...@@ -448,6 +448,26 @@
"@nodelib/fs.scandir" "2.1.3" "@nodelib/fs.scandir" "2.1.3"
fastq "^1.6.0" fastq "^1.6.0"
"@prantlf/gulp-jsonlint@^2.4.0":
version "2.4.0"
resolved "https://registry.yarnpkg.com/@prantlf/gulp-jsonlint/-/gulp-jsonlint-2.4.0.tgz#282d468c9b067f98202809274619e4b5d22fe30e"
integrity sha512-13L1ZZShhETd7m5ZIoG4yBNqlOrcf6hNHMU5XhfWs45pSD259Kw/ycwEi23HcthWZfcyLpkxgvciBFKze/bz1w==
dependencies:
"@prantlf/jsonlint" "10.2.0"
ansi-colors "4.1.1"
fancy-log "1.3.3"
map-stream "0.0.7"
plugin-error "1.0.1"
through2 "3.0.1"
"@prantlf/jsonlint@10.2.0":
version "10.2.0"
resolved "https://registry.yarnpkg.com/@prantlf/jsonlint/-/jsonlint-10.2.0.tgz#0716001895cc5f0407820ffe9887de5e13e6fa47"
integrity sha512-KMFfds0peWLLfCu3bhClTiEN0tdj/Z86QJvn1awKHws6r+Sx6T3a44Eadz6OvqN6ZpsRkqaRpZxqddvvDAdDZQ==
dependencies:
ajv "6.10.2"
commander "4.0.1"
"@types/color-name@^1.1.1": "@types/color-name@^1.1.1":
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
...@@ -585,6 +605,16 @@ aggregate-error@^3.0.0: ...@@ -585,6 +605,16 @@ aggregate-error@^3.0.0:
clean-stack "^2.0.0" clean-stack "^2.0.0"
indent-string "^4.0.0" indent-string "^4.0.0"
ajv@6.10.2:
version "6.10.2"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52"
integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==
dependencies:
fast-deep-equal "^2.0.1"
fast-json-stable-stringify "^2.0.0"
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"
ajv@^6.5.5: ajv@^6.5.5:
version "6.12.0" version "6.12.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.0.tgz#06d60b96d87b8454a5adaba86e7854da629db4b7" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.0.tgz#06d60b96d87b8454a5adaba86e7854da629db4b7"
...@@ -641,6 +671,11 @@ ansi-align@^2.0.0: ...@@ -641,6 +671,11 @@ ansi-align@^2.0.0:
dependencies: dependencies:
string-width "^2.0.0" string-width "^2.0.0"
ansi-colors@4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348"
integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==
ansi-colors@^1.0.1: ansi-colors@^1.0.1:
version "1.1.0" version "1.1.0"
resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-1.1.0.tgz#6374b4dd5d4718ff3ce27a671a3b1cad077132a9" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-1.1.0.tgz#6374b4dd5d4718ff3ce27a671a3b1cad077132a9"
...@@ -2061,6 +2096,11 @@ commander@2.5.x: ...@@ -2061,6 +2096,11 @@ commander@2.5.x:
resolved "https://registry.yarnpkg.com/commander/-/commander-2.5.1.tgz#23c61f6e47be143cc02e7ad4bb1c47f5cd5a2883" resolved "https://registry.yarnpkg.com/commander/-/commander-2.5.1.tgz#23c61f6e47be143cc02e7ad4bb1c47f5cd5a2883"
integrity sha1-I8Yfbke+FDzALnrUuxxH9c1aKIM= integrity sha1-I8Yfbke+FDzALnrUuxxH9c1aKIM=
commander@4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-4.0.1.tgz#b67622721785993182e807f4883633e6401ba53c"
integrity sha512-IPF4ouhCP+qdlcmCedhxX4xiGBPyigb8v5NeUp+0LyhwLgxMqyp3S0vl7TAPfS/hiP7FC3caI/PB9lTmP8r1NA==
commander@^2.20.0, commander@^2.9.0: commander@^2.20.0, commander@^2.9.0:
version "2.20.3" version "2.20.3"
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
...@@ -3781,7 +3821,7 @@ falafel@^2.0.0: ...@@ -3781,7 +3821,7 @@ falafel@^2.0.0:
isarray "^2.0.1" isarray "^2.0.1"
object-keys "^1.0.6" object-keys "^1.0.6"
fancy-log@^1.1.0, fancy-log@^1.3.2: fancy-log@1.3.3, fancy-log@^1.1.0, fancy-log@^1.3.2:
version "1.3.3" version "1.3.3"
resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.3.tgz#dbc19154f558690150a23953a0adbd035be45fc7" resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.3.tgz#dbc19154f558690150a23953a0adbd035be45fc7"
integrity sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw== integrity sha512-k9oEhlyc0FrVh25qYuSELjr8oxsCoc4/LEZfg2iJJrfEk/tZL9bCoJE47gqAvI2m/AUjluCS4+3I0eTx8n3AEw==
...@@ -3791,6 +3831,11 @@ fancy-log@^1.1.0, fancy-log@^1.3.2: ...@@ -3791,6 +3831,11 @@ fancy-log@^1.1.0, fancy-log@^1.3.2:
parse-node-version "^1.0.0" parse-node-version "^1.0.0"
time-stamp "^1.0.0" time-stamp "^1.0.0"
fast-deep-equal@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49"
integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=
fast-deep-equal@^3.1.1: fast-deep-equal@^3.1.1:
version "3.1.1" version "3.1.1"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment