From 2a8464001efce8c76e8109af7eb68d9e86105692 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Thu, 28 Oct 2021 17:08:13 +0200 Subject: chore: add legal notice In France, legal notice is required for any website. --- htdocs/src/js/app.js | 15 ++++++++++++++- htdocs/src/js/i18n/locales/en.js | 4 ++++ htdocs/src/js/i18n/locales/fr.js | 4 ++++ 3 files changed, 22 insertions(+), 1 deletion(-) (limited to 'htdocs/src/js') diff --git a/htdocs/src/js/app.js b/htdocs/src/js/app.js index efb4c33..4f5f5a5 100644 --- a/htdocs/src/js/app.js +++ b/htdocs/src/js/app.js @@ -327,6 +327,18 @@ function printRequestedPage() { } } +/** + * Replace the legal notice link and text. + */ +function replaceLegalNoticeLink() { + const link = document.querySelector('.nav__link--legal'); + link.href = translate('footer.legalNotice.link'); + link.textContent = translate('footer.legalNotice.txt'); +} + +/** + * Translate all text available in HTML templates. + */ function translateHTMLContent() { const brandingDesc = document.querySelector('.branding__description'); const navLabel = document.querySelector('.nav__label'); @@ -335,7 +347,7 @@ function translateHTMLContent() { brandingDesc.textContent = translate('branding.description'); navLabel.textContent = translate('nav.title'); license.title = translate('footer.license'); - instructions.textContent = translate('main.instructions'); + if (instructions) instructions.textContent = translate('main.instructions'); } /** @@ -357,6 +369,7 @@ function setAppLocale() { function init() { setAppLocale(); translateHTMLContent(); + replaceLegalNoticeLink(); loadWebpackStyles(); printProjectsNav(); updateView(); diff --git a/htdocs/src/js/i18n/locales/en.js b/htdocs/src/js/i18n/locales/en.js index c21b739..9717528 100644 --- a/htdocs/src/js/i18n/locales/en.js +++ b/htdocs/src/js/i18n/locales/en.js @@ -25,6 +25,10 @@ const en = { }, }, footer: { + legalNotice: { + txt: 'Legal notice', + link: 'legal-notice.html', + }, license: 'License MIT', }, }; diff --git a/htdocs/src/js/i18n/locales/fr.js b/htdocs/src/js/i18n/locales/fr.js index af1d83c..9c93012 100644 --- a/htdocs/src/js/i18n/locales/fr.js +++ b/htdocs/src/js/i18n/locales/fr.js @@ -25,6 +25,10 @@ const fr = { }, }, footer: { + legalNotice: { + txt: 'Mentions légales', + link: 'mentions-legales.html', + }, license: 'Licence MIT', }, }; -- cgit v1.2.3