Localization/Testing: Difference between revisions
No edit summary |
|||
Line 1: | Line 1: | ||
=How to test your translation= |
=How to test your translation= |
||
This article is meant for a translator making |
This article is meant for a translator making localization of some part of XO software - sugar or activities, not being a software developer. In that case setting up complete development workstation just for testing localization is not the best option. |
||
I assume that translator uses Windows XP, but most topics aply also for other operating systems. |
I assume that translator uses Windows XP, but most topics aply also for other operating systems. |
Revision as of 07:47, 15 December 2007
How to test your translation
This article is meant for a translator making localization of some part of XO software - sugar or activities, not being a software developer. In that case setting up complete development workstation just for testing localization is not the best option.
I assume that translator uses Windows XP, but most topics aply also for other operating systems.
Emulating XO
First, you should set up an emulated XO using software called QEMU. That way you can test translation in the close-to-real environment.
The easiest way of installing emulated XO is using quick start procedure, but you can also use manual installation.
When you check that your emulated XO is working correctly, you can prepare it to translation testing.
Preparing emulated XO for localization
First of all, set up your language.
Start Terminal Activity. It should be available as an icon with $_. If you can't find it that maybe you have too old system version. Download the newest one devel-ext3 using a green box on the right and start over.
Check the list of available languages:
[olpc@xo-12-34-56 ~]$ sugar-control-panel -h language
Now set the language, i.e.:
[olpc@xo-12-34-56 ~]$ sugar-control-panel -s language Polish
Logging in as root
Second, you'll need a way to log in to emulated XO as root. The easiest way is pressing Ctrl-Alt-F2 in QEMU window (you can always return to the Sugar interface by pressing Ctrl-Alt-F3).
You should get
xo-12-34-56 login: _
Enter root and press Enter.
You should get:
-bash-3.2# _
Now you have full access to all XO files and directories as you logged in as user "root".
Setting password
Now set a password to the root account so that you can copy files to and from XO later:
# passwd Changing password for user root. New UNIX password: _
If your password will be too simple, the system would warn you, but the password will be changed.
You can try a new password by typing exit and logging in back as root.
Installing software
Now you need software for converting .po files you are producing as a translator to .mo files which are used by the machine.
You'll need software called babel for that. Enter:
-bash-3.2# yum install babel
Installation will take a while.
Now check that it installed correctly:
-bash-3.2# pybabel Usage: pybabel command [options] [args] . pybabel: error: incorrect number of arguments -bash-3.2#
Now install two scripts that make using pybabel easier: makemo.sh and makemo-sugar.sh.
First, download them on your PC. Then, copy them to your emulated XO, using SSH. I'm using TotalCommander with SFTP plugin, but WinSCP seems to be easier. More info here.
You should copy them to home directory of root, that is /root.
Set executable permissions for them:
-bash-3.2# chmod +x *.sh -bash-3.2# ls -l total 8 -rwxr-xr-x 1 root root 190 Dec 12 11:03 makemo-sugar.sh -rwxr-xr-x 1 root root 307 Dec 12 12:00 makemo.sh
Now you need some .po file. If there is some translation to your desired language available, you can download such a file from laptop.org. Go to https://dev.laptop.org/translate/ then select your language and project, then select "Show Editing Functions". Now you can download a .po file to your PC.
Converting .po file
Copy the .po file to the correct directory of emulated XO, with proper name.
Activities
For Activities, the correct directory is: /usr/share/activities/<ActivityName>.activity/po.
The name of the file is <language code>.po.
For example, file for Web activity and polish language (language code: pl) should be placed as: /usr/share/activities/Web.activity/po/pl.po
Now edit makemo.sh script a little bit.
-bash-3.2# nano /root/makemo.sh
Change the name of activity and language to yours:
ACTIVITY="Web" LOCALE="pl"
Save the file and run it:
-bash-3.2# /root/makemo.sh compiling catalog 'locale/pl/LC_MESSAGES/org.laptop.WebActivity.po' to 'locale/pl/LC_MESSAGES/org.laptop.WebActivity.mo'
That's it! Now let's try your new language:
-bash-3.2# killall -i X
That will restart Sugar. Start the activity by clicking its icon and enjoy!
Sugar
The procedure for Sugar .po files is very simillar to Activities procedure, but the directory structure is a bit different.
Instead of activity directory, put the .po file to /usr/share/sugar/po. The name is the country code - i.e. pl.po for Polish (pl).
The script for converting file is /root/makemo-sugar.sh. Edit it with nano, setting LOCALE variable.
After running /root/makemo-sugar.sh you need to restart Sugar as with Activity localization.