Skip to content

Conversation

@stephanegigandet
Copy link
Contributor

This PR improves the routing of text pages so that translated text routes in .po files (e.g /discover and /conditions-d-utilisation in French) are matched with the corresponding /lang/fr/discover.html text.

Note: openfoodfacts-web currently has links or translated file names ( https://github.com/openfoodfacts/openfoodfacts-web/tree/main/lang/fr/texts/ ). Those should be removed.

This PR replaces #12644

Also renamed Index.pm to Texts.pm (clearer) and added some docs and a couple of tests.

@stephanegigandet stephanegigandet requested a review from a team as a code owner November 10, 2025 14:04
@github-project-automation github-project-automation bot moved this to To discuss and validate in 🍊 Open Food Facts Server issues Nov 10, 2025
@github-actions github-actions bot added 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies 🗺️ Made Near Me MongoDB We have 2 mongodb collections: one for current products, and one for obsolete products 📍🏭 Packager codes https://blog.openfoodfacts.org/en/news/discover-what-food-products-are-made-near-you-with-made-near- 📦 Packaging https://wiki.openfoodfacts.org/Category:Recycling Data import WikiData We link taxonomies to Wikidata (& back) - https://wiki.openfoodfacts.org/Structured_Data/Wikidata 🕹️ Gamification 🖼️ Images product history We have kept 10 years of product revisions. This is useful to monitor edits & product improvements 🧪 tests 🪶 Apache We use Apache as a server to run Open Food Facts checkbot 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers Recent changes Implemented by @hangy - https://world.openfoodfacts.org/cgi/recent_changes.pl?&page=1&page_size=25 🥗🔍 Ingredients analysis https://wiki.openfoodfacts.org/Ingredients_Extraction_and_Analysis 🍬 How much sugar https://howmuchsugar.in/ - Mini game powered by Open Food Facts data Display 👥 Users Tags update all products exports Account deletion Enabling users to delete account while preserving accountability for edits 🔐 Password Scanbot 🚦 Nutri-Score labels Nov 10, 2025
@github-actions github-actions bot added 🧴 Open Beauty Facts Our cosmetic analysis project https://world.openbeautyfacts.org 🌐 Translations labels Nov 21, 2025
@github-project-automation github-project-automation bot moved this from In progress to Reviewer approved in 🧴 Open Beauty Facts Nov 21, 2025
@teolemon
Copy link
Member

( STDERR )  job 12    [Fri Nov 21 11:02:18 2025] tags.t: Use of uninitialized value $ProductOpener::Tags::lang_dir in concatenation (.) or string at /opt/product-opener/lib/ProductOpener/Tags.pm line 4522.
(  DIAG  )  job 12    warning: The  could not be opened.
(  DIAG  )  job 12    warning: Tags texts could not be loaded.
[  FAIL  ]  job 12  + e100 text contains "curcumine"
[  DEBUG ]  job 12    tests/unit/tags.t line 668
(  DIAG  )  job 12    +---------+----+-----------------+
(  DIAG  )  job 12    | GOT     | OP | CHECK           |
(  DIAG  )  job 12    +---------+----+-----------------+
(  DIAG  )  job 12    | <UNDEF> | =~ | (?^u:curcumine) |
(  DIAG  )  job 12    +---------+----+-----------------+
(  DIAG  )  job 12    undef
( STDERR )  job 12    [Fri Nov 21 11:02:18 2025] tags.t: Use of uninitialized value $ProductOpener::Tags::lang_dir in string at /opt/product-opener/lib/ProductOpener/Tags.pm line 4961.
( STDERR )  job 12    [Fri Nov 21 11:02:18 2025] tags.t: Use of uninitialized value $ProductOpener::Tags::lang_dir in concatenation (.) or string at /opt/product-opener/lib/ProductOpener/Tags.pm line 4961.
[  FAIL  ]  job 12  + <UNNAMED ASSERTION>
[  DEBUG ]  job 12    tests/unit/tags.t line 890
(  DIAG  )  job 12    Unicode::GCString is not installed, table may not display all unicode characters properly
(  DIAG  )  job 12    +---------+----------------------------------------------------------------+
(  DIAG  )  job 12    | GOT     | CHECK                                                          |
(  DIAG  )  job 12    +---------+----------------------------------------------------------------+
(  DIAG  )  job 12    | <UNDEF> | <p>La curcumine ne présente pas de risques connus pour la sant |
(  DIAG  )  job 12    |         | é.</p>                                                         |
(  DIAG  )  job 12    +---------+----------------------------------------------------------------+
[  FAIL  ]  job 12  + <UNNAMED ASSERTION>
[  DEBUG ]  job 12    tests/unit/tags.t line 895
(  DIAG  )  job 12    Unicode::GCString is not installed, table may not display all unicode characters properly
(  DIAG  )  job 12    +---------+----------------------------------------------------------------+
(  DIAG  )  job 12    | GOT     | CHECK                                                          |
(  DIAG  )  job 12    +---------+----------------------------------------------------------------+
(  DIAG  )  job 12    | <UNDEF> | <p>La curcumine ne présente pas de risques connus pour la sant |
(  DIAG  )  job 12    |         | é.</p>                                                         |
(  DIAG  )  job 12    +---------+----------------------------------------------------------------+
(  DIAG  )  job 12    Seeded srand with seed '20251121' from local date.
(  DIAG  )  job 12    Looks like you failed 3 tests of 210.

Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool !

@teolemon
Copy link
Member

@alexgarel @stephanegigandet We will need to solve Donations, to ensure we always serve the translated pages: https://github.com/openfoodfacts/openfoodfacts-server/blob/main/conf/nginx/snippets/off.locations-redirects.include

@sonarqubecloud
Copy link

@stephanegigandet stephanegigandet merged commit 114b3e6 into main Nov 21, 2025
37 checks passed
@stephanegigandet stephanegigandet deleted the translated_texts_routes branch November 21, 2025 17:11
@github-project-automation github-project-automation bot moved this from Ready to Done in 🛡️ Nutri-Patrol Nov 21, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in 👾 Community & Gamification Nov 21, 2025
@github-project-automation github-project-automation bot moved this from Reviewer approved to Done in 🧴 Open Beauty Facts Nov 21, 2025
@github-project-automation github-project-automation bot moved this from Reviewer approved to Done in 🏭 Producers Platform Nov 21, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in 🚦Nutri-Score Nov 21, 2025
@github-project-automation github-project-automation bot moved this from Reviewer approved to Done in 🔎 Improve the search experience Nov 21, 2025
@github-project-automation github-project-automation bot moved this from Reviewer approved to Done in Ingredient analysis Nov 21, 2025
@github-project-automation github-project-automation bot moved this from Reviewer approved to Done in 🗺️ Made Near Me Nov 21, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in 📦 Packaging improvements Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Account deletion Enabling users to delete account while preserving accountability for edits 🪶 Apache We use Apache as a server to run Open Food Facts checkbot Data import Display exports 🕹️ Gamification 🍬 How much sugar https://howmuchsugar.in/ - Mini game powered by Open Food Facts data 🖼️ Images 🥗🔍 Ingredients analysis https://wiki.openfoodfacts.org/Ingredients_Extraction_and_Analysis 🗺️ Made Near Me 👮 Moderation MongoDB We have 2 mongodb collections: one for current products, and one for obsolete products multilingual products 🚦 Nutri-Score 🧴 Open Beauty Facts Our cosmetic analysis project https://world.openbeautyfacts.org 📍🏭 Packager codes https://blog.openfoodfacts.org/en/news/discover-what-food-products-are-made-near-you-with-made-near- 📦 Packaging https://wiki.openfoodfacts.org/Category:Recycling 🔐 Password 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers product history We have kept 10 years of product revisions. This is useful to monitor edits & product improvements Recent changes Implemented by @hangy - https://world.openfoodfacts.org/cgi/recent_changes.pl?&page=1&page_size=25 Scanbot 🔎 Search Stores Tags 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies 🧪 tests 🌐 Translations update all products 👥 Users WikiData We link taxonomies to Wikidata (& back) - https://wiki.openfoodfacts.org/Structured_Data/Wikidata

Projects

Status: Done
Status: Done
Status: Done
Status: Done
Status: Done
Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants