correct inconsistent capitalization of 'CryptPad' in markdown files.

Add a rule to the translation linter to detect future inconsistencies.
This commit is contained in:
ansuz 2021-08-13 15:18:43 +05:30
parent a779d043ca
commit f12a276c78
4 changed files with 131 additions and 111 deletions

View File

@ -2,7 +2,7 @@ So you want to write a realtime collaborative application?
This guide will focus on applications which require **multiple clients** to **collaboratively construct a single authoratative document**.
[XWiki-Labs](https://labs.xwiki.com/) has published an open source suite (called [Cryptpad](https://github.com/xwiki-labs/cryptpad)) of collaborative editors which employ end to end encryption.
[XWiki-Labs](https://labs.xwiki.com/) has published an open source suite (called [CryptPad](https://github.com/xwiki-labs/cryptpad)) of collaborative editors which employ end to end encryption.
This guide will refer to the techniques used in the prototypes developed therein.
Let's start with an overview of the components involved.
@ -75,7 +75,7 @@ Chainpad can handle out of order messages, but it performs best when its message
By architecting your system such that all clients send to a server which then relays to other clients, you guarantee that a particular chain of patches is consistent between the participants of your session.
Cryptpad is capable of using a variety of data stores.
CryptPad is capable of using a variety of data stores.
Which data store your instance employs can be [easily configured](https://github.com/xwiki-labs/cryptpad/blob/master/config.example.js).
You simply need to write an adaptor which conforms to a simple API.
@ -85,7 +85,7 @@ Whether you decide to use a single server, or distribute messages across a netwo
## Transport
Cryptpad was initially written to use [websockets](https://en.wikipedia.org/wiki/WebSocket) for transportation of messages.
CryptPad was initially written to use [websockets](https://en.wikipedia.org/wiki/WebSocket) for transportation of messages.
Since a relay server is indispensable in this model, that server doubles as the **History Keeper**, and implements a datastore.
@ -202,7 +202,7 @@ That isn't to say that there are no tradeoffs when keeping that information from
### Our Encryption Scheme
The encryption scheme employed by Cryptpad is a [symmetric encryption](https://en.wikipedia.org/wiki/Symmetric-key_algorithm) which utilizes a single [pre-shared-key](https://en.wikipedia.org/wiki/Pre-shared_key) known by all participants.
The encryption scheme employed by CryptPad is a [symmetric encryption](https://en.wikipedia.org/wiki/Symmetric-key_algorithm) which utilizes a single [pre-shared-key](https://en.wikipedia.org/wiki/Pre-shared_key) known by all participants.
Encryption is complex, and poorly understood by the majority of those who use it on a daily basis.
Pre-shared-keys are among the weakest possible cryptographic tools available today, however, few if any other encryption schemes scale to any number of users.

View File

@ -20,7 +20,7 @@ The most recent version and all past release notes can be found [here](https://g
## Setup using Docker
See [Cryptpad-Docker](https://github.com/xwiki-labs/cryptpad-docker) repository for details on how to get up-and-running with Cryptpad in Docker. This repository is maintained by the community and not officially supported.
See [CryptPad-Docker](https://github.com/xwiki-labs/cryptpad-docker) repository for details on how to get up-and-running with CryptPad in Docker. This repository is maintained by the community and not officially supported.
# Security
@ -72,7 +72,7 @@ CryptPad is actively developed by a team at [XWiki SAS](https://www.xwiki.com),
We love Open Source and we love contribution. Learn more about [contributing](https://docs.cryptpad.fr/en/how_to_contribute.html).
If you have any questions or comments, or if you're interested in contributing to Cryptpad, come say hi in our [Matrix channel](https://app.element.io/#/room/#cryptpad:matrix.xwiki.com).
If you have any questions or comments, or if you're interested in contributing to CryptPad, come say hi in our [Matrix channel](https://app.element.io/#/room/#cryptpad:matrix.xwiki.com).
# License

View File

@ -1,99 +0,0 @@
var EN = require("../www/common/translations/messages.json");
var simpleTags = [
'<br>',
'<a href="/login/">',
'<a href="/register/">',
// FIXME
"<a href='#'>",
'<a href="#docs">',
'<h3>',
'</h3>',
// FIXME register_notes
'<ul class="cp-notes-list">',
'</ul>',
'<li>',
'</li>',
'<span class="red">',
'</span>',
];
['a', 'b', 'em', 'p', 'i'].forEach(function (tag) {
simpleTags.push('<' + tag + '>');
simpleTags.push('</' + tag + '>');
});
// these keys are known to be problematic
var KNOWN_ISSUES = [ // FIXME
//'newVersion',
//'fm_info_anonymous',
//'register_notes',
];
var processLang = function (map, lang, primary) {
var announced = false;
var announce = function () {
if (announced) { return; }
announced = true;
console.log("NEXT LANGUAGE: ", lang);
};
Object.keys(map).forEach(function (k) {
if (!EN[k]) { return; }
if (KNOWN_ISSUES.indexOf(k) !== -1) { return; }
var s = map[k];
if (typeof(s) !== 'string') { return; }
var usesHTML;
s.replace(/<.*?>/g, function (html) {
if (simpleTags.indexOf(html) !== -1) { return; }
announce();
usesHTML = true;
if (!primary) {
console.log("{%s}", html);
}
});
if (usesHTML) {
announce();
console.log("%s", s);
console.log("[%s]\n", k);
}
});
};
processLang(EN, 'en', true);
[
'ar',
//'bn_BD',
'ca',
'de',
'es',
'fi',
'fr',
'hi',
'it',
'ja',
'nb',
'nl',
'pl',
'pt-br',
'ro',
'ru',
'sv',
//'te',
'tr',
'zh',
].forEach(function (lang) {
try {
var map = require("../www/common/translations/messages." + lang + ".json");
if (!Object.keys(map).length) { return; }
processLang(map, lang);
} catch (err) {
console.error(err);
}
});

View File

@ -1,8 +1,127 @@
// TODO unify the following scripts
// unused-translations.js
// find-html-translations
var EN = require("../www/common/translations/messages.json");
// more linting
// Search for 'Cryptpad' string (should be 'CryptPad')
// Search English for -ise\s
var simpleTags = [
'<br>',
'<a href="/login/">',
'<a href="/register/">',
// FIXME
"<a href='#'>",
'<a href="#docs">',
'<h3>',
'</h3>',
// FIXME register_notes
'<ul class="cp-notes-list">',
'</ul>',
'<li>',
'</li>',
'<span class="red">',
'</span>',
];
['a', 'b', 'em', 'p', 'i'].forEach(function (tag) {
simpleTags.push('<' + tag + '>');
simpleTags.push('</' + tag + '>');
});
// these keys are known to be problematic
var KNOWN_ISSUES = [ // FIXME
//'newVersion',
//'fm_info_anonymous',
//'register_notes',
];
var special_rules = {};
special_rules.en = function (s) {
// Prefer the american -ize suffix for verbs rather than -ise
return /[^w]ise/.test(s);
};
special_rules.fr = function (s) {
/*
hacky regexp to check whether there are any instances of ':'
which do not have the preceding space as is expected.
ignore instances where the following character is a '/'
because this is probably a URL (http(s)://)
*/
return /\S[:;\?\!][^\/]{1,}/.test(s);
};
var noop = function () {};
var processLang = function (map, lang, primary) {
var announced = false;
var announce = function () {
if (announced) { return; }
announced = true;
console.log("NEXT LANGUAGE: ", lang);
};
var special = special_rules[lang] || noop;
Object.keys(map).forEach(function (k) {
if (!EN[k]) { return; }
if (KNOWN_ISSUES.indexOf(k) !== -1) { return; }
var s = map[k];
if (typeof(s) !== 'string') { return; }
var usesHTML;
s.replace(/<.*?>/g, function (html) {
if (simpleTags.indexOf(html) !== -1) { return; }
announce();
usesHTML = true;
if (!primary) {
console.log("{%s}", html);
}
});
var weirdCapitalization;
s.replace(/cryptpad(\.fr)*/gi, function (brand) {
if (['CryptPad', 'cryptpad.fr'].includes(brand)) { return; }
weirdCapitalization = true;
});
var specialViolation = special(s);
if (usesHTML || weirdCapitalization || specialViolation) {
announce();
console.log("%s", s);
console.log("[%s]\n", k);
}
});
};
processLang(EN, 'en', true);
[
'ar',
//'bn_BD',
'ca',
'de',
'es',
'fi',
'fr',
'hi',
'it',
'ja',
'nb',
'nl',
'pl',
'pt-br',
'ro',
'ru',
'sv',
//'te',
'tr',
'zh',
].forEach(function (lang) {
try {
var map = require("../www/common/translations/messages." + lang + ".json");
if (!Object.keys(map).length) { return; }
processLang(map, lang);
} catch (err) {
console.error(err);
}
});