<<

NAME

ProductOpener::Texts - Load and manage texts in different languages

DESCRIPTION

Text pages translations

The openfoodfacts-web repostory contains a /lang directory with texts in different languages.

For instance https://github.com/openfoodfacts/openfoodfacts-web/blob/main/lang/fr/texts/terms-of-use.html is the French translation of the "Terms of use" page.

Text pages routes

In English the route for the "Terms of use" page is /terms-of-use

In other languages, we use a translated route, for instance in French: /conditions-d-utilisation

The translations for the routes are stored in the common/*.po files:

# Do not translate without having the same exact string in the Tags template. Do not use spaces, special characters, only alphanumeric characters separated by hyphens msgctxt "footer_terms_link" msgid "/terms-of-use" msgstr "/conditions-d-utilisation"

Routing

This module generates the mapping from translated routes to text ids.

normalize ($string)

Normalize a string by removing HTML tags, comments, scripts, and extra spaces.

<<