« Voltar para Translating...

Uploading properties files to Pootle

One of the Pootle features is the ability to upload properties files. This option allows translators to use any tool to translate Liferay, thus avoiding the Pootle UI:

  1. Pick-up a project and a language from your Pootle home page

  2. Go to "Translate" tab

  3. Click on "Export", the Language.properties file will be downloaded

  4. Use the tool of your choice to edit the file

  5. Return back to the "Translate" tab, then upload the file in Pootle 

Depending on your role in Pootle, you will be able to tell Pootle what to do with the file:

  • If you are a translation leader, you will be able to overwrite translations on Pootle DB with those in the file ("Overwrite the current file if it exists") or preserve what is on the Pootle DB ("Merge the file with the current file and turn conflicts into suggestions").
  • If you are a contributor, you will be able to suggest the translations contained in the file ("Add all new translations as suggestions").

We would like to talk about several things related to this procedure. They are not issues per-se, but if you are not aware, they can cause a bit of headache. They are gathered from our user's experiences.  In addition, we try to provide some advice in order to avoid misunderstandings.

Untranslated keys are also downloaded

Let's suppose that the project translation is 85% complete. This roughly means that 15% of the keys have no translation for your language. When downloading the file (see step 3 above), Pootle will include those untranslated keys, and their value will be the one given in Language.properties file (that is, the en_US value).

If you accidentally change any of their values, when file is uploaded back to Pootle, those values become new translations to your language. To Pootle eyes, those keys are correctly translated and contribute to the overall translation progress (i.e they no longer appear in the "Quick translate" list). Moreover, if you upload a file containing only those keys you have translated, and select option "Overwrite the current file if it exists", then you will delete from pootle DB all keys not contained in the file you just uploaded. 

Our advice here is to be sure that you upload correct keys, so Language files modified outside Pootle sholud be double-checked.

Make sure you upload an ASCII-encoded file

When you export a Language file from Pootle, you get an ASCII encoded file. Please take into account that Language_.properties files available on our git/svn repos are UTF-8 encoded. This means that you should not grab a file from SVN, make some translations and upload it into Pootle. Moreover, you need to make sure that your editor or tool has not changed the encoding after saving the file.

Our advice here is to check the file encoding before uploading it to Pootle. If you use Linux, a quick way to check the encodings is described below using the Catalan language as example:

1. Export the Language_ca.properties from Pootle into /var/tmp. Check the encoding and see how special characters (such as tildes) are escaped:

dsanz@light:$ file /var/tmp/*.properties 
/var/tmp/Language_ca.properties: ASCII text
dsanz@light:$ more /var/tmp/Language_ca.properties
account-settings=Configuraci\u00F3 del compte  

2. Convert it to UTF-8 (this conversion may be done by a text editor without user knowledge). Now, special characters are correctly displayed in the shell:

dsanz@light:$ native2ascii -reverse -encoding utf-8 /var/tmp/Language_ca.properties /var/tmp/Language_ca-UTF8.properties 
dsanz@light:$ file /var/tmp/*.properties 
/var/tmp/Language_ca.properties:      ASCII text 
/var/tmp/Language_ca-UTF8.properties: UTF-8 Unicode text 
dsanz@light:$ more /var/tmp/Language_ca-UTF8.properties 
account-settings=Configuració del compte

Please note that this file should not be uploaded to Pootle due to the UTF-8 encoding.

3. Convert it again to ASCII:

dsanz@light:$ native2ascii -encoding utf-8 /var/tmp/Language_ca-UTF8.properties /var/tmp/Language_ca-ascii.properties 
dsanz@light:$ file /var/tmp/*.properties 
/var/tmp/Language_ca-ascii.properties: ASCII text
/var/tmp/Language_ca.properties:       ASCII text
/var/tmp/Language_ca-UTF8.properties:  UTF-8 Unicode text
dsanz@light:$ more /var/tmp/Language_ca-ascii.properties 
account-settings=Configuraci\u00f3 del compte 

Please note that the file Language_ca-ascii.properties can be uploaded to Pootle.


We hope that these advices help you to save time when translating Liferay. 

0 Anexos
20654 Visualizações
Média (1 Votar)
A média da avaliação é 5.0 estrelas de 5.