Localization/Testing

From OLPC
< Localization
Revision as of 11:50, 3 January 2008 by Adricnet (talk | contribs) (→‎Setting password: Root account usage obsoleted in Joyride, use sudo going forward.)
Jump to navigation Jump to search

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 apply 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 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".

If you are unable to login as root, please try logging in as olpc (with no password) and using sudo to run commands as root. (Joyride builds now use sudo, and this will be the default in future releases, according to discussion on the devel list.) This example is from Terminal activity in Joyride 1470:

 [olpc@xo-97-62-C9 ~]$ sudo id
 uid=0(root) gid=0(root) groups=0(root),1(bin) [usw]

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.

As noted above this usage of the root account is deprecated in Joyride and future releases, according to discussion on the devel list. Please use the olpc account and sudo.

Installing software

Check that you have tools for converting .po files to .mo files which are used by the machine:

bash-3.2# msgfmt
msgfmt: no input file given
Try `msgfmt --help' for more information.
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 similar 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.


Things to See