From 81059d24b99af433b01dd72dd98a412aa5f8b9d3 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 18 Dec 2020 16:17:55 -0500 Subject: [PATCH 1/3] i10n changes --- MIGRATION.md | 4 ++++ libs/odmInfo.js | 5 ----- package.json | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/MIGRATION.md b/MIGRATION.md index 0933e83..6b8a8b5 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,5 +1,9 @@ # Migration Guide +## From API version 2.1.1 to 2.1.2 + + * Minor breaking change: `help` strings from `/options` no longer substitute `%(default)s` and `%(choices)s` variables. Clients should do that by replacing the `default` and `domain` attributes before displaying them to the user. This is necessary for better localization support. + ## From API version 1.x to 2.x * `skipPostProcessing` parameter in `/task/new` and `/task/new/init` no longer processes 2D tiles via gdal2tiles.py. So the `orthophoto_tiles`, `dsm_tiles` and `dtm_tiles` directories are no longer being generated by NodeODM. Engines can provide such folders if needed and will be included in the output archive. With ODM you can now use the `--tiles` parameter to generate the tiles. diff --git a/libs/odmInfo.js b/libs/odmInfo.js index 4a08397..41eb881 100644 --- a/libs/odmInfo.js +++ b/libs/odmInfo.js @@ -141,11 +141,6 @@ module.exports = { if (domain.indexOf(value) === -1) domain.unshift(value); } - const choicesStr = Array.isArray(domain) ? domain.join(", ") : domain; - - help = help.replace(/\%\(choices\)s/g, choicesStr); - help = help.replace(/\%\(default\)s/g, value); - odmOptions.push({ name, type, value, domain, help }); diff --git a/package.json b/package.json index 7be9b3a..0682f66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "NodeODM", - "version": "2.1.1", + "version": "2.1.2", "description": "REST API to access ODM", "main": "index.js", "scripts": { From 905e66d9ef900a946604302dd55b265b99594180 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 18 Dec 2020 16:26:23 -0500 Subject: [PATCH 2/3] Replace choices/default placeholders in JS client --- public/js/main.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/public/js/main.js b/public/js/main.js index 19d65b5..539ab69 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -494,6 +494,13 @@ $(function() { }else if (properties.type === 'enum'){ this.defaultValue = properties.value; } + + if (this.properties.help){ + var choicesStr = typeof domain === "object" ? domain.join(", ") : domain; + + this.properties.help = this.properties.help.replace(/\%\(choices\)s/g, choicesStr); + this.properties.help = this.properties.help.replace(/\%\(default\)s/g, this.properties.value); + } this.value = ko.observable(this.defaultValue); } From b54cb53eb4b7fc1a694b923b6b1f7b2eefa385eb Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 18 Dec 2020 16:28:29 -0500 Subject: [PATCH 3/3] Code fix --- public/js/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/main.js b/public/js/main.js index 539ab69..8fcc3be 100644 --- a/public/js/main.js +++ b/public/js/main.js @@ -495,8 +495,8 @@ $(function() { this.defaultValue = properties.value; } - if (this.properties.help){ - var choicesStr = typeof domain === "object" ? domain.join(", ") : domain; + if (this.properties.help !== undefined && this.properties.domain !== undefined){ + var choicesStr = typeof this.properties.domain === "object" ? this.properties.domain.join(", ") : this.properties.domain; this.properties.help = this.properties.help.replace(/\%\(choices\)s/g, choicesStr); this.properties.help = this.properties.help.replace(/\%\(default\)s/g, this.properties.value);