Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Makes "Unselect Image" button translatable #6570

Merged
merged 2 commits into from
Apr 7, 2022

Conversation

yuktea
Copy link
Contributor

@yuktea yuktea commented Apr 7, 2022

Fixes Issue #6332

@yuktea yuktea requested a review from a team as a code owner April 7, 2022 08:04
@github-actions github-actions bot added Display Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org labels Apr 7, 2022
@yuktea yuktea changed the title Makes "Unselect Image button" translatable fix: Makes "Unselect Image" button translatable Apr 7, 2022
msgctxt "unselect_image"
msgid "Unselect Image"
msgstr ""
Copy link
Member

Choose a reason for hiding this comment

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

@stephanegigandet to have the message at least in english if translation isn't available in target language,
isn't it better to repeat msgid in msgstr, or is there an automatic fallback to en.po ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Product Opener does not use common.pot at all in fact, it reads only the *.po files. The common.pot is used by Crowdin.

In practice, we probably should have only one file, and configure crowdin to use en.po instead of common.pot
@teolemon is the master of the crowdin configuration

Copy link
Member

Choose a reason for hiding this comment

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

This is related to GNU GetText.
per phrase.com:
POT, short for “portable object template”, is a format generated by GNU gettext to streamline the software localization and internationalization. While source strings are placed after “msgid”, their translations are placed after “msgtr”.

Note: POT files can sometimes be PO files as well. These two files are mostly identical except that PO files are generated by calling “msginit” in CMD. It is possible to perform the translation on a POT file first and then rename it to a PO. The final localized format should be a machine-readable “.mo” file generated from the PO file. The “.mo” file can be generated by calling “msgfmt” in CMD.

In practise, Product Opener does not support .pot or .mo files

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.

LGTM, just added a comment to @stephanegigandet on a topic I do not master !

@stephanegigandet
Copy link
Contributor

@yuktea : I added a commit to add translation in Hindi, so that we can check that it is working.

image

After that you have to run make build_land and make restart, then put the interface in Hindi (using the world-hi.openfoodfacts.localhost domain for instance)

@sonarcloud
Copy link

sonarcloud bot commented Apr 7, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@yuktea
Copy link
Contributor Author

yuktea commented Apr 7, 2022

@yuktea : I added a commit to add translation in Hindi, so that we can check that it is working.

After that you have to run make build_land and make restart, then put the interface in Hindi (using the world-hi.openfoodfacts.localhost domain for instance)

Thank you for testing this out, @stephanegigandet ! It's a mystery why it wouldn't work for me despite doing everything right (the exact same changes+ make build_lang + make restart). I'll try to look into it when I'm back

@alexgarel alexgarel merged commit 4bc1179 into main Apr 7, 2022
@alexgarel alexgarel deleted the make-unselect-image-translatable branch April 7, 2022 14:50
@teolemon teolemon linked an issue Apr 15, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Display Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the "Unselect image" button translatable
4 participants