From e9700dcd22753738dba9817f3a01ebb2b9eca99a Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Thu, 9 Apr 2020 14:34:57 +0200 Subject: [PATCH] [New] Added JS function localizeJsonMsg() --- .../app/src/behaviors/c-compute-behavior.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/li.strolch.mvn.archetype.webapp/src/main/resources/archetype-resources/src/main/webapp/app/src/behaviors/c-compute-behavior.html b/li.strolch.mvn.archetype.webapp/src/main/resources/archetype-resources/src/main/webapp/app/src/behaviors/c-compute-behavior.html index 35dcc94f2..98daab485 100644 --- a/li.strolch.mvn.archetype.webapp/src/main/resources/archetype-resources/src/main/webapp/app/src/behaviors/c-compute-behavior.html +++ b/li.strolch.mvn.archetype.webapp/src/main/resources/archetype-resources/src/main/webapp/app/src/behaviors/c-compute-behavior.html @@ -470,6 +470,22 @@ showToast: function (text) { this.fire('cx-show-toast', {text: text}); + }, + + localizeJsonMsg: function (jsonMsg) { + if (jsonMsg == null) + return jsonMsg; + if (jsonMsg.values == null || jsonMsg.values.length == 0) + return this.localize(jsonMsg.key); + + var values = [jsonMsg.key]; + var keys = Object.keys(jsonMsg.values); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + values.push(key); + values.push(jsonMsg.values[key]); + } + return this.localize.apply(null, values); } }; \ No newline at end of file