From: Vincent Vanwaelscappel
Date: Wed, 22 Jun 2022 09:31:20 +0000 (+0200)
Subject: wip #5330 @1.5
X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=058e2ecd9013fafd51cb19ad33b52f3c56891b07;p=sandvik-apps.git
wip #5330 @1.5
---
diff --git a/ScreeningMediaSelection/_doc/data.xlsx b/ScreeningMediaSelection/_doc/data.xlsx
index 4acaf14..a856ad1 100644
Binary files a/ScreeningMediaSelection/_doc/data.xlsx and b/ScreeningMediaSelection/_doc/data.xlsx differ
diff --git a/ScreeningMediaSelection/index.html b/ScreeningMediaSelection/index.html
index d904951..a612c52 100644
--- a/ScreeningMediaSelection/index.html
+++ b/ScreeningMediaSelection/index.html
@@ -26,8 +26,11 @@
-
+
+
+
+
+
diff --git a/ScreeningMediaSelection/js/common.js b/ScreeningMediaSelection/js/common.js
index 80f8fb1..f7c96d0 100644
--- a/ScreeningMediaSelection/js/common.js
+++ b/ScreeningMediaSelection/js/common.js
@@ -10,26 +10,21 @@ if (!window.localStorage) {
return null;
}
return unescape(document.cookie.replace(new RegExp("(?:^|.*;\\s*)" + escape(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*"), "$1"));
- },
- key: function (nKeyId) {
+ }, key: function (nKeyId) {
return unescape(document.cookie.replace(/\s*\=(?:.(?!;))*$/, "").split(/\s*\=(?:[^;](?!;))*[^;]?;\s*/)[nKeyId]);
- },
- setItem: function (sKey, sValue) {
+ }, setItem: function (sKey, sValue) {
if (!sKey) {
return;
}
document.cookie = escape(sKey) + "=" + escape(sValue) + "; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/";
this.length = document.cookie.match(/\=/g).length;
- },
- length: 0,
- removeItem: function (sKey) {
+ }, length: 0, removeItem: function (sKey) {
if (!sKey || !this.hasOwnProperty(sKey)) {
return;
}
document.cookie = escape(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
this.length--;
- },
- hasOwnProperty: function (sKey) {
+ }, hasOwnProperty: function (sKey) {
return (new RegExp("(?:^|;\\s*)" + escape(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie);
}
};
@@ -215,9 +210,30 @@ function showHide(show, callback) {
function exportTranslations() {
parseDataForTranslations();
parseScriptForTranslations(function () {
- post('https://extranet.cubedesigners.com/tools/excelTranslation', {
- name: APPNAME,
- str: JSON.stringify(TRANSLATIONS)
+ var T = {};
+ var L = [];
+ $.each(TRANSLATIONS, function (n, str) {
+ T[str] = [];
+ $.each(LOCALES, function (l, tt) {
+ if (n === 0) {
+ L.push(l);
+ }
+ if (l === 'en') {
+ T[str].push(str);
+ return;
+ }
+ var trans = '';
+ if (tt[str] !== undefined && tt[str] !== '') {
+ trans = tt[str];
+ }
+ T[str].push(trans);
+ });
+ });
+
+ var O = {translations: T, locales: L};
+ console.log(O);
+ post('https://extranet.cubedesigners.com/tools/excelTranslationM', {
+ name: APPNAME, str: JSON.stringify(O),
});
});
@@ -325,9 +341,18 @@ function addToTranslations(str, force) {
for (var i = 0; i < e.length; i++) {
var s = e[i];
+ // Skip numbers
+ if (/^[\d\.]*$/.test(s)) {
+ continue;
+ }
+ // Skip existing
if (window.TRANSLATIONS.indexOf(s) >= 0) {
continue;
}
+ // Skip html containing translations
+ if (s.indexOf('data-l10n') >= 0) {
+ continue;
+ }
if (!force && !/[a-hj-z]+/.test(s)) {
continue;
}
diff --git a/ScreeningMediaSelection/js/script.js b/ScreeningMediaSelection/js/script.js
index 9cb47e4..b3a2f0d 100644
--- a/ScreeningMediaSelection/js/script.js
+++ b/ScreeningMediaSelection/js/script.js
@@ -2,7 +2,6 @@ window.updateFormAgain = false;
DEV = false;
$(function () {
- console.log('parse data');
parseData();
$("section").addClass('hidden');
@@ -117,7 +116,6 @@ function parseTable(table, sheet) {
f.block = f.block !== '0';
FIELDS.push(f);
});
- console.log(FIELDS);
}
function parseOptions(table, k, f) {
@@ -185,7 +183,6 @@ function rangeVal(v) {
}
res[0] = parseFloat(res[0]);
res[1] = parseFloat(res[1]);
- console.log(res);
return res;
}