From 9217340a9cb44ab7504b012f4bfcfacf06f1c1a6 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 12 Apr 2021 14:54:52 +0530 Subject: [PATCH 1/3] use the user's language for docs links for supported languages --- CHANGELOG.md | 3 +++ customize.dist/pages.js | 23 ++++++++++++++++++++--- customize.dist/pages/index.js | 2 +- www/common/common-ui-elements.js | 5 +++-- www/common/drive-ui.js | 10 ++++++---- www/common/inner/share.js | 5 +++-- www/common/sframe-common-file.js | 7 ++++--- www/common/sframe-common.js | 2 +- www/support/inner.js | 2 +- 9 files changed, 42 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c602e292..30e6a813b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ * prompt premium users to cancel their subscriptions before deleting their accounts * check that headers for XLSX export are correctly set via the checkup app * guard against some type errors in the support page +* remove default privacy policy +* remove HTML from most translations +* localize links to the docs where a translation exists # 4.3.1 diff --git a/customize.dist/pages.js b/customize.dist/pages.js index c27a38814..283bd0876 100644 --- a/customize.dist/pages.js +++ b/customize.dist/pages.js @@ -12,9 +12,6 @@ define([ return e; }; - // TODO make a docsLink function which wraps this - // and points to the appropriate translation: - // French, German, or English as a default Pages.externalLink = function (el, href) { if (!el) { return el; } el.setAttribute("rel", "noopener noreferrer"); @@ -25,6 +22,26 @@ define([ return el; }; + // this rewrites URLS to point to the appropriate translation: + // French, German, or English as a default + var documentedLanguages = ['en', 'fr', 'de']; + Pages.localizeDocsLink = function (href) { + try { + var lang = Msg._getLanguage(); + if (documentedLanguages.indexOf(lang) > 0) { + return href.replace('/en/', '/' + lang + '/'); + } + } catch (err) { + console.error(err); + // if it fails just use the default href (English) + } + return href; + }; + + Pages.documentationLink = function (el, href) { + return Pages.externalLink(el, Pages.localizeDocsLink(href)); + }; + var languageSelector = function () { var options = []; var languages = Msg._languages; diff --git a/customize.dist/pages/index.js b/customize.dist/pages/index.js index 7a436b61d..3257126e9 100644 --- a/customize.dist/pages/index.js +++ b/customize.dist/pages/index.js @@ -81,7 +81,7 @@ define([ } var supportText = Pages.setHTML(h('span'), Msg.home_support); - Pages.externalLink(supportText.querySelector('a'), "https://docs.cryptpad.fr/en/how_to_contribute.html"); + Pages.documentationLink(supportText.querySelector('a'), "https://docs.cryptpad.fr/en/how_to_contribute.html"); var opensource = Pages.setHTML(h('p'), Msg.home_opensource); Pages.externalLink(opensource.querySelector('a'), "https://github.com/xwiki-labs/cryptpad"); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index c004421ac..05390628c 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -369,7 +369,7 @@ define([ h('div.cp-teams-invite-block', [ h('span', Messages.team_inviteLinkSetPassword), h('a.cp-teams-help.fa.fa-question-circle', { - href: origin + 'https://docs.cryptpad.fr/en/user_guide/security.html#passwords-for-documents-and-folders', + href: origin + Pages.localizeDocsLink('https://docs.cryptpad.fr/en/user_guide/security.html#passwords-for-documents-and-folders'), target: "_blank", 'data-tippy-placement': "right" }) @@ -1111,6 +1111,7 @@ define([ if (apps[type]) { href = "https://docs.cryptpad.fr/en/user_guide/apps/" + apps[type] + ".html"; } + href = Pages.localizeDocsLink(href); var content = setHTML(h('p'), Messages.help_genericMore); $(content).find('a').attr({ @@ -2147,7 +2148,7 @@ define([ UI.getFileIcon({type: type})[0], h('div.cp-creation-title-text', [ h('span', newPadH3Title), - createHelper('https://docs.cryptpad.fr/en/user_guide/apps/general.html#new-document', Messages.creation_helperText) + createHelper(Pages.localizeDocsLink('https://docs.cryptpad.fr/en/user_guide/apps/general.html#new-document'), Messages.creation_helperText) ]) ]); $creation.append(title); diff --git a/www/common/drive-ui.js b/www/common/drive-ui.js index 6a2a5b53d..87825e0f4 100644 --- a/www/common/drive-ui.js +++ b/www/common/drive-ui.js @@ -19,6 +19,7 @@ define([ '/common/proxy-manager.js', '/customize/application_config.js', '/customize/messages.js', + '/customize/pages.js', ], function ( $, ApiConfig, @@ -37,7 +38,8 @@ define([ h, ProxyManager, AppConfig, - Messages) + Messages, + Pages) { var APP = window.APP = { @@ -2490,7 +2492,7 @@ define([ // Get the upload options var addSharedFolderModal = function (cb) { - var docsHref = common.getBounceURL("https://docs.cryptpad.fr/en/user_guide/share_and_access.html#owners"); + var docsHref = common.getBounceURL(Pages.localizeDocsLink("https://docs.cryptpad.fr/en/user_guide/share_and_access.html#owners")); // Ask for name, password and owner var content = h('div', [ @@ -2503,7 +2505,7 @@ define([ style: 'display:flex;align-items:center;justify-content:space-between' }, [ UI.createCheckbox('cp-app-drive-sf-owned', Messages.sharedFolders_create_owned, true), - UI.createHelper(docsHref, Messages.creation_owned1) // TODO + UI.createHelper(docsHref, Messages.creation_owned1) ]), ]); @@ -4393,7 +4395,7 @@ define([ style: 'display:flex;align-items:center;justify-content:space-between' }, [ UI.createCheckbox('cp-upload-owned', Messages.sharedFolders_create_owned, true), - UI.createHelper('https://docs.cryptpad.fr/en/user_guide/share_and_access.html#owners', Messages.creation_owned1) + UI.createHelper(Pages.localizeDocsLink('https://docs.cryptpad.fr/en/user_guide/share_and_access.html#owners'), Messages.creation_owned1) ]), ]); return void UI.confirm(convertContent, function(res) { diff --git a/www/common/inner/share.js b/www/common/inner/share.js index 614fc23e7..860eb5566 100644 --- a/www/common/inner/share.js +++ b/www/common/inner/share.js @@ -10,8 +10,9 @@ define([ '/common/clipboard.js', '/customize/messages.js', '/bower_components/nthen/index.js', + '/customize/pages.js', ], function ($, Util, Hash, UI, UIElements, Feedback, Modal, h, Clipboard, - Messages, nThen) { + Messages, nThen, Pages) { var Share = {}; var createShareWithFriends = function (config, onShare, linkGetter) { @@ -252,7 +253,7 @@ define([ h('a', {href: '#'}, Messages.passwordFaqLink) ]); $(link).click(function () { - opts.common.openUnsafeURL("https://docs.cryptpad.fr/en/user_guide/security.html#passwords-for-documents-and-folders"); + opts.common.openUnsafeURL(Pages.localizeDocsLink("https://docs.cryptpad.fr/en/user_guide/security.html#passwords-for-documents-and-folders")); }); return link; }; diff --git a/www/common/sframe-common-file.js b/www/common/sframe-common-file.js index fb432b5ad..c7a66adb9 100644 --- a/www/common/sframe-common-file.js +++ b/www/common/sframe-common-file.js @@ -10,10 +10,11 @@ define([ '/common/common-hash.js', '/common/hyperscript.js', '/customize/messages.js', + '/customize/pages.js', '/bower_components/file-saver/FileSaver.min.js', '/bower_components/tweetnacl/nacl-fast.min.js', -], function ($, ApiConfig, FileCrypto, MakeBackup, Thumb, UI, UIElements, Util, Hash, h, Messages) { +], function ($, ApiConfig, FileCrypto, MakeBackup, Thumb, UI, UIElements, Util, Hash, h, Messages, Pages) { var Nacl = window.nacl; var module = {}; @@ -327,7 +328,7 @@ define([ style: 'display:flex;align-items:center;justify-content:space-between' }, [ UI.createCheckbox('cp-upload-owned', Messages.upload_modal_owner, modalState.owned), - createHelper('https://docs.cryptpad.fr/en/user_guide/share_and_access.html#owners', Messages.creation_owned1) + createHelper(Pages.localizeDocsLink('https://docs.cryptpad.fr/en/user_guide/share_and_access.html#owners'), Messages.creation_owned1) ]), manualStore ]); @@ -382,7 +383,7 @@ define([ style: 'display:flex;align-items:center;justify-content:space-between' }, [ UI.createCheckbox('cp-upload-owned', Messages.uploadFolder_modal_owner, modalState.owned), - createHelper('https://docs.cryptpad.fr/en/user_guide/share_and_access.html#owners', Messages.creation_owned1) + createHelper(Pages.localizeDocsLink('https://docs.cryptpad.fr/en/user_guide/share_and_access.html#owners'), Messages.creation_owned1) ]), manualStore ]); diff --git a/www/common/sframe-common.js b/www/common/sframe-common.js index 0404af648..3043ab039 100644 --- a/www/common/sframe-common.js +++ b/www/common/sframe-common.js @@ -774,7 +774,7 @@ define([ if (i) { i.classList = 'fa fa-shhare-alt'; } var a = error.querySelector('a'); if (a) { - a.setAttribute('href', "https://docs.cryptpad.fr/en/user_guide/user_account.html#confidentiality"); + a.setAttribute('href', Pages.localizeDocsLink("https://docs.cryptpad.fr/en/user_guide/user_account.html#confidentiality")); } UI.errorLoadingScreen(error); }); diff --git a/www/support/inner.js b/www/support/inner.js index 1285c1133..f466e7693 100644 --- a/www/support/inner.js +++ b/www/support/inner.js @@ -170,7 +170,7 @@ define([ create['form'] = function () { var key = 'form'; var $div = makeBlock(key, true); // Msg.support_formHint, .support_formTitle, .support_formButton - Pages.externalLink($div.find('a')[0], 'https://docs.cryptpad.fr/en/user_guide/index.html'); + Pages.documentationLink($div.find('a')[0], 'https://docs.cryptpad.fr/en/user_guide/index.html'); var form = APP.support.makeForm(); From c6cfd5e1c480316761755aaeaecd119a0a6db54e Mon Sep 17 00:00:00 2001 From: Weblate Date: Mon, 12 Apr 2021 11:48:36 +0200 Subject: [PATCH 2/3] Translated using Weblate (German) Currently translated at 100.0% (1199 of 1199 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/de/ Translated using Weblate (German) Currently translated at 99.9% (1198 of 1199 strings) Translation: CryptPad/App Translate-URL: http://weblate.cryptpad.fr/projects/cryptpad/app/de/ --- www/common/translations/messages.de.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/www/common/translations/messages.de.json b/www/common/translations/messages.de.json index 774afeed0..2d222f5a2 100644 --- a/www/common/translations/messages.de.json +++ b/www/common/translations/messages.de.json @@ -1188,5 +1188,16 @@ "broadcast_surveyURL": "Link zur Umfrage", "admin_surveyActive": "Umfrage öffnen", "admin_surveyCancel": "Entfernen", - "admin_surveyButton": "Umfrage speichern" + "admin_surveyButton": "Umfrage speichern", + "broadcast_defaultLanguage": "Standardmäßig diese Sprache verwenden", + "admin_broadcastTitle": "Mitteilung", + "admin_cat_broadcast": "Ankündigungen", + "admin_surveyHint": "Eine externe Umfrage hinzufügen, ändern oder löschen. Die Benutzer werden eine Benachrichtigung erhalten und die Umfrage bleibt über das Benutzermenü verfügbar.", + "admin_maintenanceHint": "Plane Wartungsarbeiten auf dieser Instanz und benachrichtige alle Benutzer. Es kann maximal eine aktive Wartung geben.", + "broadcast_newCustom": "Mitteilung der Administratoren", + "admin_broadcastCancel": "Mitteilung löschen", + "admin_broadcastActive": "Aktive Mitteilung", + "admin_broadcastHint": "Sende eine Mitteilung an alle Benutzer auf dieser Instanz. Alle existierenden und neue Benutzer werden sie als Benachrichtigung erhalten. Du kannst sie mit **Vorschau der Benachrichtigung** überprüfen. Die Vorschau ist mit einem roten Symbol gekennzeichnet und nur für dich sichtbar.", + "broadcast_preview": "Vorschau der Benachrichtigung", + "admin_maintenanceCancel": "Wartungsarbeiten stornieren" } From b36f48630a2a155744ab6e44b6cbdabd01b30e12 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 12 Apr 2021 15:30:49 +0530 Subject: [PATCH 3/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30e6a813b..4e259287e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ * remove default privacy policy * remove HTML from most translations * localize links to the docs where a translation exists +* remove redundant link from OpenCollective popup # 4.3.1