From 8b4577498806a35aa012abb847d0f5485216553f Mon Sep 17 00:00:00 2001 From: Boris SCHAPIRA <5836514+goalcc@users.noreply.github.com> Date: Fri, 29 Nov 2019 18:17:05 +0100 Subject: [PATCH] FR - Language-specific templates part I (#564) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * FR - Language-specific templates part I * Adding pluralization of the word "comment" to the EN version * Adding French to supported languages * Adding myself to contributors (assuming I join the translators team) * Removing inline style - Does not conform with the CSP - Is useless with the CSS styling * Change logic for comment pluralization Show the right word according to the number of comment. * Translating a string * Update src/config/2019.json Co-Authored-By: Barry Pollard * Update src/config/2019.json Co-Authored-By: Barry Pollard * Update src/templates/fr/2019/base_chapter.html Co-Authored-By: Barry Pollard * Adding some missing translation on alternatives * Add FR translation for Contributors template * Add FR translation for Index template * Hardcode Contributors's team names in FR According to https://github.com/HTTPArchive/almanac.httparchive.org/issues/568#issuecomment-559600373 * Update src/templates/fr/2019/contributors.html Co-Authored-By: Barry Pollard * Update src/templates/fr/2019/contributors.html Co-Authored-By: Barry Pollard * Localize Breadcrumb's name * Fixing a missed "on" => "sur" * Update src/templates/fr/2019/base_chapter.html Co-Authored-By: Barry Pollard * Improving alternatives on avatars * Update src/templates/fr/2019/contributors.html Co-Authored-By: Barry Pollard * Improving wording on "one's website" to "site web de…" * Typofix Web Almanac * FR - Localized Team Names With fallback to English team names if the dictionary is not populated. related to #569 * Using a null coalescing operator instead of duplicating HTML markup. Thanks @mikegeyser * Update src/templates/fr/2019/base_chapter.html Co-Authored-By: Barry Pollard * Update src/templates/fr/2019/chapter.html Co-Authored-By: Barry Pollard --- src/config/2019.json | 11 + src/language.py | 1 + src/static/css/page.css | 3 + src/static/js/chapter.js | 5 +- src/templates/en/2019/base_chapter.html | 2 +- src/templates/fr/2019/base.html | 166 +++++++++ src/templates/fr/2019/base_chapter.html | 149 ++++++++ src/templates/fr/2019/chapter.html | 132 +++++++ src/templates/fr/2019/contributors.html | 442 ++++++++++++++++++++++++ src/templates/fr/2019/index.html | 169 +++++++++ 10 files changed, 1078 insertions(+), 2 deletions(-) create mode 100644 src/templates/fr/2019/base.html create mode 100644 src/templates/fr/2019/base_chapter.html create mode 100644 src/templates/fr/2019/chapter.html create mode 100644 src/templates/fr/2019/contributors.html create mode 100644 src/templates/fr/2019/index.html diff --git a/src/config/2019.json b/src/config/2019.json index 1762b202..536ab0ad 100644 --- a/src/config/2019.json +++ b/src/config/2019.json @@ -311,6 +311,17 @@ "github": "bkardell", "twitter": "briankardell" }, + "borisschapira": { + "name": "Boris Schapira", + "teams": [ + "developers", + "translators" + ], + "avatar_url": "https:\/\/avatars1.githubusercontent.com\/u\/284742?v=4&s=200", + "website": "https:\/\/boris.schapira.dev", + "github": "borisschapira", + "twitter": "boostmarks" + }, "caraya": { "name": "Carlos Araya", "teams": [ diff --git a/src/language.py b/src/language.py index 66e17b12..52c5d82c 100644 --- a/src/language.py +++ b/src/language.py @@ -30,6 +30,7 @@ class Language(object): JAPANESE = _Language('日本語', 'ja', 'JP') ENGLISH = _Language('English', 'en', 'US') SPANISH = _Language('Español', 'es', 'ES') + FRENCH = _Language('Français', 'fr', 'FR') DEFAULT_LANGUAGE = Language.ENGLISH diff --git a/src/static/css/page.css b/src/static/css/page.css index bd51cfa2..66e2a55e 100644 --- a/src/static/css/page.css +++ b/src/static/css/page.css @@ -154,6 +154,9 @@ #num_comments { line-height: 24px; } +[data-translation] { + display: none; +} .authors h4{ padding: 16px 0; diff --git a/src/static/js/chapter.js b/src/static/js/chapter.js index 6c81b6d3..99ae39f4 100644 --- a/src/static/js/chapter.js +++ b/src/static/js/chapter.js @@ -239,7 +239,10 @@ function setDiscussionCount() { return; } var el = document.getElementById('num_comments'); - el.innerText = comments + ' ' + (comments == 1 ? 'comment' : 'comments'); + el.innerText = comments; + + document.getElementById(comments <= 1 ? 'comment-singular' : 'comment-plural').removeAttribute('data-translation'); + gtag('event', 'discussion-count', { 'event_category': 'user', 'event_label': 'enabled', 'value': 1 }); }) .catch(function (err) { diff --git a/src/templates/en/2019/base_chapter.html b/src/templates/en/2019/base_chapter.html index 5363da7a..273b38a1 100644 --- a/src/templates/en/2019/base_chapter.html +++ b/src/templates/en/2019/base_chapter.html @@ -44,7 +44,7 @@ {% macro render_actions() %} {% endmacro %} diff --git a/src/templates/fr/2019/base.html b/src/templates/fr/2019/base.html new file mode 100644 index 00000000..5454c23e --- /dev/null +++ b/src/templates/fr/2019/base.html @@ -0,0 +1,166 @@ +{% extends "base.html" %} + +{% block styles %} + + + +{% endblock %} + +{% block content%} + {% block header %} +
+
+ + +
+ {% if request.endpoint == 'home' %} + + Commencer l'exploration + + {% endif %} + {{ language_switcher() }} +
+ + +
+ {% if request.endpoint == 'home' %} +
+
+
2019
+

Web Almanac

+

+ Rapport annuel
+ de HTTP Archive sur
+ l'état du Web +

+

+ Notre mission est de combiner les statistiques brutes et les tendances de HTTP Archive avec l'expertise de la communauté web. Le Web Almanac est un rapport complet sur l'état du Web, soutenu par des données réelles et des experts du Web. Il est composé de 20 chapitres couvrant l'expérience utilisateur, le contenu des pages, leur publication et leur distribution. +

+ + Commencer l'exploration + +
+ Édition 2019 du Web Almanac + Web Almanac +
+ {% endif %} +
+ {% endblock %} + + {% block main %}{% endblock %} + + {% block footer %} + + {% endblock %} + {% block scripts %} + + {% endblock %} +{% endblock %} + +{% macro language_switcher() %} +{% if supported_languages | length > 1%} +
+ {% if language is not none %} + + {% else %} + + {% endif %} + + ouvrir +
+{% endif %} +{% endmacro %} + +{% macro year_switcher() %} +
+ + ouvrir +
+{% endmacro %} diff --git a/src/templates/fr/2019/base_chapter.html b/src/templates/fr/2019/base_chapter.html new file mode 100644 index 00000000..fe92f088 --- /dev/null +++ b/src/templates/fr/2019/base_chapter.html @@ -0,0 +1,149 @@ +{% extends "fr/2019/base.html" %} + +{% block title %}{{ metadata.get('title') }} | 2019 | Le Web Almanac par HTTP Archive{% endblock %} + +{% block styles %} +{{ super() }} + +{% endblock %} + +{% block scripts %} +{{ super() }} + + + + +{% endblock %} + +{# Calls to action for readers who want to engage more with this chapter. #} +{% macro render_actions() %} + +{% endmacro %} + + +{% macro render_byline() %} + + + + + {% if metadata.get('translators') | length > 1 %} + + {% endif %} +{% endmacro %} + +{% macro render_authors() %} + {% for author in metadata.get('authors') %} + {% if loop.length == 1 %}

Auteur·ice

{% endif -%} + {% if loop.length > 1 and loop.index == 1 %}

Auteur·ice·s

{% endif %} + {% if loop.index == 1 %}
    {% endif %} + {% set authordata = config.contributors[author] if author in config.contributors else None %} + {% if authordata %} +
  • + avatar de {{ authordata.name }} +
    + {{ authordata.name if authordata.name else author }} + {% if authordata.twitter or authordata.github %} + + {% endif %} + {% if authordata.tagline %} +
    + {{ authordata.tagline }} +
    + {% endif %} + {% if authordata.bio %} +
    + {{ authordata.bio | safe }} +
    + {% endif %} +
    +
  • + {% else %} +
  • +
    + {{ author }} +
    +
  • + {% endif %} + {% endfor %} +
+{% endmacro %} + +{% macro render_prevnext() %} + {% if prev_chapter %} + + + + Chapitre {{ prev_chapter['chapter'] }} + + + {{ prev_chapter['title'] }} + + + {% endif %} + + {% if next_chapter %} + + + + Chapitre {{ next_chapter['chapter'] }} + + + {{ next_chapter['title'] }} + + + {% endif %} +{% endmacro %} diff --git a/src/templates/fr/2019/chapter.html b/src/templates/fr/2019/chapter.html new file mode 100644 index 00000000..d782599e --- /dev/null +++ b/src/templates/fr/2019/chapter.html @@ -0,0 +1,132 @@ +{% extends "fr/2019/base_chapter.html" %} + + + +{% set metadata = <%- JSON.stringify(metadata) %> %} + +{% block description %}{{ metadata.get('description','Chapitre' + metadata.get('title') + ' du Web Almanac'+ year + " explorant l'utilisation des " + metadata.get('description',metadata.get('title')) + ' sur le web.') }}{% endblock %} + +{% block meta %} + + + + + + + + + + + + + + + + + + +{% endblock %} + +{% block main %} +
+ + +
+
+
+ Partie {{ metadata.get('part_number') }} Chapitre {{ metadata.get('chapter_number') }} +
+

+ {{ metadata.get('title') }} + {% if metadata.get('unedited', false) %} + [non corrigé] + {% endif %} +

+ + {{ render_byline() }} + <%- body %> +
+ {{ render_actions() }} +
+ {{ render_authors() }} +
+ + +
+
+{% endblock %} diff --git a/src/templates/fr/2019/contributors.html b/src/templates/fr/2019/contributors.html new file mode 100644 index 00000000..3ef8eb7d --- /dev/null +++ b/src/templates/fr/2019/contributors.html @@ -0,0 +1,442 @@ +{% extends "fr/2019/base.html" %} + +{% block title %}Contributeurs et contributrices 2019 | Web Almanac par HTTP Archive{% endblock %} + +{% block description %}Les {{ config.contributors.items() | length }} personnes ayant contribué au Web Almanac 2019 par leurs analyses, leurs écrits, leurs réflexions, leurs participations au design, leur code, leurs éditions, leurs relectures, ou leurs traductions.{% endblock %} + +{% block meta %} + + + + + + + + + + + + + + + + + + + +{% endblock %} + +{% block styles %} +{{ super() }} + +{% endblock %} + +{% block main %} +
+

+ Contributeurs et contributrices +

+
+ + + + + + +
+
+
{{ config.contributors.items() | length }} personnes
+
+

Filtrer par équipe :

+ {% set localizedTeamNames = { + "analysts": "Analyse", + "authors": "Rédaction", + "brainstormers": "Réflexion", + "designers": "Design", + "developers": "Développement", + "editors": "Édition", + "reviewers": "Relecture", + "translators": "Traduction", + } %} + {% for id, team in config.teams.items() %} + + {% endfor %} +
+ +
+ {% for id, contributor in config.contributors.items() %} +
+ avatar de {{ contributor.name }} +
{{ contributor.name }}
+ +
+ {% if contributor.github %} + GitHub + {% endif %} + {% if contributor.twitter %} + Twitter + {% endif %} + {% if contributor.website %} + Site Web + {% endif %} +
+ +
+ {% for id in contributor.teams | sort() %} + {{ config.teams[id].name }} + {% endfor %} +
+
+ {% endfor %} +
+
+
+{% endblock %} + +{% block scripts %} + {{ super() }} + +{% endblock %} diff --git a/src/templates/fr/2019/index.html b/src/templates/fr/2019/index.html new file mode 100644 index 00000000..0e21e007 --- /dev/null +++ b/src/templates/fr/2019/index.html @@ -0,0 +1,169 @@ +{% extends "fr/2019/base.html" %} + +{% block title %}Web Almanac 2019{% endblock %} + +{% block description %}Le Web Almanac est un rapport annuel sur l'état du Web qui combine l'expertise de la communauté Web avec les données et tendances de HTTP Archive.{% endblock %} + +{% block meta %} + + + + + + + + + + + + + + + + + + + + +{% endblock %} + +{% block styles %} + {{ super() }} + +{% endblock %} + +{% block main %} +
+ +
+ {% set contributors = config.contributors.keys() | length %} +
+

Contributeurs et contributrices

+

+ Le Web Almanac a été rendu possible grâce au travail acharné de la communauté Web. {{ contributors }} personnes ont consacré bénévolement d'innombrables heures à le planifier, faire des recherches, le rédiger et le mettre à votre disposition. +

+ + Voir les contributeurs et contributrices + +
+
+
{{ contributors }}
+ + + +
+
+
+
+

Méthodologie

+
+
+
+ Sites Web testés +
+
+ 5,8 M +
+
+
+
+ Données traitées +
+
+ 20,9 TB +
+
+
+

+ Sauf indication contraire, les statistiques des 20 chapitres du Web Almanac proviennent du jeu de données HTTP Archiven, un projet communautaire qui suit l'évolution de la construction du web depuis 2010. Grâce à WebPageTest et Lighthouse, HTTP Archive collecte chaque mois les métadonnées de près de 6 millions de sites Web et les insère dans une base de données publique BigQuery pour les analyser. Le jeu de données de juillet 2019 a servi de base aux mesures du Web Almanac. Pour plus d'informations, consultez la page Méthodologie. +

+ + En savoir plus sur la Méthodologie + + +
+
+
+{% endblock %}