From 92c0eb20478a3afefc94548eb86a310f0ff74eea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Fri, 24 Jun 2022 18:08:23 +0200 Subject: [PATCH 1/5] feat: knowledge panels for nutrient levels #6947 --- lib/ProductOpener/Display.pm | 138 +++++++++++------- lib/ProductOpener/KnowledgePanels.pm | 46 +++++- .../health/health_card.tt.json | 14 +- .../health/nutrition/nutrient_level.tt.json | 24 +++ .../product/includes/nutrient_levels.tt.html | 2 +- 5 files changed, 165 insertions(+), 59 deletions(-) create mode 100644 templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json diff --git a/lib/ProductOpener/Display.pm b/lib/ProductOpener/Display.pm index e30a5e3a073f9..d1e48900c7f51 100644 --- a/lib/ProductOpener/Display.pm +++ b/lib/ProductOpener/Display.pm @@ -90,7 +90,8 @@ BEGIN &get_world_subdomain - &data_to_display_nutriscore_and_nutrient_levels + &data_to_display_nutriscore + &data_to_display_nutrient_levels &data_to_display_ingredients_analysis &data_to_display_ingredients_analysis_details @@ -7969,15 +7970,16 @@ HTML # Display Nutri-Score and nutrient levels - my $template_data_nutriscore_and_nutrient_levels_ref = data_to_display_nutriscore_and_nutrient_levels($product_ref); + my $template_data_nutriscore_ref = data_to_display_nutriscore($product_ref); + my $template_data_nutrient_levels_ref = data_to_display_nutrient_levels($product_ref); my $nutriscore_html = ''; my $nutrient_levels_html = ''; - if (not $template_data_nutriscore_and_nutrient_levels_ref->{do_not_display}) { + if (not $template_data_nutrient_levels_ref->{do_not_display}) { - process_template('web/pages/product/includes/nutriscore.tt.html', $template_data_nutriscore_and_nutrient_levels_ref, \$nutriscore_html) || return "template error: " . $tt->error(); - process_template('web/pages/product/includes/nutrient_levels.tt.html', $template_data_nutriscore_and_nutrient_levels_ref, \$nutrient_levels_html) || return "template error: " . $tt->error(); + process_template('web/pages/product/includes/nutriscore.tt.html', $template_data_nutriscore_ref, \$nutriscore_html) || return "template error: " . $tt->error(); + process_template('web/pages/product/includes/nutrient_levels.tt.html', $template_data_nutrient_levels_ref, \$nutrient_levels_html) || return "template error: " . $tt->error(); } $template_data_ref->{display_nutriscore} = $nutriscore_html; @@ -8755,9 +8757,9 @@ sub display_nutriscore_calculation_details($) { } -=head2 data_to_display_nutriscore_and_nutrient_levels ( $product_ref ) +=head2 data_to_display_nutrient_levels ( $product_ref ) -Generates a data structure to display the Nutri-Score and the nutrient levels (food trafic lights). +Generates a data structure to display the nutrient levels (food trafic lights). The resulting data structure can be passed to a template to generate HTML or the JSON data for a knowledge panel. @@ -8771,13 +8773,83 @@ Reference to a data structure with needed data to display. =cut -sub data_to_display_nutriscore_and_nutrient_levels($) { +sub data_to_display_nutrient_levels($) { my $product_ref = shift; my $result_data_ref = {}; - # Populate the data templates needed to display the Nutri-Score and nutrient levels + # Do not display traffic lights for baby foods + if (has_tag($product_ref, "categories", "en:baby-foods")) { + + $result_data_ref->{do_not_display} = 1; + } + + # do not compute a score for dehydrated products to be rehydrated (e.g. dried soups, coffee, tea) + # unless we have nutrition data for the prepared product + + my $prepared = ""; + + foreach my $category_tag ("en:dried-products-to-be-rehydrated", "en:chocolate-powders", "en:dessert-mixes", "en:flavoured-syrups") { + + if (has_tag($product_ref, "categories", $category_tag)) { + + if ((defined $product_ref->{nutriments}{"energy_prepared_100g"})) { + $prepared = '_prepared'; + last; + } + else { + $result_data_ref->{do_not_display} = 1; + } + } + } + + if (not $result_data_ref->{do_not_display}) { + + $result_data_ref->{nutrient_levels} = []; + + foreach my $nutrient_level_ref (@nutrient_levels) { + my ($nid, $low, $high) = @{$nutrient_level_ref}; + + if ((defined $product_ref->{nutrient_levels}) and (defined $product_ref->{nutrient_levels}{$nid})) { + + push @{$result_data_ref->{nutrient_levels}}, { + nid => $nid, + nutrient_level => $product_ref->{nutrient_levels}{$nid}, + nutrient_quantity_in_grams => sprintf("%.2e", $product_ref->{nutriments}{$nid . $prepared . "_100g"}) + 0.0, + nutrient_in_quantity => sprintf(lang("nutrient_in_quantity"), display_taxonomy_tag($lc, "nutrients", "zz:$nid") , lang($product_ref->{nutrient_levels}{$nid} . "_quantity")), + # Needed for the current display on product page, can be removed once transitioned fully to knowledge panels + nutrient_bold_in_quantity => sprintf(lang("nutrient_in_quantity"), "" . display_taxonomy_tag($lc, "nutrients", "zz:$nid") . "", lang($product_ref->{nutrient_levels}{$nid} . "_quantity")), + }; + } + } + } + + return $result_data_ref; +} + + +=head2 data_to_display_nutriscore ( $product_ref ) + +Generates a data structure to display the Nutri-Score. + +The resulting data structure can be passed to a template to generate HTML or the JSON data for a knowledge panel. + +=head3 Arguments + +=head4 Product reference $product_ref + +=head3 Return values + +Reference to a data structure with needed data to display. + +=cut + +sub data_to_display_nutriscore($) { + + my $product_ref = shift; + + my $result_data_ref = {}; # Nutri-Score data @@ -8881,57 +8953,11 @@ sub data_to_display_nutriscore_and_nutrient_levels($) { $result_data_ref->{nutriscore_details} = display_nutriscore_calculation_details($product_ref->{nutriscore_data}); } - - # Nutrient levels data - - # Do not display traffic lights for baby foods - if (has_tag($product_ref, "categories", "en:baby-foods")) { - - $result_data_ref->{do_not_display} = 1; - } - - # do not compute a score for dehydrated products to be rehydrated (e.g. dried soups, coffee, tea) - # unless we have nutrition data for the prepared product - - my $prepared = ""; - - foreach my $category_tag ("en:dried-products-to-be-rehydrated", "en:chocolate-powders", "en:dessert-mixes", "en:flavoured-syrups") { - - if (has_tag($product_ref, "categories", $category_tag)) { - - if ((defined $product_ref->{nutriments}{"energy_prepared_100g"})) { - $prepared = '_prepared'; - last; - } - else { - $result_data_ref->{do_not_display} = 1; - } - } - } - - if (not $result_data_ref->{do_not_display}) { - - $result_data_ref->{nutrient_levels} = []; - - foreach my $nutrient_level_ref (@nutrient_levels) { - my ($nid, $low, $high) = @{$nutrient_level_ref}; - - if ((defined $product_ref->{nutrient_levels}) and (defined $product_ref->{nutrient_levels}{$nid})) { - - push @{$result_data_ref->{nutrient_levels}}, { - nutrient_level => $product_ref->{nutrient_levels}{$nid}, - nutriment_prepared => sprintf("%.2e", $product_ref->{nutriments}{$nid . $prepared . "_100g"}) + 0.0, - nutriment_quantity => sprintf(lang("nutrient_in_quantity"), "" . display_taxonomy_tag($lc, "nutrients", "zz:$nid") . "", lang($product_ref->{nutrient_levels}{$nid} . "_quantity")), - }; - } - } - } - - return $result_data_ref; } + sub add_product_nutriment_to_stats($$$) { my $nutriments_ref = shift; diff --git a/lib/ProductOpener/KnowledgePanels.pm b/lib/ProductOpener/KnowledgePanels.pm index 335dc9d8ce93d..6980c6c4164b3 100644 --- a/lib/ProductOpener/KnowledgePanels.pm +++ b/lib/ProductOpener/KnowledgePanels.pm @@ -761,6 +761,8 @@ sub create_health_card_panel($$$$) { create_nutriscore_panel($product_ref, $target_lc, $target_cc); + create_nutrient_levels_panels($product_ref, $target_lc, $target_cc); + create_nutrition_facts_table_panel($product_ref, $target_lc, $target_cc); if ($options_ref->{activate_knowledge_panel_physical_activities}) { @@ -809,7 +811,9 @@ sub create_nutriscore_panel($$$) { $log->debug("create nutriscore panel", { code => $product_ref->{code}, nutriscore_data => $product_ref->{nutriscore_data} }) if $log->is_debug(); - my $panel_data_ref = data_to_display_nutriscore_and_nutrient_levels($product_ref); + my $panel_data_ref = data_to_display_nutriscore($product_ref); + + # Nutri-Score panel if ($panel_data_ref->{nutriscore_grade} eq "not-applicable") { $panel_data_ref->{title} = lang_in_other_lc($target_lc, "attribute_nutriscore_not_applicable_title"); @@ -824,6 +828,46 @@ sub create_nutriscore_panel($$$) { } +=head2 create_nutrient_levels_panels ( $product_ref, $target_lc, $target_cc ) + +Creates knowledge panels for nutrient levels for fat, saturated fat, sugars and salt. + +=head3 Arguments + +=head4 product reference $product_ref + +Loaded from the MongoDB database, Storable files, or the OFF API. + +=head4 language code $target_lc + +Returned attributes contain both data and strings intended to be displayed to users. +This parameter sets the desired language for the user facing strings. + +=head4 country code $target_cc + +=cut + +sub create_nutrient_levels_panels($$$) { + + my $product_ref = shift; + my $target_lc = shift; + my $target_cc = shift; + + $log->debug("create nutriscore panel", { code => $product_ref->{code}, nutriscore_data => $product_ref->{nutriscore_data} }) if $log->is_debug(); + + my $nutrient_levels_ref = data_to_display_nutrient_levels($product_ref); + + # Nutrient levels panels + if (not $nutrient_levels_ref->{do_not_display}) { + foreach my $nutrient_level_ref (@{$nutrient_levels_ref->{nutrient_levels}}) { + my $nid = $nutrient_level_ref->{nid}; + create_panel_from_json_template("nutrient_level_" . $nid, "api/knowledge-panels/health/nutrition/nutrient_level.tt.json", + $nutrient_level_ref, $product_ref, $target_lc, $target_cc); + } + } +} + + =head2 create_nutrition_facts_table_panel ( $product_ref, $target_lc, $target_cc ) Creates a knowledge panel with the nutrition facts table. diff --git a/templates/api/knowledge-panels/health/health_card.tt.json b/templates/api/knowledge-panels/health/health_card.tt.json index 3670fa147e355..88d9491cda6b1 100644 --- a/templates/api/knowledge-panels/health/health_card.tt.json +++ b/templates/api/knowledge-panels/health/health_card.tt.json @@ -21,7 +21,19 @@ [% END %] [% IF panels.physical_activities.defined %] "physical_activities", - [% END %] + [% END %] + [% IF panels.nutrient_level_fat.defined %] + "nutrient_level_fat", + [% END %] + [% IF panels.${'nutrient_level_saturated-fat'}.defined %] + "nutrient_level_saturated-fat", + [% END %] + [% IF panels.nutrient_level_sugars.defined %] + "nutrient_level_sugars", + [% END %] + [% IF panels.nutrient_level_salt.defined %] + "nutrient_level_salt", + [% END %] [% IF panels.nutrition_facts_table.defined %] "nutrition_facts_table", [% END %] diff --git a/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json b/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json new file mode 100644 index 0000000000000..7b9c520e65723 --- /dev/null +++ b/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json @@ -0,0 +1,24 @@ +{ + "level": "info", + "topics": [ + "health" + ], + "size": "small", + "evaluation": "[% panel.evaluation %]", + "title_element": { + "title": "[% panel.nutrient_in_quantity %]", + "icon_url": "[% static_subdomain %]/images/misc/[% panel.nutrient_level %].svg", + "icon_size": "small", + }, + "elements": [ + { + "element_type": "text", + "text_element": { + "type": "summary", + "html": ` + + ` + } + }, + ] +} diff --git a/templates/web/pages/product/includes/nutrient_levels.tt.html b/templates/web/pages/product/includes/nutrient_levels.tt.html index ea6028bdd671b..d888a9e0e9c84 100755 --- a/templates/web/pages/product/includes/nutrient_levels.tt.html +++ b/templates/web/pages/product/includes/nutrient_levels.tt.html @@ -9,7 +9,7 @@

