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

Update out-of-date translation files #1380

Open
becky-gilbert opened this issue Apr 10, 2024 · 0 comments
Open

Update out-of-date translation files #1380

becky-gilbert opened this issue Apr 10, 2024 · 0 comments

Comments

@becky-gilbert
Copy link
Contributor

becky-gilbert commented Apr 10, 2024

Summary

Many of our translation (.po) files were last edited ~2 years ago. We have since made changes to the site, so there are translations that need to be added or checked/updated. We have generated up-to-date .po files, which contributors can access on our develop branch. Any updates to these files can be made via a pull request targeted at our develop branch.

Translation steps

For anyone who is willing to help us update translations, here are the steps:

  1. On your lookit-api fork, run:
    git fetch upstream
    git merge upstream/develop
    to update your branch. This will give you the most up-to-date .po files to work from.
  2. In the .po file for the language you want to update, find the strings where translations need to be added or checked - see below for more details on how to do this.
  3. Commit the changes to your fork/branch, and then open a PR in the lookit-api repo to merge your fork/branch into our develop branch.
  4. (Optional) If you have a development environment that runs a local version of the website, you can check your translations by (1) compiling your .po file with make compilemessages, which will generate an .mo file, and (2) adding the locale to the end of your base URL, e.g. "localhost:8000/ja".

New strings to translate

Strings that require a translation for this language will appear as a msgstr followed by an empty string: "". For example:

#: web/templates/web/study-detail.html:19
msgid "now"
msgstr ""

In this case, you just need to add the translation inside the empty quotes, e.g.

#: web/templates/web/study-detail.html:19
msgid "now"
msgstr "ahora"

You can search for these cases using msgstr "", but be aware that this search will also pick up long/multi-line translations, which start with an empty string but contain a translation that starts on the next line, e.g.

msgstr ""
"Ihr Kind ist noch jünger als die für diese Studie empfohlene Altersspanne. "
"Wenn Sie warten können bis</ span> er oder "
"sie alt genug ist, können wir die gesammelten Daten für unsere Forschung "
"verwenden!"

To ignore the multi-line cases, with regular expressions enabled you can search for msgstr ""\n\n.

Translations marked as 'fuzzy'

A fuzzy translation is one that has a msgid(English text) that is similar to an existing/old msgid in the same file. If Django thinks the msgids are similar enough, it will fill in the old value as the translation, but mark it as 'fuzzy' (i.e. needing review). It will also provide the old msgid value in a comment above the new one, for reference. In this example, the new msgid is "participate", which is very similar to the old "Participate" string, but not exactly the same because of the capitalization:

#: web/templates/web/study-detail.html:18
#, fuzzy
#| msgid "Participate"
msgid "participate"
msgstr "Teilnehmen"

In these cases you can decide whether to keep the suggested msgstr value or edit it. Here we might want to edit it the old translation to use the same capitalization as the new English string.
Once you have reviewed/fixed a fuzzy translation, you must remove the 'fuzzy' comment. Any translation strings that are still marked as "fuzzy" in the .po file will not actually be used by the site.

Here's the result after editing:

#: web/templates/web/study-detail.html:18
msgid "participate"
msgstr "teilnehmen"

Resources

More information can be found in the Localization section of our CONTRIBUTING file, and in the Django translation documentation.

Please also feel free to get in touch with me (Becky Gilbert) on Slack or email if I can help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant