Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
194 lines (120 sloc) 5.42 KB

Internationalization

How to help with internationalization of Mozillians.org.

Installation

The message files used for translation are not in the same repository as the code, so if you are going to work on internationalization of Mozillians, you'll need to do a little more installation work.

  1. Install git client

  2. Clone the messages files repository under locale like this:

    git clone https://github.com/mozilla-l10n/mozillians-l10n.git locale
    

    Note

    The directory in the git repository is named locales but it has to be checked out to a local directory named locale.

Working on internationalization

Having checked out the message files, you should be able to use the following instructions for Mozillians.org internationalization.

Managing Strings

Note

This section is for mozillians.org core developers. Other Mozillians do not have to do any of the following to contribute to mozillians.org.

Update Pontoon

When we commit new strings or we alter already existing strings in our codebase we need to perform a string merge to update Pontoon. Pontoon is the tool localizers use to translate mozillians.org strings.

Steps to follow to perform a string merge:

  1. Update your local git repository:

    cd locale
    git checkout master
    git pull origin master
    
  2. String extract and merge:

    ./manage.py extract
    ./manage.py merge
    
  3. Check the diff to make sure things look normal:

    cd locale
    git status
    git diff
    

    Note

    Make sure things look normal. Changes in libraries (e.g. tower) can break things, like remove half of the strings.

  4. Lint translations. See :ref:`linting-translations`.

  5. Commit to git repository:

    git commit -a -m "Mozillians string merge"
    
  6. Push changes to master branch:

    git push origin master
    
  7. Optionally update production. See :ref:`updating-production-translations`.

Linting translations

Sometimes translations have coding errors. Fortunately there is tool called dennis which will find all the errors.

  1. Make sure you have dennis:

    pip install dennis
    
  2. Run dennis linter:

    dennis-cmd lint locale
    
  3. If dennis returns no errors or warnings your job is done. Otherwise continue reading.

  4. Visit each file that dennis reports and locate the problematic translation:

    1. Sometimes translations with variables are missing special characters. This can be easily fixed and you can do it. Here's an example:

      Here is the original, English string:

      msgid "Sorry, we cannot find any mozillians with skill %(name)s"
      

      and a incomplete Spanish translation:

      msgstr "Discúlpanos, pero no encontramos ningún mozillero en %(name)"
      

      The Spanish translation is missing a final s right after %(name). The missing character is part of the variable definition and without it the template engine cannot parse the template.

      We fix the incomplete translation by adding the missing character.

    2. If the translation needs attention from the translator we add fuzzy flag to the translation. This way we don't delete the broken translation but we instruct the template engine not to use it.

      For example for this translation:

      #: mozillians/templates/groups/skill.html:31
      msgid "Sorry, we cannot find any mozillians with skill %(name)s"
      msgstr "Something is wrong here"
      

      we add a line like this:

      #: mozillians/templates/groups/skill.html:31
      #, fuzzy
      msgid "Sorry, we cannot find any mozillians with skill %(name)s"
      msgstr "Something is wrong here"
      

Updating Production Translations

Production server https://mozillians.org checks out translations from the production branch instead of master.

  1. Make sure that the translations in master have no errors. See :ref:`linting-translations`

    Warning

    Translations with errors can bring (pages of the) website down. The template engine will fail to parse the strings and a 500 error will be returned to users. It is really important that translations copied to production are correct.

  2. Checkout production branch if you don't have it already:

    cd locale
    git fetch origin
    git checkout production
    
  3. Merge current master into production:

    git merge master
    
  4. Verify that everything looks good:

    git status
    git diff
    
  5. Commit merge to production branch:

    git commit -a -m "Update mozillians production strings."
    
  6. Push new strings to production branch:

    git push origin production
    
  7. Production will get the new translations on next push.

You can’t perform that action at this time.