[% lang('nutrient_levels_info') %]

[% FOREACH level IN nutrient_levels %] [% lang('${level.nutrient_level}_quantity') %] [% level.nutriment_prepared %] g [% level.nutriment_quantity %]
+ alt="[% lang('${level.nutrient_level}_quantity') %]"> [% level.nutrient_quantity_in_grams %] g [% level.nutrient_bold_in_quantity %]
[% END %] \ No newline at end of file From 3d95ffda803acd15acdce637a53e064b816d4000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Tue, 28 Jun 2022 19:09:14 +0200 Subject: [PATCH 2/5] add quantity in nutrient panel title --- .../knowledge-panels/health/nutrition/nutrient_level.tt.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json b/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json index 7b9c520e65723..5a9c38508d3af 100644 --- a/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json +++ b/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json @@ -6,10 +6,11 @@ "size": "small", "evaluation": "[% panel.evaluation %]", "title_element": { - "title": "[% panel.nutrient_in_quantity %]", + "title": "[% panel.nutrient_in_quantity %] ([% panel.nutrient_quantity_in_grams %]%)", "icon_url": "[% static_subdomain %]/images/misc/[% panel.nutrient_level %].svg", "icon_size": "small", }, + "type":" inline", "elements": [ { "element_type": "text", From 5bd71555824258a6147b962af09aa14d831663fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Wed, 29 Jun 2022 17:37:52 +0200 Subject: [PATCH 3/5] facts + recommendations for salt --- po/common/common.pot | 33 +++++++++++- po/common/en.po | 32 ++++++++++++ .../health/nutrition/nutrient_level.tt.json | 50 +++++++++++++++++-- 3 files changed, 110 insertions(+), 5 deletions(-) diff --git a/po/common/common.pot b/po/common/common.pot index 5dcaa2d31f960..add2726738851 100644 --- a/po/common/common.pot +++ b/po/common/common.pot @@ -6196,4 +6196,35 @@ msgctxt "action_add_nutrition_facts" msgid "Add nutrition facts" msgstr "Add nutrition facts" - +# Used as a header for key facts +msgctxt "knowledge_panels_facts" +msgid "What you need to know" +msgstr "What you need to know" + +msgctxt "knowledge_panels_recommendation" +msgid "Recommendation" +msgstr "Recommendation" + +msgctxt "nutrient_info_salt_risk" +msgid "A high consumption of salt (or sodium) can cause raised blood pressure, which can increase the risk of heart disease and stroke." +msgstr "A high consumption of salt (or sodium) can cause raised blood pressure, which can increase the risk of heart disease and stroke." + +msgctxt "nutrient_info_salt_high_blood_pressure" +msgid "Many people who have high blood pressure do not know it, as there are often no symptoms." +msgstr "Many people who have high blood pressure do not know it, as there are often no symptoms." + +msgctxt "nutrient_info_salt_high_consumption" +msgid "Most people consume too much salt (on average 9 to 12 grams per day), around twice the recommended maximum level of intake." +msgstr "Most people consume too much salt (on average 9 to 12 grams per day), around twice the recommended maximum level of intake." + +msgctxt "nutrient_recommendation_salt_title" +msgid "Limit the consumption of salt and salted food" +msgstr "Limit the consumption of salt and salted food" + +msgctxt "nutrient_recommendation_salt_cooking_and_table" +msgid "Reduce the quantity of salt used when cooking, and don't salt again at the table." +msgstr "Reduce the quantity of salt used when cooking, and don't salt again at the table." + +msgctxt "nutrient_recommendation_salt_limit_salty_snacks" +msgid "Limit the consumption of salty snacks and choose products with lower salt content." +msgstr "Limit the consumption of salty snacks and choose products with lower salt content." diff --git a/po/common/en.po b/po/common/en.po index eb050428f37a8..d62a1d3f12d76 100644 --- a/po/common/en.po +++ b/po/common/en.po @@ -6218,3 +6218,35 @@ msgctxt "action_add_nutrition_facts" msgid "Add nutrition facts" msgstr "Add nutrition facts" +# Used as a header for key facts +msgctxt "knowledge_panels_facts" +msgid "What you need to know" +msgstr "What you need to know" + +msgctxt "knowledge_panels_recommendation" +msgid "Recommendation" +msgstr "Recommendation" + +msgctxt "nutrient_info_salt_risk" +msgid "A high consumption of salt (or sodium) can cause raised blood pressure, which can increase the risk of heart disease and stroke." +msgstr "A high consumption of salt (or sodium) can cause raised blood pressure, which can increase the risk of heart disease and stroke." + +msgctxt "nutrient_info_salt_high_blood_pressure" +msgid "Many people who have high blood pressure do not know it, as there are often no symptoms." +msgstr "Many people who have high blood pressure do not know it, as there are often no symptoms." + +msgctxt "nutrient_info_salt_high_consumption" +msgid "Most people consume too much salt (on average 9 to 12 grams per day), around twice the recommended maximum level of intake." +msgstr "Most people consume too much salt (on average 9 to 12 grams per day), around twice the recommended maximum level of intake." + +msgctxt "nutrient_recommendation_salt_title" +msgid "Limit the consumption of salt and salted food" +msgstr "Limit the consumption of salt and salted food" + +msgctxt "nutrient_recommendation_salt_cooking_and_table" +msgid "Reduce the quantity of salt used when cooking, and don't salt again at the table." +msgstr "Reduce the quantity of salt used when cooking, and don't salt again at the table." + +msgctxt "nutrient_recommendation_salt_limit_salty_snacks" +msgid "Limit the consumption of salty snacks and choose products with lower salt content." +msgstr "Limit the consumption of salty snacks and choose products with lower salt content." diff --git a/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json b/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json index 5a9c38508d3af..de250375bd09f 100644 --- a/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json +++ b/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json @@ -10,16 +10,58 @@ "icon_url": "[% static_subdomain %]/images/misc/[% panel.nutrient_level %].svg", "icon_size": "small", }, - "type":" inline", "elements": [ + // Explanation of the impact of the nutrient + // + recommendations (e.g. reduce) + // based on WHO recommendations, national health agencies etc. + [% IF panel.nid == 'salt' %] { "element_type": "text", "text_element": { "type": "summary", - "html": ` - - ` + "html": +` +[% lang("knowledge_panels_facts") %] +
    +
  • [% lang('nutrient_info_salt_risk') %]
  • +
  • [% lang('nutrient_info_salt_high_blood_pressure') %]
  • +
  • [% lang('nutrient_info_salt_high_consumption') %]
  • +
+
+[% lang("knowledge_panels_recommendation") %][% sep %]: +[% lang('nutrient_recommendation_salt_title') %] +
    +
  • [% lang('nutrient_recommendation_salt_cooking_and_table') %]
  • +
  • [% lang('nutrient_recommendation_salt_limit_salty_snacks') %]
  • +
+`, } }, + { + "element_type": "text", + "text_element": { + "type": "summary", + "html": +` +`, + "source_text": "World Health Organization (WHO) - Fact sheet - Salt reduction", + "source_url": "https://www.who.int/news-room/fact-sheets/detail/salt-reduction", + "source_language": "en", + } + }, + { + "element_type": "text", + "text_element": { + "type": "summary", + "html": +` +`, + "source_text": "National Health Service UK (NHS) - Salt: the facts", + "source_url": "https://www.nhs.uk/live-well/eat-well/food-types/salt-nutrition/", + "source_language": "en", + } + }, + + [% END %] ] } From 1b30a56c7810899c89e4a096663b1c98d9e15fbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Fri, 15 Jul 2022 13:33:42 +0200 Subject: [PATCH 4/5] fixed conflict --- lib/ProductOpener/Display.pm | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/ProductOpener/Display.pm b/lib/ProductOpener/Display.pm index f25f65444b3cd..26b9c193e7c82 100644 --- a/lib/ProductOpener/Display.pm +++ b/lib/ProductOpener/Display.pm @@ -8811,18 +8811,10 @@ sub data_to_display_nutriscore($) { } -<<<<<<< HEAD - -sub add_product_nutriment_to_stats($$$) { - - my $nutriments_ref = shift; - my $nid = shift; - my $value = shift // ''; -======= sub add_product_nutriment_to_stats($nutriments_ref, $nid, $value) { ->>>>>>> main - if ($value ne '') { + + if ((defined $value) and ($value ne '')) { if (not defined $nutriments_ref->{"${nid}_n"}) { $nutriments_ref->{"${nid}_n"} = 0; From 44abd0acaf1f8fdcce23f4360214668873951cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Fri, 15 Jul 2022 13:34:53 +0200 Subject: [PATCH 5/5] add info and recommendations for sugars, fat and saturated fat --- po/common/common.pot | 28 +++++++ po/common/en.po | 31 ++++++++ .../health/nutrition/nutrient_level.tt.json | 75 +++++++++++++++++++ 3 files changed, 134 insertions(+) diff --git a/po/common/common.pot b/po/common/common.pot index 7230ff49c5dec..1c16e453a5dde 100644 --- a/po/common/common.pot +++ b/po/common/common.pot @@ -6228,3 +6228,31 @@ msgstr "Reduce the quantity of salt used when cooking, and don't salt again at t msgctxt "nutrient_recommendation_salt_limit_salty_snacks" msgid "Limit the consumption of salty snacks and choose products with lower salt content." msgstr "Limit the consumption of salty snacks and choose products with lower salt content." + +msgctxt "nutrient_info_sugars_risk" +msgid "A high consumption of sugar can cause weight gain and tooth decay. It also augments the risk of type 2 diabetes and cardio-vascular diseases." +msgstr "A high consumption of sugar can cause weight gain and tooth decay. It also augments the risk of type 2 diabetes and cardio-vascular diseases." + +msgctxt "nutrient_recommendation_sugars_title" +msgid "Limit the consumption of sugar and sugary drinks" +msgstr "Limit the consumption of sugar and sugary drinks" + +msgctxt "nutrient_recommendation_sugars_drinks" +msgid "Sugary drinks (such as sodas, fruit beverages, and fruit juices and nectars) should be limited as much as possible (no more than 1 glass a day)." +msgstr "Sugary drinks (such as sodas, fruit beverages, and fruit juices and nectars) should be limited as much as possible (no more than 1 glass a day)." + +msgctxt "nutrient_recommendation_sugars_food" +msgid "Choose products with lower sugar content and reduce the consumption of products with added sugars." +msgstr "Choose products with lower sugar content and reduce the consumption of products with added sugars." + +msgctxt "nutrient_info_fat_and_saturated_fat_risk" +msgid "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." +msgstr "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." + +msgctxt "nutrient_recommendation_fat_and_saturated_fat_title" +msgid "Reduce the consumption of fat and saturated fat" +msgstr "Limit the consumption of fat and saturated fat" + +msgctxt "nutrient_recommendation_fat_and_saturated_fat" +msgid "Choose products with lower fat and saturated fat content." +msgstr "Choose products with lower fat and saturated fat content." diff --git a/po/common/en.po b/po/common/en.po index 6bd885f843092..35054c7e3ca4a 100644 --- a/po/common/en.po +++ b/po/common/en.po @@ -6250,3 +6250,34 @@ msgstr "Reduce the quantity of salt used when cooking, and don't salt again at t msgctxt "nutrient_recommendation_salt_limit_salty_snacks" msgid "Limit the consumption of salty snacks and choose products with lower salt content." msgstr "Limit the consumption of salty snacks and choose products with lower salt content." + +msgctxt "nutrient_info_sugars_risk" +msgid "A high consumption of sugar can cause weight gain and tooth decay. It also augments the risk of type 2 diabetes and cardio-vascular diseases." +msgstr "A high consumption of sugar can cause weight gain and tooth decay. It also augments the risk of type 2 diabetes and cardio-vascular diseases." + +msgctxt "nutrient_recommendation_sugars_title" +msgid "Limit the consumption of sugar and sugary drinks" +msgstr "Limit the consumption of sugar and sugary drinks" + +msgctxt "nutrient_recommendation_sugars_drinks" +msgid "Sugary drinks (such as sodas, fruit beverages, and fruit juices and nectars) should be limited as much as possible (no more than 1 glass a day)." +msgstr "Sugary drinks (such as sodas, fruit beverages, and fruit juices and nectars) should be limited as much as possible (no more than 1 glass a day)." + +msgctxt "nutrient_recommendation_sugars_food" +msgid "Choose products with lower sugar content and reduce the consumption of products with added sugars." +msgstr "Choose products with lower sugar content and reduce the consumption of products with added sugars." + +msgctxt "nutrient_info_fat_and_saturated_fat_risk" +msgid "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." +msgstr "A high consumption of fat, especially saturated fats, can raise cholesterol, which increases the risk of heart diseases." + +msgctxt "nutrient_recommendation_fat_and_saturated_fat_title" +msgid "Reduce the consumption of fat and saturated fat" +msgstr "Limit the consumption of fat and saturated fat" + +msgctxt "nutrient_recommendation_fat_and_saturated_fat" +msgid "Choose products with lower fat and saturated fat content." +msgstr "Choose products with lower fat and saturated fat content." + + + diff --git a/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json b/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json index de250375bd09f..9d5407e556e94 100644 --- a/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json +++ b/templates/api/knowledge-panels/health/nutrition/nutrient_level.tt.json @@ -63,5 +63,80 @@ }, [% END %] + + [% IF panel.nid == 'sugars' %] + { + "element_type": "text", + "text_element": { + "type": "summary", + "html": +` +[% lang("knowledge_panels_facts") %] +
    +
  • [% lang('nutrient_info_sugars_risk') %]
  • +
+
+[% lang("knowledge_panels_recommendation") %][% sep %]: +[% lang('nutrient_recommendation_sugars_title') %] +
    +
  • [% lang('nutrient_recommendation_sugars_drinks') %]
  • +
  • [% lang('nutrient_recommendation_sugars_food') %]
  • +
+`, + } + }, + { + "element_type": "text", + "text_element": { + "type": "summary", + "html": +` +`, + "source_text": "National Health Service UK (NHS) - Sugar: the facts", + "source_url": "https://www.nhs.uk/live-well/eat-well/food-types/how-does-sugar-in-our-diet-affect-our-health/", + "source_language": "en", + } + }, + + [% END %] + + [% IF panel.nid == 'fat'|| panel.nid == 'saturated-fat' %] + { + "element_type": "text", + "text_element": { + "type": "summary", + "html": +` +[% lang("knowledge_panels_facts") %] +
    +
  • [% lang('nutrient_info_fat_and_saturated_fat_risk') %]
  • +
+
+[% lang("knowledge_panels_recommendation") %][% sep %]: +[% lang('nutrient_recommendation_fat_and_saturated_fat_title') %] +
    +
  • [% lang('nutrient_recommendation_fat_and_saturated_fat') %]
  • +
+`, + } + }, + { + "element_type": "text", + "text_element": { + "type": "summary", + "html": +` +`, + "source_text": "National Health Service UK (NHS) - Fat: the facts", + "source_url": "https://www.nhs.uk/live-well/eat-well/food-types/different-fats-nutrition/", + "source_language": "en", + } + }, + + [% END %] ] } + + + +