Overview

Transifex Common-Pool

Transifex Common-Pool is a project to provide a web service to localize Mozilla JetPacks. It is a set of Transifex addons which add the necessary functionality (common strings, overrides, filters etc) needed for this project.

The code consists of two addons:

  1. foxcore provides the basic models and API calls.
  2. foxlotte tweaks the web editor and exposes the necessary functionality to the user.

Installation Instructions

  1. Install transifex by following the Installation instructions:

    http://docs.transifex.org/intro/install.html#intro-install

  2. Clone the transifex-commonpool repository:

    hg clone http://bitbucket.org/indifex/transifex-commonpool
    
  3. Enable the commonpool addons directory by editing the file transifex/settings/89-addons.conf and adding the following line:

    ADDONS_ROOTS.append('/path/to/mozilla-addons')
    

    To make sure the addons are enabled, issue the following command and verify that the addons 'foxcore' and 'foxlotte' are enabled:

    cd transifex
    ./manage.py addons
    
  4. Create the additional DB tables and insert some sample data if you feel so:

    ./manage.py syncdb --noinput
    ./manage.py migrate
    ./manage.py loaddata txcommon/fixtures/sample_*.json
    
  5. Fire up your favorite browser and enjoy. If you inserted the sample data, you should have two users ready, 'guest' and 'editor' (with the same passwords):

    ./manage.py runserver
    firefox http://localhost:8000/
    

CommonPool API

You should be ready to go. 'foxcore' includes the push/pull strings, exception API calls and the enhancements in the data model. Here is how you can test the API:

  1. Create a project using the web interface (e.g. named 'Mozilla Jetpacks' with a slug 'mozjp').

  2. Download the CommonPool client and insert some strings:

    hg clone http://bitbucket.org/indifex/commonpool-client
    cd commonpool-client
    ./extract.py -r localhost:8000 -p mozjp -l editor -P editor test_data/testpack/
    
  3. You have access to the API calls from the following urls. 'api-moz' is just a keyword we're using in order to avoid collision with the rest of the API calls which are under /api/:

    • http://<host:port>/api-moz/foo/strings - Pull/push strings
    • http://<host:port>/api-moz/foo/overrides - Pull overrides (exceptions)

Available API options are :

strings:
Search for specific strings (e.g. ?strings=next,cancel)
jetpacks:
Search for strings inside these jetpacks (e.g. ?jetpacks=testpack,testpack2)
languages:
Return translations in these languages (e.g. ?languages=el,fr,de)
partial (only available in strings handler):

If set to 1, the API will return partial translations for languages that are not 100% completed. The default behaviour is to return 100% translation by using the fallback mechanism.

The fallback mechanism has two modes of operation. It can do a complete fallback (eg if pt_BR is not 100% return the complete translation in pt) or do partial fallbacks (eg if a string is not translated in pt_BR fetch the pt translation. The returned stringset is a mix of various languages this way). This behaviour can be changed by editing settings/00-base.conf of foxcore.