Archive for the ‘Pootle’ Category

I cannot submit my translation with pootle

Thursday, August 28th, 2008

Pootle has a rights-management mechanism. It’s possible that you’re capable of viewing content to be translated, even to click on edit and enter text, but if you don’t see “submit” button, it simply means you’ve no right to submit translation (i.e. you’re not considered to be a translator).

In this case:

  1. contact the website administrator (or login as admin if it’s you)
  2. go to the admin page
  3. go to the projects admin page
  4. click on the project name for which you want to set permissions
  5. click on the language for which you want to set permissions
  6. add permissions for your user, make sure to select “translate” right
  7. Repeat these steps for each language you want to translate into

[sources]

  • http://translate.sourceforge.net/wiki/pootle/permissions

translate-toolkit: html2po converter

Thursday, August 28th, 2008

Html2po converter is used to extract content to be translated, using an html file as input and return a po file as output, format used by translation management softwares (like Pootle).

Problem is sometimes html is not correctly parsed on some html nodes appear when they sould not.
As seen in previous post on Pootle, we generate .pot files that pootle will use as template and automatically generate .po files for each translation language. Good news is that .pot file is just text (it’s python code) => you can edit it with a simple text editor.

Therefore, if you spot parsing errors on source content using pootle, or any other error on source content:

  1. update you .pot file
  2. then regenerate .po file so that modifications will span on all languages (cf “how to add files for translation to Pootle projects?” post to see how to do it using Pootle admin interface)

Good news is that already translated content won’t get deleted, incl. translation of currently modified content. Bad news is that it won’t be highlighted to force a second check => if you need to update all your translations, you will have to find your entry manually

How to add files for translation to Pootle projects?

Thursday, August 28th, 2008

In this section, we will try to explain how to add files for translation to pootle projects.
I am very new to Pootle, so it may not be the regular way to do it, but I’ve spent one entire day looking for clear explanations / guides, without finding any so I tried to do it on my own, with a trial-and-error approach.

For this example, we consider we want to translate an existing html (to_translate.html) file using Pootle. We consider also that we’ve created an administrator account we can log into, along with a dedicated pootle project that will host this file, and that file format we chose for this project is po (.po) (=> “as of version 1.1.1, “xlf” format is not working).

Here are the steps to follow:

  1. first, we need to convert our html file in a format that Pootle can understand: .pot format (standing for “po template”). To do this, we use html2po script that pootle package included.
    Run

    html2po --pot -i to_translate.html -o to_translate.pot
  2. go to your project folder, it should be located into /var/lib/pootle/<project_code>/templates
    if “templates” folder does not exist, create it (“sudo mkdir /var/lib/pootle/<project_code>/templates”)
  3. move your .pot file into templates directory: “sudo mv to_translate.pot /var/lib/pootle/<project_code>/templates/”
  4. start PootleServer (“sudo PootleServer”) (if it was already running, kill it and start it again, otherwise sometimes displayed content does not update properly)
  5. log into pootle as admin
  6. click on : admin / projects / <your_project_code>
  7. check all the languages and click “update languages”. This will create .po files in each language folder, based on our provided .pot file
  8. click on “All projects” / <your_project_code>, and if successful, you should see red bars representing untranslated files.
    If you do not see them, kill PootleServer and start it back, then refresh your page. If you still don’t see anything, repeat the steps from the beginning

Well, that was the hard part!

How to create Pootle projects?

Thursday, August 28th, 2008

We will try to explain how to create new translation projects using pootle. For now, it will be very simple projects, without svn repository.

  1. First go to your Pootle server and log in as admin (see previous post on Pootle installation if you don’t know how to do it)
  2. On top menu, click on “admin” link
  3. click on “projects” link
  4. You can remove both Pootle and Terminology projects, since they are generic / examples and do not correspond to any concrete project, and create your new project using provided interface:
    • “project code” is used in url
    • “full name” is displayed project name
    • “project description”, self explanatory
    • “file type”, chose “po” (I tried “xlf” which refers to XLIFF standard, which is xml based => easier to maintain and modified since it is editable with a simple text editor, but it did not work => I used “po”)
  5. click on save changes, a line with your project settings should appear
  6. now it’s time to define which translation languages are to be used:
    1. still on this page, click on your project code
    2. now add required languages using drop down menus
  7. click on “All projects” link in the top menu and you should see your new project within the “projects” section

