Localization/Testing: Difference between revisions
m (Reverted edits by 174.36.179.105 (Talk) to last version by Cjl) |
No edit summary |
||
Line 1: | Line 1: | ||
{{L10n-sl-migration}} |
|||
=Testing the PO files= |
=Testing the PO files= |
||
Revision as of 18:57, 29 June 2009
All data and user accounts should work in the new Pootle installation. |
Testing the PO files
Utilizing the tests available from within Pootle
Pootle provides a easy way to check for common mistakes in a PO file. This should ideally be the first test you perform. To perform the test, you can click on the Show Editing Function from your subproject page, and you will get an option which says Show Checks
Once you click on the Show Checks link, Pootle will perform several tests on your PO files and display the results.
Summary of the various tests
Below is a summary of the various common tests performed by Pootle. The Pootle website has a comprehensive list of all the possible tests that can be carried out.
Test Name | Classification | Description |
---|---|---|
acronyms | Functional | Checks whether acronyms have been changed or not (many languages have a policy of not translating acronyms). This test is useful for testing such languages. |
brackets | Cosmetic | Checks whether the translated string has the same number of messages as the original string. |
endpunc | Cosmetic | Checks whether punctutions at the end of the strings match or not. |
endwhitespace | Cosmetic | Checks whether whitespaces at the end of the strings match or not. Useful for strings which should have a space at the end of the string (eg: "Enter your name: "). |
numbers | Functional | Checks if numbers have been correctly translated (ie, if you have translated a number in words into digits, or vice versa). |
puncspacing | Cosmetic | Checks for spacing before or after punctuation marks. |
purepunc | Functional | Ensures that pure punctuation strings (ie, "," or "+") are not changed. |
sentencecount | Functional | Checks that the number of sentences in both the translation and original message are the same. This may not apply for your language, or for your translation policy. So you can assume this test to be optional |
simplecaps | Cosmetic | Checks for discrepancy between the capitalization used in the translations and that present in the original strings. This may not be applicable to all languages. |
startcaps | Cosmetic | Checks that translations start with the correct case. |
startpunc | Cosmetic | Checks that translations have the correct punctuations in the beginning. |
startwhitespace | Cosmetic | Checks that translations have the correct spacing in the beginning. |
unchanged | Functional | Checks for translations which may just be a copy and paste of the original string |
While going through the tests, however, please remember that some of these tests are language specific (future versions of Pootle will support tests being modified for specific languages) and some of them may not apply to the translation policy and standards you may be following. Feel free to ignore them in such situations.
How to test your translation (in action)
The best way to test your translations is to see it in action, ie being used in the software GUI itself. There are a number of ways to test out translations in such a manner.
In a XO-1 laptop
Using the Language Packs
Language Packs are generated on a nightly basis, which can be simply installed in a XO laptop (you can also use this on an emulated XO). Here's a step by step mini-HOWTO on how to use the language packs.
- Identify the language code of the language you want to install (eg: fr for French, nl for Dutch, es for Spanish, etc). A mapping is available at http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
- Identify the build series you are wanting to use (eg: 8.1, 8.2 or devel)
- Download the pack from http://people.sugarlabs.org/sayamindu/langpacks/ (the complete URL is in the form, http://people.sugarlabs.org/sayamindu/langpacks/NN/LL_lang_pack_v2.sh, where NN and LL are the build series numbers and language codes respectively. For example, for 8.2 and Kinyarwanda, the URL would be http://people.sugarlabs.org/sayamindu/langpacks/8.2/rw_lang_pack_v2.sh)
- Copy this file to an XO, and as root, run the script (eg: sh rw_lang_pack_v2.sh).
- Change the language from sugar-control-panel (if required), and restart
- If you mess up, there's an uninstallation script which removes the installed files - as root user, just run uninstall_langpack_LL (where LL is the language code).
The code which generates the language packs lives in http://dev.laptop.org/git?p=users/sayamindu/langpackgen;a=summary. You can check it out with the command git clone git://dev.laptop.org/users/sayamindu/langpackgen Patches and suggestions are most welcome :).
Manually
You can also choose not to wait for the nightly build process and do the entire process manually. Follow the steps below to do that.
Downloading the latest PO files
Pootle provides a way for you to download the latest PO files for your project. You can use the "Show Editing Functions" link in Pootle to enable links to the PO files under a given subproject. For example, to download the PO files for Spanish (subproject being XO Core), you can visit the URL https://dev.laptop.org/translate/es/xo_core/index.html?editing=1 From that page, you can download the latest PO file for Sugar.
Transferring the PO files to the laptop
If you have a wifi connection, you can use the scp command to transfer files from your computer to the XO-1. If you use Windows, you can use the WinSCP utility to transfer the files. If you do not have a wireless connection, a USB drive should be useful.
Compiling the PO file
The msgfmt command can be used to compile the PO file into corresponding MO files. The software you run is going to expect the MO files in specific locations, and you will have to use the -o option to specify where the output MO goes.
MO files for Sugar
Sugar MO files should be in /usr/share/locale/NN/LC_MESSAGES/sugar.mo, where sugar-jhbuild is the directory where you have your sugar-jhbuild setup and NN is your language code (eg, for Spanish, the language code is es).
So the appropriate command to generate the mo file would be
msgfmt -o /usr/share/locale/NN/LC_MESSAGES/sugar.mo sugar.po
(assuming that sugar.po is in the directory you are issuing the command from)
Note that you will need to be root to do this. In recent builds, doing a sudo su - should give you root access.
MO files for the Activities
MO files for individual activities should usually be in /usr/share/activities/FOO.activity/locale/NN/LC_MESSAGES/org.laptop.FOOActivity.mo, where sugar-jhbuild is the directory where you have your sugar-jhbuild setup and NN is your language code (eg, for Spanish, the language code is es), and FOO is the name of the activity.
So the appropriate command to generate the mo file would be
msgfmt -o /usr/share/activities/FOO.activity/locale/NN/LC_MESSAGES/org.laptop.FOOActivity.mo foo.po
(assuming that foo.po is in the directory you are issuing the command from) Note that you will need to be root to do this. In recent builds, doing a sudo su - should give you root access.
Changing the language
Once all the MO files are in place, from Terminal activity in the GUI, issue the command
sugar-control-panel -s language LANGUAGE
Where LANGUAGE is your language. For a list of supported languages, you can issue the command
sugar-control-panel -h language
Note that you should not use root to change the language. Please do it in normal user mode.
Sugar-Jhbuild
sugar-jhbuild helps you download, install and run the latest bleeding edge version of sugar and a few related activities in you computer.
Setting up and running sugar-jhbuild
The Sugar-jhbuild page has the relevant directions which should let you install, set up and run sugar-jhbuild. When you are satisfied that the command
./sugar-jhbuild run
is working, you can proceed to the next step.
Downloading the latest PO files
Pootle provides a way for you to download the latest PO files for your project. You can use the "Show Editing Functions" link in Pootle to enable links to the PO files under a given subproject. For example, to download the PO files for Spanish (subproject being XO Core), you can visit the URL https://dev.laptop.org/translate/es/xo_core/index.html?editing=1 From that page, you can download the latest PO file for Sugar.
Compiling the PO file
The msgfmt command can be used to compile the PO file into corresponding MO files. The software you run is going to expect the MO files in specific locations, and you will have to use the -o option to specify where the output MO goes.
MO files for Sugar
Sugar MO files should be in sugar-jhbuild/build/share/locale/NN/LC_MESSAGES/sugar.mo, where sugar-jhbuild is the directory where you have your sugar-jhbuild setup and NN is your language code (eg, for Spanish, the language code is es).
So the appropriate command to generate the mo file would be
msgfmt -o sugar-jhbuild/build/share/locale/NN/LC_MESSAGES/sugar.mo sugar.po
(assuming that sugar.po is in the directory you are issuing the command from)
MO files for the Activities
MO files for individual activities should usually be in sugar-jhbuild/build/share/activities/FOO.activity/locale/NN/LC_MESSAGES/org.laptop.FOOActivity.mo, where sugar-jhbuild is the directory where you have your sugar-jhbuild setup and NN is your language code (eg, for Spanish, the language code is es), and FOO is the name of the activity.
So the appropriate command to generate the mo file would be
msgfmt -o sugar-jhbuild/build/share/activities/FOO.activity/locale/NN/LC_MESSAGES/org.laptop.FOOActivity.mo foo.po
(assuming that foo.po is in the directory you are issuing the command from)
Changing the language
Once all the MO files are in place, run the Sugar with the following command
LANG=NN sugar-jhbuild run
where NN is your language code.
In XO emulated on a regular PC
Emulation lets your software emulate the hardware of a XO-1 laptop. It is a bit resource intensive, but the easiest way to get started if you do not have a actual XO-1 laptop.
Emulating XO
I assume that translator uses Windows XP, but most topics apply also for other operating systems.
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.
It may be worth noting that popular commercial software emulators such as VMWare and Parallels usually run the XO ext3 images just fine and are considerably faster and more pleasant to use than qemu on their supported platforms.
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 (update.1-673 requires sudo), 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 msgfmt 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.