Difference between revisions of "Service/translate"

From Sugar Labs
Jump to navigation Jump to search
 
(20 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 +
{{Obsolete | Replaced by [[ Service/Weblate]]}}
 +
 
== Hostnames ==
 
== Hostnames ==
  
 
* http://translate.sugarlabs.org/
 
* http://translate.sugarlabs.org/
 
Additional urls:
 
 
* http://translate.sugarlabs.org/status, status page
 
* http://translate.sugarlabs.org/langpacks, language packs
 
  
 
== Hosted on ==
 
== Hosted on ==
  
[[Machine/treehouse/pootle]]
+
[[Machine/pootle]]
  
 
== Administrative contact ==
 
== Administrative contact ==
  
 
* translate AT sugarlabs DOT org
 
* translate AT sugarlabs DOT org
 
  
 
== Sysadmins ==
 
== Sysadmins ==
Line 21: Line 17:
 
For non-emergency calls, preferably send email to the administrative contact.
 
For non-emergency calls, preferably send email to the administrative contact.
  
* [[User:SayaminduDasgupta|Sayamindu Dasgupta]] has system admin and Pootle admin privs.
+
* [[User:Sebastian|Sebastian Silva]] has assumed maintainership tasks
* [[User:Cjl|Chris Leonard]] has Pootle administrator privs.
+
* [[User:Cjl|Chris Leonard]] has Pootle administrator privs, and heads the localization efforts.
* [[User:தங்கமணி_அருண்|தங்கமணி_அருண்(Thangamani Arun)]] has system admin and Pootle administrator privs.
 
* [[User:RafaelOrtiz | Rafael Ortiz]] has system admin and Pootle admin privs.
 
 
* [[User:Bernie|Bernie Innocenti]] has system admin and Pootle administrator privs, but takes care only of OS-level administration.
 
* [[User:Bernie|Bernie Innocenti]] has system admin and Pootle administrator privs, but takes care only of OS-level administration.
 +
* [[User:SayaminduDasgupta|Sayamindu Dasgupta]] is the former admin. He still has an emeritus sysadmin account and he can be very helpful if contacted by email.
  
 
== Language Administrators ==
 
== Language Administrators ==
Line 33: Line 28:
 
More information on language administrator duties can be found on [[Translation_Team/Administration_QuickStart|this page]]
 
More information on language administrator duties can be found on [[Translation_Team/Administration_QuickStart|this page]]
  
 +
== Notes ==
 +
 +
{| class="wikitable"
 +
|-
 +
!scope="row" | Home
 +
|{{Code|/var/lib/pootle}}
 +
|-
 +
!scope="row" | Daemon
 +
|
 +
{{Code|/etc/init.d/apache2}}<br>
 +
{{Code|/etc/init.d/pootle}}
 +
|-
 +
!scope="row" | Logs
 +
|{{Code|/var/log/apache2}}
 +
|-
 +
!scope="row" | Config
 +
|
 +
{{Code|/etc/apache2/sites-enabled/000-default}}<br>
 +
{{Code|/etc/cron.d/pootle}}<br>
 +
{{Code|/var/www/pootle/sugarlabs/pootle.conf}}<br>
 +
|-
 +
!scope="row" | Ports
 +
|
 +
{{Code|80}} HTTP server
 +
|-
 +
|}
  
 
== Upgrade notes ==
 
== Upgrade notes ==
 +
 
*A backup of the DB and pootle localsettings.py must be done also.
 
*A backup of the DB and pootle localsettings.py must be done also.
 
*Backup of the /var/lib/pootle structure
 
*Backup of the /var/lib/pootle structure
Line 42: Line 64:
 
== Mantainance Notes ==
 
== Mantainance Notes ==
  
Pootle in Sugar is maintained. (dirakx has step-up to be maint)
+
Pootle in Sugar is maintained. (icarito has step-up to be maint)
 +
 
 +
== Migrated to Pootle 2.5.0 ==
 +
 
 +
Notes on the process were recorded here:  [[Service/translate/Pootle2.5]]
 +
 
 +
== Files ==
 +
 
 +
Important files and directories in the root directory, {{Code|/var/lib/pootle}}.
 +
 
 +
{{Code|'''checkouts'''}}<br>
 +
Sources are checked out in this directory and being used to keep final {{Code|.pot}} and {{Code|.po}} files. The hierarchy is:
  
We (godiard / martin_xsa / erikos / dirakx / Bernie / Dogi) are trying to resolve the pending issues because we need working translations.
+
checkouts/''pootle-project''/''pootle-po-filename-without-po-suffix''/''sources''
  
To date translations are working, we are working in a new VM pootle-devel to test upgrades of the Pootle/Django/Translate-toolkit stack.
+
{{Code|'''translations'''}}<br>
 +
Pootle uses this directory as a sources of files to translate, it contains symlinks to files from the {{Code|checkouts}} directory. The hierarchy is:
  
The last maintainer was Sayamindu Dasgupta and we asked he our doubts, i am putting here this information.
+
translations/''pootle-project''/''lang''/''symlinks-to-po-files''
  
== Basic info: ==
+
{{Code|'''maintenance'''}}<br>
 +
Contains some sugar-specific scripts to help maintain our Pootle instance, they are managed in http://git.sugarlabs.org/projects/pootle-helpers.
  
The pootle directory is:
+
{{Code|'''maintenance/helpers/potupdater/project_list.ini'''}}<br>
/var/lib/pootle
+
This is an Ini file that contains configuration for all used sources repositories. Each section describes one sources repository, where section name is full path, in form of {{Code|/var/lib/pootle/checkouts/''pootle-project''/''pootle-filename''/''some-path-within-sources''/''pot-file''}}, to the {{Code|.pot}} file, and contains following options:
  
The translations live in:  
+
* {{Code|project}} required, meaning-less project name;
 +
* {{Code|vcs}} required, the type of VCS for; supported values are: {{Code|git}};
 +
* {{Code|method}} required, the method how to generate {{Code|.pot}} files from sources; supported values are: {{Code|bundlebuilder}} for activities, {{Code|intltool}} for intltool based projects;
 +
* {{Code|layout}} required, ?;
 +
* {{Code|ignore-files}} optional, the semicolon separated list of file paths that are relative to the sources root; if {{Code|method}} is {{Code|bundlebuilder}} this value will be used to ignore while producing {{Code|.pot files}};
  
/var/lib/pootle/translations
+
== Tools ==
  
== Creating branches: ==
+
* {{Code|potupdater/pogenerator.py}} pulls from git and svn so we have updated sources, then it generates a new .pot file from them. Translated strings get reflected in the .po files in each module, and when the language maintainer clicks the Commit to VCS link, get pushed back to the upstream module.
 +
* {{Code|admin/pootlepopulator.py}} checkout sources.
 +
* {{Code|misc/pootle.cron}} all daily basis routines.
 +
* ''...''
  
* Each branch (eg: glucose-0.92) is a directory in the translations directory
+
== Tips ==
Each project is a subdirectory inside this directory (eg: glucose-0.90/sugar)
 
These are actually symlinks to directories /var/lib/pootle/checkouts
 
  
* There's a script called pootlepopulator.py[1] It is invoked as
+
=== Create new Pootle project ===
pootlepopulator.py category GIT_URL checkout_directory [branch]
 
So, assuming the directory /var/lib/pootle/translations/glucose92 exists,
 
you can issue these commands:
 
  
sudo -u pootle python pootlepopulator.py glucose92 gitorious@git.sugarlabs.org:sugar/mainline.git  sugar sucrose-0.92
+
* Create new project in Pootle admin menu, ''admin->projects'';
sudo -u pootle python pootlepopulator.py glucose92 gitorious@git.sugarlabs.org:sugar-base/mainline.git  sugar-base sucrose-0.92
+
* Add all needed langs;
sudo -u pootle python pootlepopulator.py glucose92 gitorious@git.sugarlabs.org:sugar-toolkit/mainline.git  sugar-toolkit sucrose-0.92
+
* Checkout all sources using command:
  
pootlepopulator script can be found in maintainance/helpers directory in /var/lib/pootle
+
sudo -u pootle -i python maintenance/helpers/admin/pootlepopulator.py ''pootle-project'' ''git-clone-url'' ''pootle-filename-wo-po-suffix'' ''git-branch''
  
As these projects doesn't have pots we most copy them from  master
+
Example:
 
cp /var/lib/pootle/checkouts/glucose/sugar/po/sugar.pot /var/lib/pootle/checkouts/glucose92/sugar/po/
 
cp /var/lib/pootle/checkouts/glucose/sugar-base/po/sugar-base.pot /var/lib/pootle/checkouts/glucose92/sugar-base/po/
 
cp /var/lib/pootle/checkouts/glucose/sugar-toolkit/po/sugar-toolkit.pot /var/lib/pootle/checkouts/glucose92/sugar-toolkit/po/
 
  
Pootlepopulator cannot create symlinks (what add_langs does for activities)
+
To checkout the sugar in the branch sucrose-0.94 (in pootle is in the project glucose94) we sshould do:
then gonzalo had to modify it to only create symlinks and not cloning thus we finnaly run. 
 
  
  sudo -u pootle python  create_translation_links.py glucose92  sugar sucrose-0.92
+
  cd /var/lib/pootle/
  sudo -u pootle python create_translation_links.py glucose92  sugar-base sucrose-0.92
+
  sudo -u pootle -i python maintenance/helpers/admin/pootlepopulator.py glucose94 gitorious@git.sugarlabs.org:sugar/mainline.git sugar sucrose-0.94
  sudo -u pootle python  create_translation_links.py glucose92  sugar-toolkit sucrose-0.92
 
  
* Once this is done, you need to create project in Pootle admin - go
+
* Add new sections to the [[#Files|project_list.ini]] file to describe new {{Code|.pot}} locations;
to '''admin->projects''' and create a project called Sucrose 0.90 with the
+
* Run {{Code|misc/pootle.cron}} script from {{Code|pootle}} user to generate all sufficient files;
code sucrose-0.90 (same as the directory name)
+
* Click ''rescan the project files'' in ''Templates->Project->Files'' to reveal newly created {{Code|.pot}} files;
 +
* Click ''Update from templates'' for all languages in newly created project to peek up {{Code|.po}} files symlinked by {{Code|misc/pootle.cron}} script.
  
* Add langs on the pootle web ui.
+
=== Adding activities ===
  
* '''Restart''' Pootle and Apache if the new project does not show up after this.
+
Before registering new activity on http://translate.sugarlabs.org, make sure that:
  
* '''Add''' the new projects to   ''maintenance/helpers/potupdater/project_list.ini''
+
* New activity is being hosted on http://git.sugarlabs.org;
 +
* The {{Code|pootle}} user was added to the repository with commit access rights;
 +
* You have a proper {{Code|GIT_URL}} to clone repository from with commit permissions, e.g., {{Code|gitorious@git.sugarlabs.org:cartoon-builder/mainline.git}}; that might be found on home page in Gitorious, e.g., http://git.sugarlabs.org/cartoon-builder, in ''Clone & push urls'' field with selector ''SSH'';
 +
* You know the proper {{Code|CATEGORY}} name to register the project in;
 +
* There is an unique {{Code|NAME}} of activity, this name will be used as a name of project in Pootle and directory name;
 +
* You know the proper {{Code|BRANCH}} in Git repository to use for translation; by default, it is {{Code|master}}.
  
* '''Copy strings from master to your branch'''
+
To process the registration, login to translate.sugarlabs.org and enter:
cd /var/lib/pootle/translations/glucose92
 
for DIR in `ls ../glucose`; do cp ../glucose/$DIR*.po ./$DIR;
 
  
* In web UI, you must update project ''Templates'', all lang admins must ''update from templates'' in each language. 
+
sudo -u pootle python /var/lib/pootle/maintenance/helpers/admin/pootlepopulator.py ''<CATEGORY>'' ''<GIT_URL>'' /var/lib/pootle/checkouts/''<CATEGORY>''/''<NAME>'' [''<BRANCH>'']
  
* '''Your project is created.'''
+
After that, for [http://git.sugarlabs.org/pootle-helpers pootle-helper] project in {{Code|potupdater/project_list.ini}}, add the following strings:
  
[1] http://git.sugarlabs.org/pootle-helpers/mainline/blobs/master/admin/pootlepopulator.py
+
[/var/lib/pootle/checkouts/''<CATEGORY>''/''<NAME>''/po/''<.pot-filename>'']
 +
project = ''<NAME>''
 +
vcs = git
 +
method = bundlebuilder
 +
layout = gnu
  
== Adding activities ==
+
Commit new changes, and pull from on pootle VM:
*Do:
 
''Note:'''''The git url must be writable by Pootle.'''
 
  
  2!root@pootle:/var/lib/pootle/maintenance/helpers/admin# sudo -u pootle python ./pootlepopulator.py  honey git://git.sugarlabs.org/fototoon/mainline.git fototoon
+
  (cd /var/lib/pootle/maintenance/helpers; sudo -u pootle git pull origin master)
******** Cloning git://git.sugarlabs.org/fototoon/mainline.git to /var/lib/pootle/checkouts/honey/fototoon *********
 
Running git clone git://git.sugarlabs.org/fototoon/mainline.git /var/lib/pootle/checkouts/honey/fototoon
 
Initialized empty Git repository in /var/lib/pootle/checkouts/honey/fototoon/.git/
 
******** Switching to branch master *********
 
Running  git checkout --track -b master origin/master
 
Running git pull
 
Already up-to-date.
 
********* Git operation completed, moving to next stage ********
 
********* Searching for POT file *********
 
********* Found POT file FotoToon.pot *********
 
********* Starting to symlink files *********
 
  Linking /var/lib/pootle/checkouts/honey/fototoon/po/es.po to /var/lib/pootle/translations/honey/es/fototoon.po
 
  Linking /var/lib/pootle/checkouts/honey/fototoon/po/fr.po to /var/lib/pootle/translations/honey/fr/fototoon.po
 
  Linking /var/lib/pootle/checkouts/honey/fototoon/po/FotoToon.pot to /var/lib/pootle/translations/honey/templates/fototoon.pot
 
********* Done Symlinking *********
 
  
* Do '''update from templates''' on the ''templates'' project on Pootle's frontend.
+
Do ''update from templates'' on the ''templates'' project on Pootle's frontend. And wait until daily cron job will populate languages for newly registered project, or run it immediately:
  
*Then run the '''add_langs.py''' script in order to have all the lang.po in place.
+
sudo -u pootle python /var/lib/pootle/maintenance/helpers/admin/add_langs.py
  
*Then your activity must be in place to be translated and ''commit to VCS/update from VCS'' links must be activated.
+
Then your activity must be in place to be translated and ''commit to VCS/update from VCS'' links must be activated.
  
== Working with git in the pootle server ==
+
=== Working with git in the pootle server ===
  
 
The git operations must be done by the pootle user:
 
The git operations must be done by the pootle user:
Line 150: Line 172:
 
Other important script is pogenerator.py this script re-generates pot in each repo.
 
Other important script is pogenerator.py this script re-generates pot in each repo.
  
== Resolving conflicts ==  
+
=== Resolving conflicts ===  
  
 
If the maintainer did a commit with a file in the po directory we will have a conflict, and Pootle can not do a pull.
 
If the maintainer did a commit with a file in the po directory we will have a conflict, and Pootle can not do a pull.
Line 159: Line 181:
 
  sudo -u pootle git pull -s ours
 
  sudo -u pootle git pull -s ours
  
 
+
=== Checking that pootle is working ===
== Checking that pootle is working ==
 
  
 
* When commiting from pootle interface, repos in git reflect the commit as something similar to:
 
* When commiting from pootle interface, repos in git reflect the commit as something similar to:
Line 173: Line 194:
 
  ####### Checking POT for Write (master) ######
 
  ####### Checking POT for Write (master) ######
  
 +
=== Etoys .pot update ===
  
== Notes ==
+
Go to Etoys translation directory (that is svn checkout from upstream project):
  
How to manipulate users:
+
su - pootle
 +
cd ~/translations/etoys_new
  
django-admin shell --settings=pootle.settings
+
Since there is no need in changing .pot files on Pootle level, revert local changes if they present:
>>> from django.contrib.auth.models import User
 
>>> u = User.objects.get(username='bernie')
 
>>> u.is_superuser = True
 
>>> u.save()
 
  
 +
svn revert templates/*.pot
  
Various scripts documented here:
+
Fetch new update from the upstream:
  
http://git.sugarlabs.org/projects/pootle-helpers
+
svn up templates
  
Scheduled jobs :
+
=== Tips ===
  
pootle@pootle:~$ cat /etc/cron.d/pootle
+
* How to manipulate users:
MAILTO="godiard@sugarlabs.org"
 
MAILTO="rafael@sugarlabs.org"
 
# m h  dom mon dow user command
 
30 00 * * * pootle /usr/bin/python      /var/lib/pootle/maintenance/helpers/potupdater/pogenerator.py  /var/lib/pootle/maintenance/helpers/potupdater/project_list.ini
 
#00 00 * * * pootle git --git-dir=/var/lib/pootle/checkouts/etoys/.git pull
 
45 00 * * * pootle python  /var/lib/pootle/langpackgen/src/LangPackGen/pack_generator.py  /var/lib/pootle/langpackgen/data/langpackgen_84.ini  /var/lib/pootle/public_html/packs/0.84
 
40 00 * * * pootle python    /var/lib/pootle/langpackgen/src/LangPackGen/pack_generator.py  /var/lib/pootle/langpackgen/data/langpackgen_82.ini  /var/lib/pootle/public_html/packs/0.82
 
50 00 * * * pootle  /var/lib/pootle/maintenance/helpers/potupdater/check_unmerged_translations.s h
 
55 00 * * * pootle /var/lib/pootle/maintenance/helpers/potupdater/check_bad_ownership.sh
 
  
 +
django-admin shell --settings=pootle.settings
 +
>>> from django.contrib.auth.models import User
 +
>>> u = User.objects.get(username='bernie')
 +
>>> u.is_superuser = True
 +
>>> u.save()
  
''Refresh stats'', needed when the database and the checked out modules get out of sync:
+
* Refresh stats, needed when the database and the checked out modules get out of sync:
 
 
/usr/lib/python-django/bin/django-admin.py refresh_stats --settings=pootle.settings
 
 
 
Important directories in /var/lib/pootle:
 
 
 
'''checkouts''': modules are checked out in this directory. pogenerator.py pulls from git and svn so we have updated sources, then it generates a new .pot file from them. Translated strings get reflected in the .po files in each module, and when the language maintainer clicks the Commit to VCS link, get pushed back to the upstream module.
 
 
 
'''dbs''': internal db used by Pootle, no need to mess directly with it.
 
 
 
'''maintenance''': contains some sugar-specific scripts to help maintain our Pootle instance, they are managed in http://git.sugarlabs.org/projects/pootle-helpers
 
 
 
'''po''': contains xapian indexes for the search feature.
 
 
 
'''translations''': more Pootle internal data
 
 
 
 
 
=== Pootle scripts: ===
 
 
 
*http://git.sugarlabs.org/pootle-helpers/mainline/trees/master/potupdater
 
*/usr/lib/python2.6/dist-packages/translate/storage/versioncontrol/git.py (Translate)
 
  
=== Tips: ===
+
sudo -u pootle django-admin refresh_stats --settings=pootle.settings
  
* If you have a commit error file because of only read git url, please rm the  
+
* If you have a commit error file because of only read git url, please rm the old '''/var/lib/pootle/checkouts/''' files related with that activity or project and re run pootlepopulator.
old '''/var/lib/pootle/checkouts/''' files related with that activity or project
 
and re run pootlepopulator.
 
  
 
* Also if there are errors related with git add, is likely that some lang.po files are not versionated on pootle server, please run '''git add .''' inside the activity or project.
 
* Also if there are errors related with git add, is likely that some lang.po files are not versionated on pootle server, please run '''git add .''' inside the activity or project.
  
 
* When there are '''commit to cvs/update to cvs''' links missing in activities or projects please check git url in .git/config , this URL must be writable by pootle.
 
* When there are '''commit to cvs/update to cvs''' links missing in activities or projects please check git url in .git/config , this URL must be writable by pootle.
 
== Restarting Pootle and apache ==
 
 
/etc/init.d/apache2 restart
 
service pootle start or /etc/init.d/pootle restart
 
 
== Files ==
 
 
===== project_list.ini =====
 
 
The {{Code|/var/lib/pootle/maintenance/helpers/potupdater/project_list.ini}} is an Ini file that contains configuration for all used sources repositories. Each section describes one sources repository, where section name is full path to the directory with sources, and contains following options:
 
 
* {{Code|project}} required, meaning-less project name;
 
* {{Code|vcs}} required, the type of VCS for; supported values are: {{Code|git}};
 
* {{Code|method}} required, the method how to generate {{Code|.pot}} files from sources; supported values are: {{Code|bundlebuilder}} for activities, {{Code|intltool}} for intltool based projects;
 
* {{Code|layout}} required, ?;
 
* {{Code|ignore-files}} optional, the semicolon separated list of file paths that are relative to the sources root; if {{Code|method}} is {{Code|bundlebuilder}} this value will be used to ignore while producing {{Code|.pot files}};
 
  
 
== References ==
 
== References ==
  
 
* http://translate.sourceforge.net/wiki/pootle/installation
 
* http://translate.sourceforge.net/wiki/pootle/installation
 
 
* http://lists.laptop.org/listinfo/localization
 
* http://lists.laptop.org/listinfo/localization
 +
* http://git.sugarlabs.org/pootle-helpers
 +
* /usr/lib/python2.6/dist-packages/translate/storage/versioncontrol/git.py (Translate)
  
 
[[Category:Service|translate]]
 
[[Category:Service|translate]]

Latest revision as of 12:30, 4 April 2024

Stop hand.png NOTE:
The content of this page is considered
DEPRECATED and OBSOLETE
It is preserved for historical research, along with its talk page.

Replaced by Service/Weblate


Hostnames

Hosted on

Machine/pootle

Administrative contact

  • translate AT sugarlabs DOT org

Sysadmins

For non-emergency calls, preferably send email to the administrative contact.

  • Sebastian Silva has assumed maintainership tasks
  • Chris Leonard has Pootle administrator privs, and heads the localization efforts.
  • Bernie Innocenti has system admin and Pootle administrator privs, but takes care only of OS-level administration.
  • Sayamindu Dasgupta is the former admin. He still has an emeritus sysadmin account and he can be very helpful if contacted by email.

Language Administrators

Language administrators are typically native speakers of a given language that take on responsibility (granted by a Pootle administrator after a request to the Localization list) for reviewing and committing PO files for a given language. Contacting language administrators is generally done by posting to the Localization list.

More information on language administrator duties can be found on this page

Notes

Home /var/lib/pootle
Daemon

/etc/init.d/apache2
/etc/init.d/pootle

Logs /var/log/apache2
Config

/etc/apache2/sites-enabled/000-default
/etc/cron.d/pootle
/var/www/pootle/sugarlabs/pootle.conf

Ports

80 HTTP server

Upgrade notes

  • A backup of the DB and pootle localsettings.py must be done also.
  • Backup of the /var/lib/pootle structure
  • New versions of Django and Translate toolkit must be installed first
  • Restore localsettings and DB backup

Mantainance Notes

Pootle in Sugar is maintained. (icarito has step-up to be maint)

Migrated to Pootle 2.5.0

Notes on the process were recorded here: Service/translate/Pootle2.5

Files

Important files and directories in the root directory, /var/lib/pootle.

checkouts
Sources are checked out in this directory and being used to keep final .pot and .po files. The hierarchy is:

checkouts/pootle-project/pootle-po-filename-without-po-suffix/sources

translations
Pootle uses this directory as a sources of files to translate, it contains symlinks to files from the checkouts directory. The hierarchy is:

translations/pootle-project/lang/symlinks-to-po-files

maintenance
Contains some sugar-specific scripts to help maintain our Pootle instance, they are managed in http://git.sugarlabs.org/projects/pootle-helpers.

maintenance/helpers/potupdater/project_list.ini
This is an Ini file that contains configuration for all used sources repositories. Each section describes one sources repository, where section name is full path, in form of /var/lib/pootle/checkouts/pootle-project/pootle-filename/some-path-within-sources/pot-file, to the .pot file, and contains following options:

  • project required, meaning-less project name;
  • vcs required, the type of VCS for; supported values are: git;
  • method required, the method how to generate .pot files from sources; supported values are: bundlebuilder for activities, intltool for intltool based projects;
  • layout required, ?;
  • ignore-files optional, the semicolon separated list of file paths that are relative to the sources root; if method is bundlebuilder this value will be used to ignore while producing .pot files;

Tools

  • potupdater/pogenerator.py pulls from git and svn so we have updated sources, then it generates a new .pot file from them. Translated strings get reflected in the .po files in each module, and when the language maintainer clicks the Commit to VCS link, get pushed back to the upstream module.
  • admin/pootlepopulator.py checkout sources.
  • misc/pootle.cron all daily basis routines.
  • ...

Tips

Create new Pootle project

  • Create new project in Pootle admin menu, admin->projects;
  • Add all needed langs;
  • Checkout all sources using command:
sudo -u pootle -i python maintenance/helpers/admin/pootlepopulator.py pootle-project git-clone-url pootle-filename-wo-po-suffix git-branch

Example:

To checkout the sugar in the branch sucrose-0.94 (in pootle is in the project glucose94) we sshould do:

cd /var/lib/pootle/
sudo -u pootle -i python maintenance/helpers/admin/pootlepopulator.py glucose94 gitorious@git.sugarlabs.org:sugar/mainline.git sugar  sucrose-0.94
  • Add new sections to the project_list.ini file to describe new .pot locations;
  • Run misc/pootle.cron script from pootle user to generate all sufficient files;
  • Click rescan the project files in Templates->Project->Files to reveal newly created .pot files;
  • Click Update from templates for all languages in newly created project to peek up .po files symlinked by misc/pootle.cron script.

Adding activities

Before registering new activity on http://translate.sugarlabs.org, make sure that:

  • New activity is being hosted on http://git.sugarlabs.org;
  • The pootle user was added to the repository with commit access rights;
  • You have a proper GIT_URL to clone repository from with commit permissions, e.g., gitorious@git.sugarlabs.org:cartoon-builder/mainline.git; that might be found on home page in Gitorious, e.g., http://git.sugarlabs.org/cartoon-builder, in Clone & push urls field with selector SSH;
  • You know the proper CATEGORY name to register the project in;
  • There is an unique NAME of activity, this name will be used as a name of project in Pootle and directory name;
  • You know the proper BRANCH in Git repository to use for translation; by default, it is master.

To process the registration, login to translate.sugarlabs.org and enter:

sudo -u pootle python /var/lib/pootle/maintenance/helpers/admin/pootlepopulator.py <CATEGORY> <GIT_URL> /var/lib/pootle/checkouts/<CATEGORY>/<NAME> [<BRANCH>]

After that, for pootle-helper project in potupdater/project_list.ini, add the following strings:

[/var/lib/pootle/checkouts/<CATEGORY>/<NAME>/po/<.pot-filename>]
project = <NAME>
vcs = git
method = bundlebuilder
layout = gnu

Commit new changes, and pull from on pootle VM:

(cd /var/lib/pootle/maintenance/helpers; sudo -u pootle git pull origin master)

Do update from templates on the templates project on Pootle's frontend. And wait until daily cron job will populate languages for newly registered project, or run it immediately:

sudo -u pootle python /var/lib/pootle/maintenance/helpers/admin/add_langs.py

Then your activity must be in place to be translated and commit to VCS/update from VCS links must be activated.

Working with git in the pootle server

The git operations must be done by the pootle user:

sudo -u pootle git log
sudo -u pootle git push origin  sucrose-0.82

This script tell you when you can update different clones of activities, when new strings are added via gettext in each repo.

/var/lib/pootle/maintenance/helpers/potupdater/check_unmerged_translations.sh

Other important script is pogenerator.py this script re-generates pot in each repo.

Resolving conflicts

If the maintainer did a commit with a file in the po directory we will have a conflict, and Pootle can not do a pull.

Pootle build the pot file from the sources, if we compare and the translations are updated in pootle we can do a pull preserving the info in pootle:

sudo -u pootle git pull -s ours

Checking that pootle is working

  • When commiting from pootle interface, repos in git reflect the commit as something similar to:
pootle pushed 3fd0cf7b to taportfolio/mainline:master
on March 04, 2011 01:32
Commit from Sugar Labs: Translation System by user cjl.: 2 of 25 messages   translated (0 fuzzy).
  • Pogenerator.py (in cronjob), it's also giving mails with info like:
Already up-to-date. or
####### Checking POT for Write (master) ######

Etoys .pot update

Go to Etoys translation directory (that is svn checkout from upstream project):

su - pootle
cd ~/translations/etoys_new

Since there is no need in changing .pot files on Pootle level, revert local changes if they present:

svn revert templates/*.pot

Fetch new update from the upstream:

svn up templates

Tips

  • How to manipulate users:
django-admin shell --settings=pootle.settings
>>> from django.contrib.auth.models import User
>>> u = User.objects.get(username='bernie')
>>> u.is_superuser = True
>>> u.save()
  • Refresh stats, needed when the database and the checked out modules get out of sync:
sudo -u pootle django-admin refresh_stats --settings=pootle.settings
  • If you have a commit error file because of only read git url, please rm the old /var/lib/pootle/checkouts/ files related with that activity or project and re run pootlepopulator.
  • Also if there are errors related with git add, is likely that some lang.po files are not versionated on pootle server, please run git add . inside the activity or project.
  • When there are commit to cvs/update to cvs links missing in activities or projects please check git url in .git/config , this URL must be writable by pootle.

References