Transifex Filter

From Okapi Framework
Revision as of 00:14, 12 March 2011 by Ysavourel (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

The Transifex Filter is an Okapi component that implements the IFilter interface to process online Transifex projects.

Transifex is an open-source translation collaborative platform. A Transifex project is a place where one party can upload files for translation, and another party can access these files to translate them online or locally.

Processing Details

This filter takes as input a local Transifex project file (.txp) described in the section below. The filter opens the file.

  • If the file does not contain any resource, the filter connects to the Transifex host specified in the file (using the credentials also specified in the file) and gets the list of all resources for this project.
  • If the file does contain one or more resources, the filter does not refrsh the list, but works with the resources currently listed.

Then, for each PO resource in the project that has for source language the source locale you have specified:

  • it downloads the translation file for the given target language. If such file does not exists yet, a file with empty translation entries is created instead.
  • it opens the downloaded file and start processing it, sending the usual filter events you receive from a PO file.
  • when a given resource is done, it moves to the next resource.

If the filter-writer for this filter is used (for example in the Filter Events to Raw Document Step), the writer re-create the modified PO files and pushes them back into the Transifex project, using the same credentials as the filter.

Parameters

Open the project file before processing — Set this option to open the project file (.txp), and possibly modify it, before processing it. This allows you to select which resource you want to process.

Project File

The local input file for this filter describes the Transifex project.

Format

It is a text file in UTF-8 with an extension .txp. It is in the following format:

host = <hostURL>
user = <username>
password = <password>
projectId = <projectId>
protectApproved = yes|no
sourceLocale = <localeCode>
targetLocale = <localeCode>
<resourceId1>[<tab>yes|no]
<resourceId2>[<tab>yes|no]
...
  • Each entry can be omitted, it will be set to a default value.
  • If the yes|no selection flag is not present for a resource it is set to selected by default.
  • Lines with only spaces or tabs and lines starting with # are ignored.

For example:

host=http://www.transifex.net
user=johndoe
password=xrt34@asf
projectId=myproject
protectApproved=yes
# Fall-back values for the source and target locales:
sourceLocale=en
sourceLocale=fr
# Resources
myfile1xmlpo yes
myfile2odtpo no

Note that the source and target locales values are used only as fall-back value. In most situations the source and locale are driven by the application calling the filter.

Editor

The project file can be edited using a dialog box.

Project Id — Enter the identifier of the project you want to work with.

Source — This displays the code of the current source locale. This field is read-only.

Target — This display the code of the current target locale. This field is read-only.

Host — Enter the URL of the host where your project is located. for example: http://www.transifex.net/

Username — Enter your username for the given host.

Password — Enter the password for the given user.

Protect approved entries — Set this option to set all entries that are not empty and not fuzzy with a non-translatable flag.

Refresh Resources List — Click this button to fetch the list of the resources in the given project, for the given source and target locales.

The table below show the list of those resources. You can set and unset the check box for each resource: the selected resources will be processed, while the ones not selected will not be processed.

Limitations

  • This filter is BETA.
  • Transifex does currently looses fuzzy flags and the corresponding translations when downloading a PO file that was uploaded with fuzzy entries. This means the filter has only one way to do round-trips without loosing target text: that is to not label it as fuzzy. This will often result in resources marked as 100% translated after upload in Transifex, while the actual translations may or may not be final.
  • Only the files that are PO-based in Transifex are handled, not TS files. Supporting TS would be easy.
  • Due to some current limitations in the pipeline mechanism, you cannot use this filter with steps that re-write different output corresponding to the resource, other than the Filter Events to Raw Document Step. For example, this filter will not work properly with the Rainbow Translation Kit Creation Step.