Merge tag '4.11.0' into dapsi-demo-update
commit
eb3cdf2f78
Binary file not shown.
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 40 KiB |
Binary file not shown.
Binary file not shown.
@ -0,0 +1,111 @@
|
||||
var Assert = require("assert");
|
||||
var Util = require("../../lib/common-util");
|
||||
var addIfAbsent = function (A, e) {
|
||||
if (A.includes(e)) { return; }
|
||||
A.push(e);
|
||||
};
|
||||
|
||||
var findDuplicates = function (map) {
|
||||
var keys = Object.keys(map);
|
||||
|
||||
|
||||
var duplicates = {};
|
||||
var markDuplicate = function (value, key1, key2) {
|
||||
//console.log("[%s] === [%s] (%s)", key1, key2, value);
|
||||
if (!Array.isArray(duplicates[value])) {
|
||||
duplicates[value] = [];
|
||||
}
|
||||
addIfAbsent(duplicates[value], key1);
|
||||
addIfAbsent(duplicates[value], key2);
|
||||
};
|
||||
|
||||
keys.forEach(function (key) {
|
||||
var value = map[key];
|
||||
|
||||
//var duplicates = [];
|
||||
keys.forEach(function (key2) {
|
||||
if (key === key2) { return; }
|
||||
var value2 = map[key2];
|
||||
if (value === value2) {
|
||||
markDuplicate(value, key, key2);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var temp = {};
|
||||
// sort keys and construct a new index using the first key in the sorted array
|
||||
Object.keys(duplicates).forEach(function (key) {
|
||||
var val = duplicates[key]; // should be an array
|
||||
val.sort(); // default js sort
|
||||
var new_key = val[0];
|
||||
temp[new_key] = val;
|
||||
});
|
||||
|
||||
var canonical = {};
|
||||
Object.keys(temp).sort().forEach(function (key) {
|
||||
canonical[key] = temp[key];
|
||||
});
|
||||
return canonical;
|
||||
};
|
||||
|
||||
/*
|
||||
var logDuplicates = function (duplicates) {
|
||||
// indicate which strings are duplicated and could potentially be changed to use one key
|
||||
Object.keys(duplicates).forEach(function (val) {
|
||||
console.log('\"%s\" => %s', val, JSON.stringify(duplicates[val]));
|
||||
});
|
||||
};
|
||||
*/
|
||||
|
||||
var FULL_LANGUAGES = {
|
||||
EN: Util.clone(require("../../www/common/translations/messages.json")),
|
||||
FR: Util.clone(require("../../www/common/translations/messages.fr.json")),
|
||||
DE: Util.clone(require("../../www/common/translations/messages.de.json")),
|
||||
JP: Util.clone(require("../../www/common/translations/messages.ja.json")),
|
||||
};
|
||||
|
||||
var DUPLICATES = {};
|
||||
|
||||
Object.keys(FULL_LANGUAGES).forEach(function (code) {
|
||||
DUPLICATES[code] = findDuplicates(FULL_LANGUAGES[code]);
|
||||
});
|
||||
|
||||
var extraneousKeys = 0;
|
||||
|
||||
// 1) check whether the same mapping exists across languages
|
||||
// ie. English has "Open" (verb) and "Open" (adjective)
|
||||
// while French has "Ouvrir" and "Ouvert(s)"
|
||||
// such keys should not be simplified/deduplicated
|
||||
Object.keys(DUPLICATES.EN).forEach(function (key) {
|
||||
var reference = DUPLICATES.EN[key];
|
||||
if (!['FR', 'DE', 'JP'].every(function (code) {
|
||||
try {
|
||||
Assert.deepEqual(reference, DUPLICATES[code][key]);
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})) {
|
||||
return;
|
||||
}
|
||||
console.log("The key [%s] (\"%s\") is duplicated identically across all fully supported languages", key, FULL_LANGUAGES.EN[key]);
|
||||
console.log("Values:", JSON.stringify(['EN', 'FR', 'DE', 'JP'].map(function (code) {
|
||||
return FULL_LANGUAGES[code][key];
|
||||
})));
|
||||
console.log("Keys:", JSON.stringify(reference));
|
||||
console.log();
|
||||
extraneousKeys += reference.length - 1;
|
||||
|
||||
//console.log("\n" + code + "\n==\n");
|
||||
//logDuplicates(map);
|
||||
});
|
||||
|
||||
console.log("Total extraneous keys: %s", extraneousKeys);
|
||||
|
||||
|
||||
// TODO
|
||||
// find instances where
|
||||
// one of the duplicated keys is not translated
|
||||
// perhaps we could automatically use the translated one everywhere
|
||||
// and improve the completeness of translations
|
||||
|
@ -1,4 +1,4 @@
|
||||
var Messages = require("../www/common/translations/messages.json");
|
||||
var Messages = require("../../www/common/translations/messages.json");
|
||||
var Exec = require("child_process").exec;
|
||||
|
||||
var ignoreLines = function (source, pattern) {
|
@ -1,54 +0,0 @@
|
||||
define([
|
||||
'/common/hyperscript.js',
|
||||
|
||||
], function (h) {
|
||||
var Charts = {};
|
||||
|
||||
Charts.table = function (content, classes) {
|
||||
var classString = Array.isArray(classes)? '.' + classes.filter(Boolean).join('.'): '';
|
||||
return h('table' + classString, content);
|
||||
};
|
||||
|
||||
Charts.columns = function (rows) {
|
||||
return Charts.table([
|
||||
//h('caption', "Front-End Developer Salary"),
|
||||
h('tbody', rows.map(function (n) {
|
||||
return h('tr', h('td', {
|
||||
style: '--size: ' + (n / 100),
|
||||
}, h('span.data', n)));
|
||||
})),
|
||||
], [
|
||||
'charts-css',
|
||||
'column',
|
||||
'show-heading',
|
||||
]);
|
||||
};
|
||||
|
||||
Charts.row = function (text, count, data) {
|
||||
return h('tr', [
|
||||
h('th', {
|
||||
scope: 'row',
|
||||
}, text),
|
||||
h('td', {
|
||||
style: '--size: ' + count,
|
||||
}, [
|
||||
//text,
|
||||
typeof(data) !== 'undefined'? h('span.data', data): text,
|
||||
])
|
||||
]);
|
||||
};
|
||||
|
||||
// table.charts-css.bar.reverse
|
||||
/*
|
||||
Charts.bars = function (rows) {
|
||||
return Charts.table([
|
||||
|
||||
], [
|
||||
|
||||
|
||||
]);
|
||||
};
|
||||
*/
|
||||
|
||||
return Charts;
|
||||
});
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,11 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CryptPad</title>
|
||||
<meta content="text/html; charset=utf-8" http-equiv="content-type"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="referrer" content="no-referrer" />
|
||||
<script async data-main="/test/inner.js" src="/bower_components/requirejs/require.js?ver=2.3.6"></script>
|
||||
<link href="/lib/chart/charts.min.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
@ -1,68 +0,0 @@
|
||||
define([
|
||||
'/common/hyperscript.js',
|
||||
'/common/inner/charts.js',
|
||||
], function (h, Charts) {
|
||||
var wrap = function (content) {
|
||||
return h('div', {
|
||||
style: 'height: 500px; width: 500px; padding: 15px; border: 1px solid #222; margin: 15px;'
|
||||
}, content);
|
||||
};
|
||||
|
||||
var append = function (el) {
|
||||
document.body.appendChild(el);
|
||||
};
|
||||
|
||||
var data = [
|
||||
25, 58, 5, 96, 79,
|
||||
23, 75, 13, 44, 29,
|
||||
65, 80, 30, 47, 22,
|
||||
7, 62, 64, 46, 21,
|
||||
29, 31, 76, 65, 61,
|
||||
78, 58, 12, 90, 98,
|
||||
37, 75, 92, 74, 16,
|
||||
17, 52, 42, 71, 19
|
||||
];
|
||||
|
||||
|
||||
append(h('h1', 'Charts'));
|
||||
append(h('hr'));
|
||||
|
||||
var cell = (function () {
|
||||
var i = 0;
|
||||
|
||||
return function () {
|
||||
var val = data[i++];
|
||||
return h('td', {
|
||||
style: '--size: ' + (val / 100),
|
||||
}, val);
|
||||
};
|
||||
}());
|
||||
|
||||
var multirow = function (n) {
|
||||
var cells = [];
|
||||
while (n--) {
|
||||
cells.push(cell());
|
||||
}
|
||||
return h('tr', {
|
||||
style: 'margin: 15px',
|
||||
}, cells);
|
||||
};
|
||||
|
||||
append(wrap(Charts.table([
|
||||
h('tbody', [
|
||||
multirow(4),
|
||||
multirow(4),
|
||||
multirow(4),
|
||||
multirow(4),
|
||||
]),
|
||||
], [
|
||||
'charts-css',
|
||||
'bar',
|
||||
'multiple',
|
||||
])));
|
||||
|
||||
|
||||
append(h('hr'));
|
||||
append(wrap(Charts.columns([ 40, 60, 75, 90, 100])));
|
||||
append(wrap(Charts.columns(data.slice(20))));
|
||||
});
|
Loading…
Reference in New Issue