lookit / lookit/lookit-api

Update out-of-date translation files

Open
#1,380 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Participant Researcher Translation
Dominant language
Python
Stars
12
Forks
21
Avg merge
5d 19h
Merged PRs (30d)
5

Description

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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by updating your fork from the develop branch and choose the language .po file you can review. Search for empty msgstr values and fuzzy entries, using the Localization section of CONTRIBUTING.md and Django's translation documentation for context. Done means reviewed translations are filled in and fuzzy markers are removed; optionally run make compilemessages and check the locale locally.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
localization
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.