Now it’s time to add files to your project! (cf. next post)

How to install Pootle?

Thursday, August 28th, 2008
  1. First install Pootle: “sudo apt-get install pootle” (it will install translate-toolkit as well)
  2. Then you must launch a pootle server, run “sudo PootleServer”, it will load pootle on port 8080 (if it is already in use by another program, then specify your own port with -P option)
  3. Connect to Pootle with your web browser, at the following url: http://127.0.0.1:8080 (change 8080 to your running port)
    Be aware, Pootle does not work properly on Opera (=> FF seems ok)
  4. At this point you should see Pootle home page
  5. First you need to create an account => click on Register on the top right menu
  6. Proceed with registration, enter a valid email and once registration is complete, you should receive an email with an activation link, activate your account
  7. Now, we need to transform this regular user account into an admin account:
    1. edit /etc/pootle/users.prefs: sudo vi “/etc/pootle/users.prefs”
    2. you should see a section with your username, add the following line (do not forget to indent it as other lines are): rights.siteadmin = True
  8. Now we need to restart PootleServer. Unfortunately I did not find how to do it, other than kill it and reload it again
    1. kill the server “ps aux | grep PootleServer” and kill corresponding PIDs (“sudo kill xxx”)
    2. restart it: “sudo PootleServer &”
  9. Go back to pootle site (http://127.0.0.1:8080) and login

How does Pootle work?

Thursday, August 28th, 2008

Pootle looks like a great tool, it’s used in a lot of translation projects… but regarding documentation, it’s like hell! I’ve spent an entire day trying to find out to add files into projects for translating them.

I will try to explain what I understood from pootle.

First Pootle in itself is just a translation interface, written in python, accessible via a web browser. All file format handling is done by another project, Translate-toolkit, also handled by Pootle team.

You use translate-toolkit to translate files into required formats (for example from html format to pootle format, and once translation is done, from pootle to xliff (so that you can use it with Zend_Translate).

Zend_Translate xliff bugs / limitations

Thursday, August 28th, 2008

I find Zend Framework to be very great for php developments. Its api doc is of high quality and its ref manual is not bad. Once you’re used to it, it speeds up your developments a lot, but above all makes them easier to maintain.

Another great point of using this framework is that it helps you benefit from industry standards you may not know.
For instance I wanted to translate my website (www.qc4web.com) both in English and Spanish. At first I thought defining PHP constants and include correct file depending on which language is active. I’m pretty sure it would work well, but I gave a look at Zend_Translate, and it made me discover how translation professional works.

Learning curve in this area, especially if you use open-source tool Pootle, is very high (pootle documentation is so bad!), but I am pretty sure It will benefit on the long run.

=> I used Zend_Translate_Adapter_Xliff (I chose xliff format because it’s xml based and pretty forthcoming), and I tried to use Pootle as translation interface.

Implementing pootle generated files, I found some bugs / limitation to Zend_Translate_Adapter_Xliff, v.1.3 and raised bug reports for each:

  • http://framework.zend.com/issues/browse/ZF-4084
  • http://framework.zend.com/issues/browse/ZF-4085
  • http://framework.zend.com/issues/browse/ZF-4087

Basically, what you must keep in mind is that Zend_Translate_Adapter_Xliff except your xliff file to have a target-language attribute in its <file> node. According to Oasis specification, this attribute is optional, and for now I did not find how to make it appear in pootle generated document (=> I add them manually), but you definitely must add it or implement sthg like the solution I proposed in bug reports (but each time you update your zend framework, you will need to make the changes again).