Skip to content

Commit

Permalink
bring back translation compilation process, remove some html from tra…
Browse files Browse the repository at this point in the history
…nslation strings
  • Loading branch information
tsubik committed Feb 27, 2025
1 parent 5d33e3a commit d91e007
Show file tree
Hide file tree
Showing 15 changed files with 96 additions and 58 deletions.
12 changes: 9 additions & 3 deletions components/map/layer-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@ import { injectIntl } from 'react-intl';
import Html from 'components/html';

const LayerInfo = ({ metadata, intl }) => {
const intlWithHTML = (id) =>
intl.formatMessage({ id }, {
h4: chunks => `<h4>${chunks}</h4>`,
p: chunks => `<p>${chunks}</p>`
})

return (
<div className="c-layer-info">
<h2 className="c-layer-info__title">
{intl.formatMessage({ id: metadata.title })} {metadata.dateOfContent && `(${metadata.dateOfContent})`}
</h2>
<p className="c-layer-info__subtitle">{intl.formatMessage({ id: metadata.subtitle })}</p>
<p className="c-layer-info__subtitle">{intlWithHTML(metadata.subtitle)}</p>
<div className="c-layer-info__overview">
<h3>{intl.formatMessage({ id: 'overview' })}</h3>
<Html html={intl.formatMessage({ id: metadata.overview })} linkify />
<Html html={intlWithHTML(metadata.overview)} linkify />
</div>

<div className="c-layer-info__source">
<h3>{intl.formatMessage({ id: 'source' })}</h3>
<Html html={intl.formatMessage({ id: metadata.source })} linkify />
<Html html={intlWithHTML(metadata.source)} linkify />
</div>
</div>
)
Expand Down
38 changes: 19 additions & 19 deletions components/map/legend/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,23 +108,23 @@ class LegendComponent extends PureComponent {
renderDisclaimer = ({ disclaimer, disclaimerTooltip }) => {
const { intl } = this.props;

return renderHtml(intl.formatMessage({ id: disclaimer }), {
replace: (node) => {
if (node.attribs && node.attribs.class === 'highlight' && disclaimerTooltip) {
return (
<Tooltip
placement="bottom"
overlay={
<div style={{ maxWidth: 200 }}>
{intl.formatMessage({ id: disclaimerTooltip })}
</div>
}
overlayClassName="c-tooltip no-pointer-events"
>
<span className="highlight">{node.children[0].data}</span>
</Tooltip>
);
}
return intl.formatMessage({ id: disclaimer }, {
highlight: chunks => {
if (!disclaimerTooltip) return <span className="highlight">{chunks}</span>;

return (
<Tooltip
placement="bottom"
overlay={
<div style={{ maxWidth: 200 }}>
{intl.formatMessage({ id: disclaimerTooltip })}
</div>
}
overlayClassName="c-tooltip no-pointer-events"
>
<span className="highlight">{chunks}</span>
</Tooltip>
)
}
});
}
Expand Down Expand Up @@ -159,7 +159,7 @@ class LegendComponent extends PureComponent {
<LegendItemButtonVisibility />
</LegendItemToolbar>
)
}
}
onChangeInfo={(l => this.onChangeInfo(true, layerGroup.id))}
onChangeVisibility={((l, visibility) => this.onChangeVisibility(l, visibility, layerGroup.id))}
onChangeOpacity={(l, opacity) => this.onChangeOpacity(l, opacity, layerGroup.id)}
Expand Down Expand Up @@ -199,7 +199,7 @@ class LegendComponent extends PureComponent {
</div>
)}
</LegendListItem>
))}
))}
</Legend>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ function DocumentsCertification(props) {
<h3 className="c-title -proximanova -extrabig -uppercase">
{intl.formatMessage({ id: 'operator-detail.license' })}
</h3>
<p dangerouslySetInnerHTML={{ __html: intl.formatMessage({ id: `operator-detail.license.${status}` }) }} />
<p>
{status !== 'doc_not_provided' && intl.formatMessage({ id: `operator-detail.license.${status}` })}
{status === 'doc_not_provided' && intl.formatMessage(
{ id: `operator-detail.license.doc_not_provided` },
{ a: (chunks) => <a href="https://opentimberportal.org/static/pdf/AUTORISATION-ENTREPRISES-FINALE.pdf" target="_blank">{chunks}</a> }
)}
</p>
</header>

<div className="row l-row -equal-heigth">
Expand Down
8 changes: 6 additions & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,12 @@
"notrequired-file": "Non applicable",
"delete": "Delete",
"cancel": "Cancel",
"confirm": "Confirm",
"submit": "Submit",
"send": "Send",
"document.delete.title": "Delete {document}?",
"document.delete.text": "Are you sure you want to delete document {document}?",
"document.delete.error": "An error occurred while deleting the document.",
"high": "High",
"medium": "Medium",
"low": "Low",
Expand Down Expand Up @@ -230,7 +234,7 @@
"operator-detail.license": "Publication authorization",
"operator-detail.license.doc_valid": "You will find here your signed publication authorization",
"operator-detail.license.doc_pending": "You will find here your signed publication authorization. We are validating it",
"operator-detail.license.doc_not_provided": "The signature of your <a href=\"https://opentimberportal.org/static/pdf/AUTORISATION-ENTREPRISES-FINALE.pdf\" target=\"_blank\">publication authorization<a> is still pending, which prevents the publication of the documents you uploaded.",
"operator-detail.license.doc_not_provided": "The signature of your <a>publication authorization</a> is still pending, which prevents the publication of the documents you uploaded.",
"operator-detail.subtitle": "Transparency ranking: {rank} out of {rankCount} in {country}",
"operator-detail.tabs.fmus": "Forest management units",
"operator-detail.overview.card1.title": "Required documents uploaded",
Expand Down Expand Up @@ -407,7 +411,7 @@
"layer.tree-cover-gain.metadata.overview": "<p> This data set from the GLAD (Global Land Analysis & Discovery) lab at the University of Maryland measures areas of tree cover gain from the year 2000 to 2020 across the globe at 30 × 30 meter resolution, displayed as a 20-year cumulative layer. Tree cover gain was determined using tree height information from the years 2000 and 2020. Tree height was modeled by the integration of the Global Ecosystem Dynamics Investigation (GEDI) lidar forest structure measurements and Landsat analysis-ready data time-series. The NASA GEDI is a spaceborne lidar instrument operating onboard the International Space Station since April 2019. It provides point-based measurements of vegetation structure, including forest canopy height at latitudes between 52°N and 52°S globally. Gain was identified where pixels had tree height ≥5 m in 2020 and tree height <5 m in 2000. </p> <p> Tree cover gain may indicate a number of potential activities, including natural forest growth, the tree crop rotation cycle, or tree plantation management. </p> <p> When zoomed out (< zoom level 12), pixels of gain are shaded according to the density of gain at the 30 x 30 meter scale. Pixels with darker shading represent areas with a higher concentration of tree cover gain, whereas pixels with lighter shading indicate a lower concentration of tree cover gain. There is no variation in pixel shading when the data is at full resolution (≥ zoom level 12). </p>",
"layer.tree-cover-gain.metadata.source": "<p> Potapov, P., Hansen, M.C., Pickens, A., Hernandez-Serna, A., Tyukavina, A., Turubanova, S., Zalles, V., Li, X., Khan, A., Stolle, F., Harris, N., Song, X-P., Baggett, A., Kommareddy, I., and Kommareddy, A. 2022. The Global 2000-2020 Land Cover and Land Use Change Dataset Derived From the Landsat Archive: First Results. Frontiers in Remote Sensing, 13, April 2022. https://doi.org/10.3389/frsen.2022.856903 </p>",
"layer.tree-cover-loss.metadata.subtitle": "(annual, 30m, global, Hansen/UMD/Google/USGS/NASA)",
"layer.tree-cover-loss.metadata.disclaimer": "Tree cover loss <span class='highlight'>is not always deforestation</span>.",
"layer.tree-cover-loss.metadata.disclaimer": "Tree cover loss <highlight>is not always deforestation</highlight>.",
"layer.tree-cover-loss.metadata.disclaimer-tooltip": "Loss of tree cover may occur for many reasons, including deforestation, fire, and logging within the course of sustainable forestry operations. In sustainably managed forests, the “loss” will eventually show up as “gain”, as young trees get large enough to achieve canopy closure.",
"layer.tree-cover-loss.metadata.overview": "\"In this data set, “tree cover” is defined as all vegetation greater than 5 meters in height, and may take the form of natural forests or plantations across a range of canopy densities. “Loss” indicates the removal or mortality of tree cover and can be due to a variety of factors, including mechanical harvesting, fire, disease, or storm damage. As such, “loss” does not equate to deforestation.\n\nDue to variation in research methodology and date of content, tree cover, loss, and gain data sets cannot be compared accurately against each other. Accordingly, “net” loss cannot be calculated by subtracting figures for tree cover gain from tree cover loss, and current (post-2000) tree cover cannot be determined by subtracting figures for annual tree cover loss from year 2000 tree cover.\n\nThe 2011-2022 data was produced using updated methodology: https://storage.googleapis.com/earthenginepartners-hansen/GFC-2022-v1.10/download.html. Comparisons between the original 2001-2010 data and the 2011-2022 update should be performed with caution.\n\nThe authors evaluated the overall prevalence of false positives (commission errors) in this data at 13%, and the prevalence of false negatives (omission errors) at 12%, though the accuracy varies by biome and thus may be higher or lower in any particular location. The model often misses disturbances in smallholder landscapes, resulting in lower accuracy of the data in sub-Saharan Africa, where this type of disturbance is more common. The authors are 75 percent confident that the loss occurred within the stated year, and 97 percent confident that it occurred within a year before or after. Users of the data can smooth out such uncertainty by examining the average over multiple years.",
"layer.tree-cover-loss.metadata.source": " <p> Hansen, M. C., P. V. Potapov, R. Moore, M. Hancher, S. A. Turubanova, A. Tyukavina, D. Thau, S. V. Stehman, S. J. Goetz, T. R. Loveland, A. Kommareddy, A. Egorov, L. Chini, C. O. Justice, and J. R. G. Townshend. 2013. “High-Resolution Global Maps of 21st-Century Forest Cover Change.” Science 342 (15 November): 850–53. Data available on-line from: http://earthenginepartners.appspot.com/science-2013-global-forest/. </p>",
Expand Down
8 changes: 6 additions & 2 deletions lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,12 @@
"notrequired-file": "Non applicable",
"delete": "Supprimer",
"cancel": "Annuler",
"confirm": "Confirmer",
"submit": "Soumettre",
"send": "Envoyer",
"document.delete.title": "Supprimer {document} ?",
"document.delete.text": "Etes-vous certain de vouloir supprimer le document {document} ?",
"document.delete.error": "Une erreur s'est produite lors de la suppression du document.",
"high": "Forte",
"medium": "Moyenne",
"low": "Faible",
Expand Down Expand Up @@ -230,7 +234,7 @@
"operator-detail.license": "Autorisation de publication",
"operator-detail.license.doc_valid": "Vous trouverez ici votre autorisation de publication signée",
"operator-detail.license.doc_pending": "Vous trouverez ici votre autorisation de publication signée. Nous sommes en train de la valider. ",
"operator-detail.license.doc_not_provided": "La signature de votre <a href=\"https://opentimberportal.org/static/pdf/AUTORISATION-ENTREPRISES-FINALE.pdf\" target=\"_blank\">autorisation de publication<a> est toujours en attente, ce qui empêche la publication des documents téléversés.",
"operator-detail.license.doc_not_provided": "La signature de votre <a>autorisation de publication</a> est toujours en attente, ce qui empêche la publication des documents téléversés.",
"operator-detail.subtitle": "Classement selon la transparence: {rank} sur {rankCount} en {country}",
"operator-detail.tabs.fmus": "UGF",
"operator-detail.overview.card1.title": "Documents requis téléchargés",
Expand Down Expand Up @@ -407,7 +411,7 @@
"layer.tree-cover-gain.metadata.overview": "<p> Cet ensemble de données provenant du laboratoire GLAD (Global Land Analysis & Discovery) de l'Université du Maryland mesure les zones de gain de couverture arborée entre 2000 et 2020 sur l'ensemble du globe à une résolution de 30 × 30 mètres, affichées sous forme de couche cumulative sur 20 ans. L'augmentation de la couverture forestière a été déterminée à l'aide des informations relatives à la hauteur des arbres pour les années 2000 et 2020. Cette hauteur a été modélisée par l'intégration des mesures lidar de la structure forestière de la Global Ecosystem Dynamics Investigation (GEDI) et des séries chronologiques de données Landsat prêtes à être analysées. Le GEDI de la NASA est un instrument lidar spatial fonctionnant à bord de la station spatiale internationale depuis avril 2019. Il fournit des mesures ponctuelles de la structure de la végétation, notamment la hauteur de la canopée forestière à des latitudes comprises entre 52°N et 52°S à l'échelle mondiale. Le gain a été identifié lorsque les pixels avaient une hauteur d'arbre ≥ 5 m en 2020 et une hauteur d'arbre de <5 m en 2000. </p> <p> L'augmentation de la couverture arborée peut indiquer un certain nombre d'activités potentielles, notamment la croissance naturelle de la forêt, le cycle de rotation des cultures d'arbres ou la gestion des plantations d'arbres. </p> <p> Lorsque l'on fait un zoom arrière (< niveau de zoom 12), les pixels de gain sont ombrés en fonction de la densité du gain à l'échelle de 30 x 30 mètres. Les pixels avec un ombrage plus foncé représentent des zones présentant une concentration plus élevée de gain de couverture arborée, tandis que les pixels avec un ombrage plus clair indiquent une concentration plus faible de gain de couverture arborée. Il n'y a pas de variation dans l'ombrage des pixels lorsque les données sont à pleine résolution (≥ niveau de zoom 12). </p>",
"layer.tree-cover-gain.metadata.source": "<p> Potapov, P., Hansen, M.C., Pickens, A., Hernandez-Serna, A., Tyukavina, A., Turubanova, S., Zalles, V., Li, X., Khan, A., Stolle, F., Harris, N., Song, X-P., Baggett, A., Kommareddy, I., and Kommareddy, A. 2022. The Global 2000-2020 Land Cover and Land Use Change Dataset Derived From the Landsat Archive: First Results. Frontiers in Remote Sensing, 13, April 2022. https://doi.org/10.3389/frsen.2022.856903 </p>",
"layer.tree-cover-loss.metadata.subtitle": "(annuel, 30 m, mondial, Hansen/UMD/Google/USGS/NASA)",
"layer.tree-cover-loss.metadata.disclaimer": "La perte de couvert arboré <span class='highlight'>n'est pas toujours le signe d'une déforestation</span>.",
"layer.tree-cover-loss.metadata.disclaimer": "La perte de couvert arboré <highlight>n'est pas toujours le signe d'une déforestation</highlight>.",
"layer.tree-cover-loss.metadata.disclaimer-tooltip": "La perte de la couvert arboré peut être provoquée par de nombreuses raisons, notamment la déforestation, les incendies et le déboisement dans le cadre d'une exploitation forestière durable. Dans les forêts gérées durablement, la \"perte\" finira par se traduire par un \"gain\", les jeunes arbres devenant suffisamment grands pour que la canopée se referme.",
"layer.tree-cover-loss.metadata.overview": "Dans cet ensemble de données, le « couvert végétal » est défini comme toute végétation d'au moins 5 mètres de haut, et peut prendre la forme de forêt naturelle ou de plantation, en passant par un vaste éventail de densité du couvert. « Perte » indique la suppression ou la mortalité de la couverture arborée et peut être due à un ensemble de facteurs, notamment l'abattage mécanique, les incendies, les maladies, ou les dégâts causés par les tempêtes. En tant que tel, « perte » n'équivaut pas à déforestation.\n\nÀ cause des variations dans la méthodologie de recherche et dans la date du contenu, les séries de données sur le couvert végétal, ses pertes et ses gains ne peuvent pas être comparées de manière précise les unes avec les autres. De la même manière, la perte « nette » ne peut pas être calculée en soustrayant la valeur correspondant au gain de couvert végétal à celle de la perte de couvert végétal, et le couvert végétal actuel (post-2000) ne peut pas être déterminé en soustrayant du couvert végétal de l'année 2000 la valeur correspondant à la perte de couvert végétal annuelle.\n\nLes données de la période de 2011 à 2022 ont été produites en utilisant une méthodologie mise à jour: https://storage.googleapis.com/earthenginepartners-hansen/GFC-2022-v1.10/download.html. Les comparaisons entre les données originales de 2001 à 2010 et la mise à jour de 2011 à 2022 doivent être effectuées avec prudence.\n\nLes auteurs ont évalué à 13 % la prévalence globale des faux positifs (erreurs par excès) dans ces données, et à 12 % la prévalence de faux négatifs (erreurs par omission), même si la précision varie selon le biome et peut donc être plus élevée ou moins élevée à un endroit donné. Le modèle passe souvent à côté des perturbations touchant les zones dans lesquelles vivent les petits exploitants, ce qui entraîne une précision moindre des données en Afrique subsaharienne, là où ce type de perturbations est le plus fréquent. Les auteurs sont sûrs à 75 pourcent que la perte s'est produite au cours de l'année indiquée, et sont sûrs à 97 pourcent qu'elle s'est produite au cours de l'année précédente ou suivante. Les utilisateurs des données peuvent éliminer cette incertitude en examinant la moyenne sur plusieurs années",
"layer.tree-cover-loss.metadata.source": " <p> Hansen, M. C., P. V. Potapov, R. Moore, M. Hancher, S. A. Turubanova, A. Tyukavina, D. Thau, S. V. Stehman, S. J. Goetz, T. R. Loveland, A. Kommareddy, A. Egorov, L. Chini, C. O. Justice, and J. R. G. Townshend. 2013. “High-Resolution Global Maps of 21st-Century Forest Cover Change.” Science 342 (15 November): 850–53. Data available on-line from: http://earthenginepartners.appspot.com/science-2013-global-forest/. </p>",
Expand Down
Loading

0 comments on commit d91e007

Please sign in to comment.