From 62fb7e9b298fea6c1eabbb60788495d2229d1369 Mon Sep 17 00:00:00 2001 From: Sergii Leonenko Date: Wed, 28 Jul 2021 15:44:59 +0300 Subject: [PATCH] TT#127356 i18n - Key extraction command (i18n:extract) must ignore code in comments Note: to test it you can add some JS code with translations in commented block. That translation should not apper in en.json file if you execute "yarn run i18n:extract" command Change-Id: I79f6a8358f3a52578b58044eb02169aaccf62123 --- bin/vue-i18n-extract/vue-i18n-extract.umd.js | 4 +++- package.json | 1 + src/i18n/en.json | 5 ----- yarn.lock | 9 ++++++++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bin/vue-i18n-extract/vue-i18n-extract.umd.js b/bin/vue-i18n-extract/vue-i18n-extract.umd.js index c40b59af..bad0f665 100644 --- a/bin/vue-i18n-extract/vue-i18n-extract.umd.js +++ b/bin/vue-i18n-extract/vue-i18n-extract.umd.js @@ -28,6 +28,8 @@ return _extends.apply(this, arguments); } + const decomment = require('decomment'); + function readVueFiles(src) { if (!isValidGlob(src)) { throw new Error(`vueFiles isn't a valid glob pattern.`); @@ -44,7 +46,7 @@ return { fileName, path: f, - content: fs.readFileSync(f, 'utf8') + content: decomment.text(fs.readFileSync(f, 'utf8')) }; }); } diff --git a/package.json b/package.json index 0ca9df2f..05325543 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "@quasar/quasar-app-extension-testing-unit-jest": "^1.0.1", "babel-eslint": "^10.0.1", "commander": "6.2.1", + "decomment": "0.9.4", "dot-object": "2.1.4", "eslint": "^6.8.0", "eslint-config-standard": "^14.1.0", diff --git a/src/i18n/en.json b/src/i18n/en.json index ca61ce6a..f73a0140 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -210,7 +210,6 @@ "Lamp/Key": "Lamp/Key", "Lamps/Keys": "Lamps/Keys", "Language": "Language", - "Language ({language})": "Language ({language})", "Language for voicemail and app server": "Language for voicemail and app server", "Last Modify Time": "Last Modify Time", "Leave conference": "Leave conference", @@ -365,7 +364,6 @@ "Send Fax": "Send Fax", "Sending fax completed successfully.": "Sending fax completed successfully.", "Serial Ringing": "Serial Ringing", - "Session language successfully changed": "Session language successfully changed", "Set your PBX settings": "Set your PBX settings", "Set your fax settings": "Set your fax settings", "Set your personal alarm": "Set your personal alarm", @@ -415,7 +413,6 @@ "Type something": "Type something", "Unassign": "Unassign", "Unassigned": "Unassigned", - "Unassigned slot {slot}": "Unassigned slot {slot}", "Unavailable Greeting": "Unavailable Greeting", "Unblock Incoming": "Unblock Incoming", "Unblock Incoming/Outgoing": "Unblock Incoming/Outgoing", @@ -436,11 +433,9 @@ "User Agent": "User Agent", "User settings": "User settings", "Username": "Username", - "Video Call": "Video Call", "View All Registered Devices": "View All Registered Devices", "View Call List": "View Call List", "View Voicebox Messages": "View Voicebox Messages", - "Voice Call": "Voice Call", "Voice prompts language for voicemail, conference and application server": "Voice prompts language for voicemail, conference and application server", "Voicebox": "Voicebox", "Voicebox Messages": "Voicebox Messages", diff --git a/yarn.lock b/yarn.lock index 5ae065c5..ff667deb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4026,6 +4026,13 @@ decode-uri-component@^0.2.0: resolved "https://npm-registry.sipwise.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= +decomment@0.9.4: + version "0.9.4" + resolved "https://npm-registry.sipwise.com/decomment/-/decomment-0.9.4.tgz#fa40335bd90e3826d5c1984276e390525ff856d5" + integrity sha512-8eNlhyI5cSU4UbBlrtagWpR03dqXcE5IR9zpe7PnO6UzReXDskucsD8usgrzUmQ6qJ3N82aws/p/mu/jqbURWw== + dependencies: + esprima "4.0.1" + decompress-response@^3.3.0: version "3.3.0" resolved "https://npm-registry.sipwise.com/decompress-response/-/decompress-response-3.3.0.tgz#80a4dd323748384bfa248083622aedec982adff3" @@ -4825,7 +4832,7 @@ espree@^6.1.2, espree@^6.2.1: acorn-jsx "^5.2.0" eslint-visitor-keys "^1.1.0" -esprima@^4.0.0, esprima@^4.0.1: +esprima@4.0.1, esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://npm-registry.sipwise.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==