Service/translate: Difference between revisions

Line 110: Line 110:
== Tips ==
== Tips ==


=== Creating branches: ===
=== Create new Pootle project ===


* Each branch (eg: glucose-0.92) is a directory in the translations directory
There's a script called pootlepopulator.py[1] It is invoked as
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
pootlepopulator.py category GIT_URL checkout_directory [branch]
pootlepopulator.py category GIT_URL checkout_directory [branch]
So, assuming the directory /var/lib/pootle/translations/glucose92 exists,
So, assuming the directory /var/lib/pootle/translations/glucose92 exists,
you can issue these commands:
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
* Add new section to the [[#Files|project_list.ini]] file to describe new {{Code|.pot}} location;
 
* Run {{Code|misc/pootle.cron}} script from {{Code|pootle}} user to generate all sufficient files;
pootlepopulator script can be found in maintainance/helpers directory in /var/lib/pootle
* Call ''Update from templates'' for all languages in newly created project to peek up {{Code|.po}} files symlinked by {{Code|misc/pootle.cron}} script.
 
As these projects doesn't have pots we most copy them from  master
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)
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
sudo -u pootle python  create_translation_links.py glucose92  sugar-base sucrose-0.92
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
to '''admin->projects''' and create a project called Sucrose 0.90 with the
code sucrose-0.90 (same as the directory name)
 
* Add langs on the pootle web ui.
 
* '''Restart''' Pootle and Apache if the new project does not show up after this.
 
* '''Add''' the new projects to   ''maintenance/helpers/potupdater/project_list.ini''
 
* '''Copy strings from master to your branch'''
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. 
 
* '''Your project is created.'''
 
[1] http://git.sugarlabs.org/pootle-helpers/mainline/blobs/master/admin/pootlepopulator.py


=== Adding activities ===
=== Adding activities ===