Transifex

From Mandriva Community Wiki

Jump to: navigation, search
Mandriva Transifex is the platform where translations are done on Mandriva projects.

Contents

Transifex for translators

  1. You need to have a Mandriva account on my.mandriva.com to login to Transifex, using the same username (email) and password.
  2. If you want to contribute to an existing language, you have to join a language team in the Mandriva i18n teams project
  3. If you are starting a new language, or want to step up as the maintainer of one, please follow the instructions on the Localization Team Coordinator page, then request the creation of the team to become the coordinator of the team on Transifex

After that you can browse the available projects and start translating !

Transifex for developpers

Prepare SVN vs Transifex work

To fetch translation files (PO) from Transifex. You may install it with command

Image:Konsole.png
[root@mycomputer ~]# urpmi transifex-client

The create file {{file|~/.transifexrc

[https://transifex.mandriva.com]
username = user@mandriva.com
token =
password = p@swOrd
hostname = https://transifex.mandriva.com

You may checkout svn translate file from Mandriva SVN (as described there).

For example you checkout all translated file for Translate directory from you home dir /home/user/Translate/ and make on it directory scripts.

Image:Konsole.png
[user@mycomputer ~]$ cd ~/Translate

mkdir scripts cd scripts

then create some bash scripts simplefed you work. First create init script.

if  $a != "scripts" ; then
cd $a
echo "Transifex init for $a"
tx init --host=https://transifex.mandriva.com --user=user@mandriva.com --pass=p@swOrd
tx set --execute --auto-local -r $a.$a -s en -f $a.pot "<lang>.po"
cd ..
fi
done
echo "Transifex init done"
#some fix for non-match projects
cd menu-contrib
tx set --execute --auto-local -r menu-contrib.menu-messages-contrib -s en -f menu-messages-contrib.pot "<lang>.po" 
cd ..
cd menu-main
tx set --execute --auto-local -r menu-main.menu-messages-main -s en -f menu-messages-main.pot "<lang>.po"
cd ..
cd menu-non-free
tx set --execute --auto-local -r menu-non-free.menu-messages-non-free -s en -f menu-messages-non-free.pot "<lang>.po"
cd ..
cd nepomuk-contextchooser
tx set --execute --auto-local -r nepomuk-contextchooser.plasma_applet_nepomukcontextchooser -s en -f plasma_applet_nepomukcontextchooser.pot "<lang>.po"
cd ..
cd nepomuk-scribo
tx set --execute --auto-local -r nepomuk-scribo.scribo_opencalaistextmatchplugin -s en -f scribo_opencalaistextmatchplugin.pot "<lang>.po"
cd ..
cd nepomuk-smartfilemodule
tx set --execute --auto-local -r nepomuk-smartfilemodule.nepomuksmartfilemodule -s en -f nepomuksmartfilemodule.pot "<lang>.po"
cd ..
cd nepomuk-tasklinker
tx set --execute --auto-local -r nepomuk-tasklinker.khtml_nepomuk_task_linker -s en -f khtml_nepomuk_task_linker.pot "<lang>.po"
cd ..
cd nepomuk-tasktop
tx set --execute --auto-local -r nepomuk-tasktop.tasktop -s en -f tasktop.pot "<lang>.po"
cd ..
cd network-tools
tx set --execute --auto-local -r network-tools.drakx-net -s en -f drakx-net.pot "<lang>.po"
cd ..
cd mandriva-gfxboot-theme
tx set --execute --auto-local -r mandriva-gfxboot-theme.bootloader -s en -f bootloader.pot "<lang>.po"
cd ..
cd mdkhtmlbrowser
tx set --execute --auto-local -r mdkhtmlbrowser.mandrivagalaxy -s en -f mandrivagalaxy.pot "<lang>.po"
cd ..
cd mandriva-galaxy-kde4
tx set --execute --auto-local -r mdkhtmlbrowser.mandriva-galaxy -s en -f mandriva-galaxy.pot "<lang>.po"
cd ..
cd mandriva-galaxy-data
tx set --execute --auto-local -r mandriva-galaxy-data.index -s en -f index.pot "<lang>.po"
cd ..
cd hcl
tx set --execute --auto-local -r hcl.drakhcl -s en -f drakhcl.pot "<lang>.po"
cd ..
cd gtkmdkwidgets
tx set --execute --auto-local -r gtkmdkwidgets.gtk+mdk -s en -f gtk+mdk.pot "<lang>.po"
cd ..

replace user@mandriva.org and p@sswOrd with you my.mandriva.com account in Transifex Mandriva.

Manyally sync SVN vs Transifex

You may manually push (from svn to Transifex) translation with

Image:Konsole.png
[user@mycomputer ~]$ tx push -l <lang> -t

, where lang is you language (for example for me it's ru)

or pull existing translations from Transifex to svn

Image:Konsole.png
[user@mycomputer ~]$ tx pull -l <lang>

(This command with -f overwrite lang.po if it has local changes, but you may try)

and then commit it to svn with standart

Image:Konsole.png
[user@mycomputer ~]$ svn ci -m "Sync <lang> files
"

Automate SVN vs Transifex syncing

You may automate this process with this script (write it in you ~/Translate/scripts directory. It's with 99,99% overwrite you work, if you translate from SVN only! Which you need first (if you not translate string from SVN) hard push all translated string to SVN

Create script tx_sync_safe.sh

#!/bin/sh
#add you lang for sync
LANGS="ru"
cd ..
for a in *; do
if  $a != "scripts" ; then
cd $a
echo "Transifex sync for $a"
#fix Transifex error with two ##
sed -i 's/##/#/' $LANGS.po
#first sync svn lang.po
tx push -l $LANGS -t
#then backwards transifex -> svn
tx pull -l $LANGS
echo "Status you translate file is:"
msgfmt -vco /dev/null $LANGS.po
cd ..
fi
done
echo "Transifex sync done"

Then UPDATE SVN FIRST and run this scripts in sources directory (you may cd sources first).

See for msgfmt crytical error!

Hard push string from SVN to Transifex

This script may not sync file for some reason, and if you 100% trasnlate it ONLY in SVN. If it's true, you need hard overwrite all you lang string in Transifex with string on SVN. IT'S DESTROY ALL YOU TRANSIFEX MAKE TRANSLATIONS!

  • tx_sync_hard.sh
#!/bin/sh
#add you lang for sync
LANGS="ru"
cd ..
for a in *; do
if  $a != "scripts" ; then
cd $a
#first sync svn lang.po
tx push -l $LANGS -t -f
echo "Transifex sync for $a
echo "Now you have `msgfmt -vco /dev/null $LANGS.po`"
cd ..
fi
done
echo "Transifex sync done"

Example with mdkonline project

The project slug is named 'mdkonline' and there is only one ressource named also 'mdkonline' (https://transifex.mandriva.com/projects/p/mdkonline/resource/mdkonline/)

In the svn checkout of mdkonline initialize the client :

user@localhost:~/svn/mdkonline/trunk $ tx init
Creating .tx folder...
Transifex instance [http://www.transifex.net]: https://transifex.mandriva.com
Creating skeleton...
Creating config file...
No configuration file found.
No entry found for host https://transifex.mandriva.com. Creating...
Please enter your transifex username: jpbraun@mandriva.com
Password: 
Updating /home/user/.transifexrc file...
Done.

Then we need to map PO and POT files to Transifex ressources :

user@localhost:~/svn/mdkonline/trunk $ tx set --execute --auto-local -r mdkonline.mdkonline -s en -f po/mdkonline.pot "po/<lang>.po"
Updating source for resource mdkonline.mdkonline ( en -> po/mdkonline.pot ).
Setting source file for resource mdkonline.mdkonline ( en -> po/mdkonline.pot ).
Updating file expression for resource mdkonline.mdkonline ( po/<lang>.po ).
Done.
  • -r is project.ressource
  • -s is the source language (should be English)
  • -f is the path to the .pot file (source language file)
  • the last argument is the expression that map languages to po files

After this setup, you can easily pull files (fetch) from transifex :

user@localhost:~/svn/mdkonline/trunk $ tx pull
Pulling translations for resource mdkonline.mdkonline (source: po/mdkonline.pot)
Skipping 'el' translation (file: po/el.po).
Skipping 'eo' translation (file: po/eo.po).
Skipping 'gl' translation (file: po/gl.po).
Skipping 'af' translation (file: po/af.po).
...
Personal tools