diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-10-28 17:08:13 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-10-28 17:21:41 +0200 |
| commit | 2a8464001efce8c76e8109af7eb68d9e86105692 (patch) | |
| tree | efb3c1f2543515a10815dfaf81588e578e8878cd /htdocs/src/js | |
| parent | b7334838318e4a42171491349038941d347538a0 (diff) | |
chore: add legal notice
In France, legal notice is required for any website.
Diffstat (limited to 'htdocs/src/js')
| -rw-r--r-- | htdocs/src/js/app.js | 15 | ||||
| -rw-r--r-- | htdocs/src/js/i18n/locales/en.js | 4 | ||||
| -rw-r--r-- | htdocs/src/js/i18n/locales/fr.js | 4 |
3 files changed, 22 insertions, 1 deletions
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', }, }; |
