Skip to content

Commit

Permalink
feat: add missing english translations for the results page
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastien Gatellier committed Nov 22, 2023
1 parent 0b64876 commit 9af25b3
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 40 deletions.
64 changes: 63 additions & 1 deletion i18n/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,58 @@
other = "An error occured during analysis"
[AbortAnalysis]
other = "Stop analysis"
[ResultScore]
other = "Score:"
[ResultScoreExplainationLabel]
other = "What does my score mean"
[ResultScoreExplainationContent]
other = "Environmental performance is represented by a score out of 100 and a grade from A to G (the higher the grade, the better!). Environmental performance is calculated on the basis of 3 technical indicators: weight, complexity and number of page requests."
[ResultScoreExplainationKnowMore]
other = "Find out more:"
[ResultNotationInfoNumberSize]
other = "<span data-int=\"size\">0</span> Mb"
[ResultNotationInfoNumberNodes]
other = "<span data-int=\"nodes\">0</span> elements"
[ResultNotationInfoNumberRequests]
other = "<span data-int=\"requests\">0</span> requests"
[ResultFootprintIndicatorsLabel]
other = "What are the indicators?"
[ResultFootprintResultsWaterText]
other = "Blue water <br />consumption"
[ResultFootprintResultsGESText]
other = "Greenhouse gas emissions"
[ResultFootprintExplainationTitle ]
other = "What does that mean?<hr>"
[ResultFootprintExplainationText ]
other = "To give you an idea, 1 kg CO2e is equivalent to a journey of around **3 km by car**. A shower uses an average of 6 litres of water per minute. <br><br>If your page emits **1,7g CO2e** and uses **2,5cl of water**, that means that for 1000 monthly visitors, the footprint is **1,7kg de CO2e and 25 litres of water** per month – equivalent to a 5.5km car journey and a 4-minute shower."
[ResultFootprintExplainationMoreInfo ]
other = "To find out more: <a lang=\"fr\" hreflang=\"fr\" href=\"https://raphael-lemaire.com/2020/02/02/mise-en-perspective-suite/\">Mise en perspective des impacts écologiques du numérique</a>"
[ResultDetailsCalculationExplainedLabel]
other = "How is the score calculated?"
[ResultDetailsCalculationExplainedContent]
other = "To calculate the environmental performance of a page, we take several factors into account: the number of elements in the DOM (Document Object Model), the weight of the data transferred and the number of HTTP requests. Find out more about our calculation method."
[ResultDetailsResultWeightLabel]
other = "Page weight"
[ResultDetailsResultWeightUnits]
other = "Mb"
[ResultDetailsResultWeightUnitsLegend]
other = "megabyte (Mb)"
[ResultDetailsResultComplexityLabel]
other = "Complexity"
[ResultDetailsResultComplexityUnits]
other = "elements"
[ResultDetailsResultComplexityUnitsLegend]
other = "Number of DOM elements"
[ResultDetailsResultRequestsLabel]
other = "Requests"
[ResultDetailsResultRequestsUnits]
other = "requests"
[ResultDetailsResultRequestsUnitsLegend]
other = "Number of server requests"
[HowDoesItWorksURL]
other = "/en/how-it-works"
[HowDoesItWorksTitle]
other = "How does it work?"
[Back]
other = "Back"
[ReTest]
Expand Down Expand Up @@ -93,4 +145,14 @@ More information on page [How it works](/how-it-works/)."""
[ShareTheResult]
other = "Share my result"
[CopyURL]
other = "Copy the address"
other = "Copy the address"
[Target]
other = "Target:"
[Unit]
other = "Unit:"
[Max]
other = "max"
[Median]
other = "median:"
[Min]
other = "min"
64 changes: 63 additions & 1 deletion i18n/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,58 @@
other = "Erreur lors de l’analyse"
[AbortAnalysis]
other = "Arrêter l’analyse"
[ResultScore]
other = "Score&nbsp;:"
[ResultScoreExplainationLabel]
other = "Que veut dire mon score"
[ResultScoreExplainationContent]
other = "La performance environnementale est représentée par un score sur 100 et une note de A à G (plus la note tend vers A, plus le score est élevé, mieux c’est !). La performance environnementale est calculée en fonction de 3 indicateurs techniques : le poids, la complexité, et le nombre de requêtes de la page."
[ResultScoreExplainationKnowMore]
other = "En savoir plus&nbsp;:"
[ResultNotationInfoNumberSize]
other = "<span data-int=\"size\">0</span> Mo"
[ResultNotationInfoNumberNodes]
other = "<span data-int=\"nodes\">0</span> éléments"
[ResultNotationInfoNumberRequests]
other = "<span data-int=\"requests\">0</span> requêtes"
[ResultFootprintIndicatorsLabel]
other = "Quels sont les indicateurs ?"
[ResultFootprintResultsWaterText]
other = "Consommation <br />d’eau bleue"
[ResultFootprintResultsGESText]
other = "Émission de gaz <br />à effet de serre"
[ResultFootprintExplainationTitle ]
other = "Ça veut dire quoi ?<hr>"
[ResultFootprintExplainationText ]
other = "Pour vous donner une idée, 1 kg CO2e équivaut à un trajet d’environ **3 km en voiture**. Une douche consomme en moyenne 6 litres d’eau à la minute. <br><br>Si votre page émet **1,7g CO2e** et consomme **2,5cl d’eau**, cela signifie que pour 1000 visiteurs mensuels, l’empreinte est de **1,7kg de CO2e et 25 litres d’eau** par mois – soit un trajet de 5,5km en voiture et une douche de 4 minutes."
[ResultFootprintExplainationMoreInfo ]
other = "Pour aller plus loin : <a href=\"https://raphael-lemaire.com/2020/02/02/mise-en-perspective-suite/\">Mise en perspective des impacts écologiques du numérique</a>"
[ResultDetailsCalculationExplainedLabel]
other = "Comment est calculé le score ?"
[ResultDetailsCalculationExplainedContent]
other = "Pour calculer la performance environnementale d’une page, nous prenons en compte plusieurs éléments : le nombre d’éléments du DOM (Document Object Model), le poids des données transférées, et le nombre de requêtes HTTP. Pour en savoir plus sur notre méthode de calcul."
[ResultDetailsResultWeightLabel]
other = "Poids de la page"
[ResultDetailsResultWeightUnits]
other = "Mo"
[ResultDetailsResultWeightUnitsLegend]
other = "mégaoctet (Mo)"
[ResultDetailsResultComplexityLabel]
other = "Complexité"
[ResultDetailsResultComplexityUnits]
other = "éléments"
[ResultDetailsResultComplexityUnitsLegend]
other = "Nombre d’éléments du DOM"
[ResultDetailsResultRequestsLabel]
other = "Requêtes"
[ResultDetailsResultRequestsUnits]
other = "requêtes"
[ResultDetailsResultRequestsUnitsLegend]
other = "Nombre de requêtes serveur"
[HowDoesItWorksURL]
other = "/comment-ca-marche"
[HowDoesItWorksTitle]
other = "Comment ça marche ?"
[Back]
other = "Retour"
[ReTest]
Expand Down Expand Up @@ -93,4 +145,14 @@ Pour en savoir plus, veuiller consulter la page [Comment ça marche ?](/commen
[ShareTheResult]
other = "Partager mon résultat"
[CopyURL]
other = "Copier l’adresse"
other = "Copier l’adresse"
[Target]
other = "Cible&nbsp;:"
[Unit]
other = "Unité&nbsp;:"
[Max]
other = "max"
[Median]
other = "médiane&nbsp;:"
[Min]
other = "min"
2 changes: 1 addition & 1 deletion layouts/partials/components/collapse.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<div>{{ .content | printf "%s\n\n<p></p>" | markdownify | replaceRE "\n*<p></p>\n*$" "" | safeHTML }}</div>
{{ if and (isset . "moreHref") (isset . "moreLabel") }}
<hr class="x-small" />
En savoir plus :&nbsp;
{{ .knowMore }}
{{ partial "components/content-link" (dict
"href" .moreHref
"label" .moreLabel
Expand Down
10 changes: 5 additions & 5 deletions layouts/partials/components/result-load-range.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@
</div>
<div class="rlr-slider-labels">
{{/* TODO: add to dictionary */}}
<span>min</span>
<span>{{ i18n "Min" }}</span>
{{/* TODO: get medium from api ? */}}
<span>mediane: {{ $rangeMedianRounded }}</span>
<span>max</span>
<span>{{ i18n "Median" }} {{ $rangeMedianRounded }}</span>
<span>{{ i18n "Max" }}</span>
</div>
</div>
<div class="rlr-infos">
<span class="rlr-target-info">Cible : {{ .rangeValueTarget | markdownify }}</span>
<span class="rlr-unit">Unité : {{ .unitsLegend | markdownify }}</span>
<span class="rlr-target-info">{{ i18n "Target" }} {{ .rangeValueTarget | markdownify }}</span>
<span class="rlr-unit">{{ i18n "Unit" }} {{ .unitsLegend | markdownify }}</span>
</div>
</div>
23 changes: 15 additions & 8 deletions layouts/partials/widgets/result-appreciation.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,23 @@
</div>
<h2 data-int="grade_title"></h2>
<p class="font-size:1">
Score : <span><span data-int="score">0</span> / 100</span>
{{ i18n "ResultScore" }} <span><span data-int="score">0</span> / 100</span>
</p>
<hr class="small" />
<div class="info-collapse">
{{ $label := i18n "ResultScoreExplainationLabel" }}
{{ $content := i18n "ResultScoreExplainationContent" }}
{{ $knowMore := i18n "ResultScoreExplainationKnowMore" }}
{{ $moreHref := i18n "HowDoesItWorksURL" }}
{{ $moreLabel := i18n "HowDoesItWorksTitle" }}

{{ partial "components/collapse" (dict
"context" .
"label" "Que veut dire mon score"
"content" "La performance environnementale est représentée par un score sur 100 et une note de A à G (plus la note tend vers A, plus le score est élevé, mieux c’est !). La performance environnementale est calculée en fonction de 3 indicateurs techniques : le poids, la complexité, et le nombre de requêtes de la page."
"moreHref" "/comment-ca-marche"
"moreLabel" "Comment ça marche"
"label" $label
"content" $content
"knowMore" $knowMore
"moreHref" $moreHref
"moreLabel" $moreLabel
)
}}
</div>
Expand Down Expand Up @@ -80,19 +87,19 @@ <h2 data-int="grade_title"></h2>
<span class="result-notation-info-label" data-int-attr="size_binary_score">
<span data-int="size_verdict"></span>
</span>
<span class="result-notation-info-number"><span data-int="size">0</span> Mo</span>
<span class="result-notation-info-number">{{ i18n "ResultNotationInfoNumberSize" | safeHTML }}</span>
</li>
<li class="result-notation-info-item">
<span class="result-notation-info-label" data-int-attr="nodes_binary_score">
<span data-int="nodes_verdict"></span>
</span>
<span class="result-notation-info-number"><span data-int="nodes">0</span> éléments</span>
<span class="result-notation-info-number">{{ i18n "ResultNotationInfoNumberNodes" | safeHTML }}</span>
</li>
<li class="result-notation-info-item">
<span class="result-notation-info-label" data-int-attr="requests_binary_score">
<span data-int="requests_verdict"></span>
</span>
<span class="result-notation-info-number"><span data-int="requests">0</span> requêtes</span>
<span class="result-notation-info-number">{{ i18n "ResultNotationInfoNumberRequests" | safeHTML }}</span>
</li>
</ul>
{{/* TODO: On click go to detail section */}}
Expand Down
46 changes: 30 additions & 16 deletions layouts/partials/widgets/result-details-score.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ <h2 id="score-details">{{ i18n `ScoreDetails` }}</h2>
<p class="font-size:1">{{ i18n `AboutScoreDetails` }}</p>
<hr class="small" />
<div class="info-collapse">
{{ $label := i18n "ResultDetailsCalculationExplainedLabel" }}
{{ $content := i18n "ResultDetailsCalculationExplainedContent" }}
{{ $moreHref := i18n "HowDoesItWorksURL" }}
{{ $moreLabel := i18n "HowDoesItWorksTitle" }}

{{ partial "components/collapse" (dict
"context" .
"label" "Comment est calculé le score ?"
"content" "Pour calculer la performance environnementale d’une page, nous prenons en compte plusieurs éléments : le nombre d’éléments du DOM (Document Object Model), le poids des données transférées, et le nombre de requêtes HTTP. Pour en savoir plus sur notre méthode de calcul."
"moreHref" "/comment-ca-marche"
"moreLabel" "Comment ça marche"
"label" $label
"content" $content
"moreHref" $moreHref
"moreLabel" $moreLabel
)
}}
</div>
Expand All @@ -22,44 +27,53 @@ <h2 id="score-details">{{ i18n `ScoreDetails` }}</h2>
{{/* TODO: get notes colors from value with min and max */}}
{{/* TODO: interactive */}}
{{/* Weight result details */}}
{{ $title := i18n "ResultDetailsResultWeightLabel" }}
{{ $units := i18n "ResultDetailsResultWeightUnits" }}
{{ $unitsLegend := i18n "ResultDetailsResultWeightUnitsLegend" }}
{{ partial "components/result-load-range" (dict
"title" "Poids de la page"
"title" $title
"icon" "weight"
"verdict" "<span >Trop lourde</span>"
"verdict" "<span>Trop lourde</span>"
"rangeValue" "<span data-int='size'></span>"
"rangeValueMin" "0"
"rangeValueMax" "4.82"
"rangeValueTarget" "1.024"
"units" "Mo"
"unitsLegend" "mégaoctet (Mo)"
"units" $units
"unitsLegend" $unitsLegend
"dataValueKey" "size"
)
}}
{{/* Dom complexity result details */}}
{{ $title := i18n "ResultDetailsResultComplexityLabel" }}
{{ $units := i18n "ResultDetailsResultComplexityUnits" }}
{{ $unitsLegend := i18n "ResultDetailsResultComplexityUnitsLegend" }}
{{ partial "components/result-load-range" (dict
"title" "Complexité"
"title" $title
"icon" "complexity"
"verdict" "<span >Trop complexe</span>"
"verdict" "<span>Trop complexe</span>"
"rangeValue" "<span data-int='nodes'></span>"
"rangeValueMin" "0"
"rangeValueMax" "1386"
"rangeValueTarget" "600"
"units" "éléments"
"unitsLegend" "Nombre d’éléments du DOM"
"units" $units
"unitsLegend" $unitsLegend
"dataValueKey" "nodes"
)
}}
{{/* Request number result details */}}
{{ $title := i18n "ResultDetailsResultRequestsLabel" }}
{{ $units := i18n "ResultDetailsResultRequestsUnits" }}
{{ $unitsLegend := i18n "ResultDetailsResultRequestsUnitsLegend" }}
{{ partial "components/result-load-range" (dict
"title" "Requêtes"
"title" $title
"icon" "request"
"verdict" "<span >Peu de requêtes</span>"
"verdict" "<span>Peu de requêtes</span>"
"rangeValue" "<span data-int='requests'></span>"
"rangeValueMin" "0"
"rangeValueMax" "156"
"rangeValueTarget" "40"
"units" "requêtes"
"unitsLegend" "Nombre de requêtes serveur"
"units" $units
"unitsLegend" $unitsLegend
"dataValueKey" "requests"
)
}}
Expand Down
25 changes: 17 additions & 8 deletions layouts/partials/widgets/result-empreinte.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
<h2>{{ i18n `EnvironmentalFootprint` }}</h2>
<hr class="small" />
<div class="info-collapse">
{{ $label := i18n "ResultFootprintIndicatorsLabel" }}
{{ $moreHref := i18n "HowDoesItWorksURL" }}
{{ $moreLabel := i18n "HowDoesItWorksTitle" }}

{{ partial "components/collapse" (dict
"context" .
"label" "Quels sont les indicateurs ?"
"label" $label
"content" .Params.collapse_info
"moreHref" "/comment-ca-marche"
"moreLabel" "Comment ça marche"
"moreHref" $moreHref
"moreLabel" $moreLabel
)
}}
</div>
Expand All @@ -29,23 +33,28 @@ <h2>{{ i18n `EnvironmentalFootprint` }}</h2>
</p>
{{/* Footprint results from page */}}
<div class="grid-l " style="--min-cell-width:160px;">
{{ $title := i18n "ResultFootprintResultsWaterText" | safeHTML }}
{{ partial "components/highlight-info-card" (dict
"icon" "water-drop"
"title" "<span class='footprint-result' data-int='water' data-unit='cl'>0</span>"
"text" "Consommation <br />d'eau bleue"
"text" $title
)
}}
{{ $title := i18n "ResultFootprintResultsGESText" | safeHTML }}
{{ partial "components/highlight-info-card" (dict
"icon" "cloud"
"title" "<span class='footprint-result' data-int='ges' data-unit='gCO2e'>0</span>"
"text" "Émission de gaz <br />à effet de serre"
"text" $title
)
}}
</div>
{{ $title := i18n "ResultFootprintExplainationTitle" }}
{{ $text := i18n "ResultFootprintExplainationText" }}
{{ $moreInfo := i18n "ResultFootprintExplainationMoreInfo" | safeHTML }}
{{ partial "components/highlight-info-card" (dict
"title" "Ça veut dire quoi ?<hr>"
"text" "Pour vous donner une idée, 1 kg CO2e équivaut à un trajet d’environ **3 km en voiture**. Une douche consomme en moyenne 6 litres d’eau à la minute. <br><br>Si votre page émet **1,7g CO2e** et consomme **2,5cl d’eau**, cela signifie que pour 1000 visiteurs mensuels, l’empreinte est de **1,7kg de CO2e et 25 litres d’eau** par mois – soit un trajet de 5,5km en voiture et une douche de 4 minutes."
"moreInfo" "Pour aller plus loin : <a href='https://raphael-lemaire.com/2020/02/02/mise-en-perspective-suite/'>Mise en perspective des impacts écologiques du numérique</a>"
"title" $title
"text" $text
"moreInfo" $moreInfo
)
}}
</div>
Expand Down

0 comments on commit 9af25b3

Please sign in to comment.