Edgewall Software

Changes between Initial Version and Version 1 of TracL10N/Transifex


Ignore:
Timestamp:
Oct 27, 2012, 8:14:21 PM (11 years ago)
Author:
Christian Boos
Comment:

Start a tutorial about pulling and pushing from Transifex, for our translator coordinators

Legend:

Unmodified
Added
Removed
Modified
  • TracL10N/Transifex

    v1 v1  
     1= Transifex and Trac
     2
     3{{{#!box warning
     4This page is still a work-in-progress. When I'm confident the content is 100% accurate, I'll post an companion mail on trac-dev ("Trac and Transifex").
     5
     6For now, the content is enough to explain the changes I made today on Transifex (in particular see the [#Releases] section below), in case someone noticed and wondered.
     7}}}
     8
     9Once you're familiar with Transifex (they have some very good [http://help.transifex.com/ documentation] on their site), you can apply for membership to one translation team for a language, or create a new team if your language of choice isn't yet represented there (be aware that undertaking a new translation for Trac represents a //lot// of work).
     10
     11Updating translations there is only one part of the story, since you need to get your changes integrated into the source code. For that, you need to inform the translator coordinator for your language (see [..#Translationcoordination tickets for translation coordination]). She will pull the changes from Transifex using the procedure described below, verify them, and commit them. If the translator coordinator doesn't react in due time or is not active anymore, an member of the Trac team will likely notice the activity on the ticket and he could do the same but without the language verification step, obviously.
     12
     13It's even a better idea to contact and discuss with the translator coordinator **before** updating the catalogs on Transifex, as some might not be up to date, and you will risk to duplicate work and make integration harder.
     14
     15== Pulling changes from Transifex
     16
     17You want to update the Trac source code with the latest changes from Transifex, for one or more languages. Typically you'd do this for approving and committing these changes if you're a translation coordinator, or because you want to prepare a patch for submitting those changes for review on a ticket.
     18
     19=== Prerequisites
     20
     21You first need to install the [http://help.transifex.com/features/client/index.html#user-client Transifex client].
     22
     23Well, it's usually nothing more than:
     24{{{
     25easy_install transifex-client
     26}}}
     27(or one [http://help.transifex.com/features/client/index.html#getting-the-client variation of the above])
     28
     29Of course, you also need to have a [TracRepositories checkout of the source], of the branch where you want to work. [source:branches//0.12-stable] will be maintained for the foreseeable future, so you may want to start contributing there, but [source:branches//1.0-stable] is now the official stable release branch, so don't neglect it. [source:trunk] is where the new interesting stuff happen (TracDev/Proposals/ConfigEnumTranslation?).
     30
     31
     32Now let's go through a complete example. I made one update to the resource corresponding to the messages catalog on 0.12 for the [Transifex:language/fr/ French translation] (more specifically, on that page: Transifex:resource/0_12-stable-messages-pot/l/fr/).
     33
     34=== Checking the status
     35
     36First thing to do is to check if everything is correctly configured:
     37{{{#!console
     38cboos@linux:~/trac/0.12-stable$ tx status
     39No authentication data found.
     40trac -> 0_12-stable-messages-js-pot (1 of 2)
     41Translation Files:
     42 - en: trac/locale/messages-js.pot (source)
     43 - ca: trac/locale/ca/LC_MESSAGES/messages-js.po
     44 - de: trac/locale/de/LC_MESSAGES/messages-js.po
     45 - en_GB: trac/locale/en_GB/LC_MESSAGES/messages-js.po
     46 - en_US: trac/locale/en_US/LC_MESSAGES/messages-js.po
     47 - eo: trac/locale/eo/LC_MESSAGES/messages-js.po
     48...
     49}}}
     50
     51If you get the `No authentication data found.` line, you first need to authenticate yourself:
     52{{{#!console
     53cboos@linux:~/trac/0.12-stable$ mkdir tmp
     54cboos@linux:~/trac/0.12-stable$ cd tmp/
     55cboos@linux:~/trac/0.12-stable/tmp$ tx init
     56Creating .tx folder...
     57Transifex instance [https://www.transifex.com]:
     58Creating skeleton...
     59Creating config file...
     60No entry found for host https://www.transifex.com. Creating...
     61Please enter your transifex username: cboos
     62Password:
     63Updating /home/cboos/.transifexrc file...
     64Done.
     65cboos@linux:~/trac/0.12-stable/tmp$ cd ..
     66cboos@linux:~/trac/0.12-stable$ rm -fr tmp
     67}}}
     68
     69Alternatively, you can directly edit your `~/.transifexrc` file, and add:
     70{{{#!ini
     71[https://www.transifex.com]
     72hostname = https://www.transifex.com
     73password = <your actual password>
     74token =
     75username = <your account name>
     76}}}
     77`token` can be left empty, but must be present.
     78
     79Then try again:
     80{{{#!console
     81cboos@linux:~/trac/0.12-stable$ tx status | grep fr
     82 - fr: trac/locale/fr/LC_MESSAGES/messages-js.po
     83 - fr: trac/locale/fr/LC_MESSAGES/messages.po
     84}}}
     85
     86Now, before pulling changes from Transifex, **make sure you have no local modifications to the catalogs you're about to update**. Otherwise, those local modifications will be lost (well, on Windows at least; seems that on Linux it manages to make better checks with the timestamps between the local file and the file on the server).
     87
     88=== Pulling the French catalogs from Transifex #pull-example
     89
     90You made sure you have no pending local modifications, you may now pull:
     91{{{#!console
     92cboos@linux:~/trac/0.12-stable$ tx pull -l fr
     93Pulling new translations for resource trac.0_12-stable-messages-js-pot (source: trac/locale/messages-js.pot)
     94 -> fr: trac/locale/fr/LC_MESSAGES/messages-js.po
     95Pulling new translations for resource trac.0_12-stable-messages-pot (source: trac/locale/messages.pot)
     96 -> fr: trac/locale/fr/LC_MESSAGES/messages.po
     97Done.
     98}}}
     99
     100If you see 'Skipping...' messages, the Transifex client thinks it should better avoid updating your local copy. If you're sure you know better, you can pass the `-f` flag so that it updates it nevertheless.
     101
     102=== Examining the changes
     103
     104If at this point you want to check the difference ... good luck!
     105Transifex introduces a bunch of unrelated formatting changes in the translations, folding multiple lines into one, etc.
     106
     107You can get rid of these spurious changes by doing an update with Babel:
     108{{{#!console
     109cboos@linux:~/trac/0.12-stable$ make update-fr
     110python setup.py update_catalog -l fr update_catalog_js -l fr
     111running update_catalog
     112updating catalog 'trac/locale/fr/LC_MESSAGES/messages.po' based on 'trac/locale/messages.pot'
     113running update_catalog_js
     114updating catalog 'trac/locale/fr/LC_MESSAGES/messages-js.po' based on 'trac/locale/messages-js.pot'
     115}}}
     116
     117Now the changes are hopefully much more significant:
     118{{{#!diff
     119diff --git a/trac/locale/fr/LC_MESSAGES/messages.po b/trac/locale/fr/LC_MESSAGES/messages.po
     120index 00f3c3c..a33bf50 100644
     121--- a/trac/locale/fr/LC_MESSAGES/messages.po
     122+++ b/trac/locale/fr/LC_MESSAGES/messages.po
     123@@ -1,19 +1,21 @@
     124 # French translations for Trac.
     125-# Copyright (C) 2007-2008 Edgewall Software
     126+# Copyright (C) 2012 Edgewall Software
     127 # This file is distributed under the same license as the Trac project.
     128 #
     129+# Translators:
     130+# Christian Boos <cboos@edgewall.org>, 2008,2012.
     131+# Christian Boos <cboos@neuf.fr>, 2008.
     132 # Emmanuel Blot <emmanuel.blot@free.fr>, 2007.
     133-# Christian Boos <cboos@edgewall.org>, 2008.
     134 # Michel Briand <michelbriand@free.fr>, 2008.
     135-# Stéphane Raimbault <stephane.raimbault@gmail.com>, 2009
     136+# Stéphane Raimbault <stephane.raimbault@gmail.com>, 2009.
     137 msgid ""
     138 msgstr ""
     139-"Project-Id-Version: Trac 0.12\n"
     140-"Report-Msgid-Bugs-To: trac-dev@googlegroups.com\n"
     141+"Project-Id-Version:  Trac\n"
     142+"Report-Msgid-Bugs-To: http://trac.edgewall.org/\n"
     143 "POT-Creation-Date: 2012-01-29 14:04+0100\n"
     144-"PO-Revision-Date: 2011-01-25 20:28+0100\n"
     145+"PO-Revision-Date: 2012-10-27 13:13+0000\n"
     146 "Last-Translator: Christian Boos <cboos@edgewall.org>\n"
     147-"Language-Team: fr_FR <trac-dev@googlegroups.com>\n"
     148+"Language-Team: French <trac-dev@googlegroups.com>\n"
     149 "Plural-Forms: nplurals=2; plural=(n > 1)\n"
     150 "MIME-Version: 1.0\n"
     151 "Content-Type: text/plain; charset=utf-8\n"
     152@@ -2654,7 +2655,7 @@ msgstr "à %(owner)s"
     153 #: trac/ticket/default_workflow.py:251 trac/ticket/default_workflow.py:271
     154 #, python-format
     155 msgid "The owner will be changed from %(current_owner)s"
     156-msgstr "Le propriétaire changera de %(current_owner)s"
     157+msgstr "Le propriétaire ne sera plus %(current_owner)s"
     158 
     159 #: trac/ticket/default_workflow.py:259
     160 #, python-format
     161}}}
     162
     163It's a good idea to get rid of the changes in the first hunk. With git, it's easy:
     164{{{#!console
     165cboos@linux:~/trac/0.12-stable> git checkout -p
     166diff --git a/trac/locale/fr/LC_MESSAGES/messages.po b/trac/locale/fr/LC_MESSAGES/messages.po
     167index 00f3c3c..a33bf50 100644
     168--- a/trac/locale/fr/LC_MESSAGES/messages.po
     169+++ b/trac/locale/fr/LC_MESSAGES/messages.po
     170@@ -1,19 +1,21 @@
     171 # French translations for Trac.
     172-# Copyright (C) 2007-2008 Edgewall Software
     173+# Copyright (C) 2012 Edgewall Software
     174 # This file is distributed under the same license as the Trac project.
     175 #
     176+# Translators:
     177+# Christian Boos <cboos@edgewall.org>, 2008,2012.
     178+# Christian Boos <cboos@neuf.fr>, 2008.
     179 # Emmanuel Blot <emmanuel.blot@free.fr>, 2007.
     180-# Christian Boos <cboos@edgewall.org>, 2008.
     181 # Michel Briand <michelbriand@free.fr>, 2008.
     182-# Stéphane Raimbault <stephane.raimbault@gmail.com>, 2009
     183+# Stéphane Raimbault <stephane.raimbault@gmail.com>, 2009.
     184 msgid ""
     185 msgstr ""
     186-"Project-Id-Version: Trac 0.12\n"
     187-"Report-Msgid-Bugs-To: trac-dev@googlegroups.com\n"
     188+"Project-Id-Version:  Trac\n"
     189+"Report-Msgid-Bugs-To: http://trac.edgewall.org/\n"
     190 "POT-Creation-Date: 2012-01-29 14:04+0100\n"
     191-"PO-Revision-Date: 2011-01-25 20:28+0100\n"
     192+"PO-Revision-Date: 2012-10-27 13:13+0000\n"
     193 "Last-Translator: Christian Boos <cboos@edgewall.org>\n"
     194-"Language-Team: fr_FR <trac-dev@googlegroups.com>\n"
     195+"Language-Team: French <trac-dev@googlegroups.com>\n"
     196 "Plural-Forms: nplurals=2; plural=(n > 1)\n"
     197 "MIME-Version: 1.0\n"
     198 "Content-Type: text/plain; charset=utf-8\n"
     199Discard this hunk from worktree [y,n,q,a,d,/,j,J,g,s,e,?]? y
     200@@ -2654,7 +2655,7 @@ msgstr "à %(owner)s"
     201 #: trac/ticket/default_workflow.py:251 trac/ticket/default_workflow.py:271
     202 #, python-format
     203 msgid "The owner will be changed from %(current_owner)s"
     204-msgstr "Le propriétaire changera de %(current_owner)s"
     205+msgstr "Le propriétaire ne sera plus %(current_owner)s"
     206 
     207 #: trac/ticket/default_workflow.py:259
     208 #, python-format
     209Discard this hunk from worktree [y,n,q,a,d,/,K,j,J,g,e,?]? q
     210}}}
     211
     212Note that you can also do `make diff` for a more up-to-the-point output. FIXME //based on `svn diff` only//
     213
     214
     215=== Do something with those changes...
     216
     217... do whatever you wish, for example commit the changes to the source with an appropriate log message, **but**, please!, before that:
     218 - remember to check your catalog with `make check` (here, `make check-fr`)
     219 - remember to check your catalog by compiling it (here `make compile-fr`)
     220
     221
     222=== Pushing local modifications of the French catalogs to Transifex #push-example
     223
     224After the commit, if you did any local adaptations like the removal of the spurious metadata changes, you can also push those changes back to Transifex the same way, as Transifex **won't** pick up the changes made to the translated catalogs from the repository (it will do that for the catalog templates though, so the latter are always up-to-date).
     225
     226{{{#!console
     227cboos@linux:~/trac/0.12-stable$ tx push -t -l fr
     228Pushing translations for resource trac.0_12-stable-messages-js-pot:
     229Pushing 'fr' translations (file: trac/locale/fr/LC_MESSAGES/messages-js.po)
     230Pushing translations for resource trac.0_12-stable-messages-pot:
     231Pushing 'fr' translations (file: trac/locale/fr/LC_MESSAGES/messages.po)
     232Done.
     233}}}
     234
     235
     236== Notes about the Transifex "Releases"  #Releases
     237Transifex is not exactly clear if a release should be a line of development (branch) or a given released version. It supports both and let you choose to organize you the way wish.
     238
     239I opted to make the "releases" match our maintenance branches, and not individual releases (well, we still have a [Transifex:r/012-stable-3/ few of these], as apparently you can't delete a release).
     240
     241The downside is that string freeze periods and release dates will need to be adjusted constantly on the same release. The alternative, creating a new "release" for each actual version we release bears as much overhead (more even, are there's no //copy// operation) and doesn't bring any benefit besides keeping a record of the versions we made, record that we obviously maintain here anyway in the [/roadmap].
     242
     243OTOH, the big benefit is that all the links from t.e.o to Tx won't need to be updated after each minor release. The only updates needed will be at the occasion of introducing a new major release (i.e. for 1.2).