Switzerland/get mo

From OLPC

Jump to: navigation, search

Contents

get_mo, "for Dummies"

Looking for an easy way to quickly install .MO "language packages" (e.g. German and French) to an XO? Look no further - OLPC.ch provides this page for your convenience! This uses the File:Get mo.rb.txt script from OLPC's Niklaus Giger.

Open the Terminal activity, make sure you have all other Activities closed (e.g. don't keep Browse etc. running) and then type this:

  $ su -
  # yum install ruby
  # mkdir get_mo; cd ~
  # wget http://wiki.laptop.org/images/d/d4/Get_mo.rb.txt
  # mv Get_mo.rb.txt get_mo.rb
  # chmod +x get_mo.rb
  # ./get_mo.rb
  # cd /usr/share/locale
  # tar -jvxf /root/get_mo/mo_files.tar.bz2
  # exit
  $ sugar-control-panel -s language German/Switzerland

Now press ctrl-alt-erase, just as the message says... and see Sugar in German!


ToDo

  • Rewrite in Python, not Ruby? (more XO like, and prevent yum install ruby... Space constraints!)
  • Link this page/tool from Translation-related Wiki pages
  • Announce this page/tool on translation-related mailing lists
  • Announce this page/tool to olpc-de and Austria, could be handy?
  • Find list of Activities automatically, instead of hard-coding... contact the web server to get all available translations (just try)
  • Specify what language(s) to install as an option


Troubleshooting

If you get this kind of error, then you ran sugar-control-panel as root and forget the exit above to become olpc again.

 Traceback (most recent call last):
   File "/usr/bin/sugar-control-panel", line 26, in <module>
     sys.path.insert(0, env.get_shell_path())
   File "/usr/lib/python2.5/site-packages/sugar/env.py", line 90, in get_shell_path
     return _get_sugar_path('shell', path)
   File "/usr/lib/python2.5/site-packages/sugar/env.py", line 36, in _get_sugar_path
     raise RuntimeError("The SUGAR_PATH environment variable is not set.")
 RuntimeError: The SUGAR_PATH environment variable is not set.

Troubleshooting Part II

.bz2 file is not created, get_mo silently terminates.

Running this script on a FedoraCore 6, wget (v1.10.2) seems to crash when the file that should be downloaded, already exists. Unfortunately, the above script mentions some files two times, so wget always crashes. get_mo terminates due to the death of wget, not creating the tar.bz2 file. Simple workaround here is to change

 exit 3 if !system(cmd)

into

 system(cmd)

additional output can be given, when using

 ruby -v ./Get_mo.rb

(This influences the VERBOSE variable).

PS: Usage Information printed by get_mo (slightly inaccurate, because you ran this on the XO itself)

 Hi!
 You just successfully created the file mo_files.tar.bz2.
 Now we have to transfer it to the OLPC e.g. by copying
 onto a flash stick or via a network copy utility like scp.
 A USB flash will be mounted automatically if you insert it
 into the OLPC and will appear under a name like /media/MyUsbStick
 On the OLPC:
 Open the terminal activity
 become root by calling "su" (no password needed by default)
 Then get the file, e.g. by using
 bash-3.2# scp user@10.0.2.1:/path/to/mo_files.tar.bz2 /home/olpc/
 Now you have to unpack it
 bash-3.2# cd /usr/share/locale
 bash-3.2# tar -jvxf /home/olpc/mo_files.tar.bz2
 To permanently set the desired language you have:
 edit /etc/sysconfig/i18n and change
 LANG=C
 to something like
 LANG=de_CH # für die deutsche Schweiz
 or
 LANG=de_FR # pour la Suisse romande
 Set the correct keyboard mapping yo have to to edit
 /etc/keyboard
 Set it to
 KEYTABLE="sg"
 XKB_MODEL="olpc"
 XKB_LAYOUT="ch"
 XKB_VARIANT=""
 Prenez "sf" au lieu de "sg" si vous voulez un clavier Suisse romande.
 If you want to change the keyboard layout just for the current session
 use "setxkbmap ch".

 Set the desired language (German/Switzerland fuer Deutsch or French/Switzerland pour choisir le francais)
 $ sugar-control-panel -s language German/Switzerland
 Now we have to restart the X-server, e.g.
 by pressing ctrl-alt-erase
 by calling as root killall X
 by rebooting

setxkbmap command for US/CH keyboard layout switching

 setxkbmap -layout us,ch -option "grp:alt_shift_toggle" -variant olpc,de_nodeadkeys

Switch using Alt-Shift. Interesting Wiki links:

Personal tools
  • Log in
  • Login with OpenID
About OLPC
About the laptop
About the tablet
Projects
OLPC wiki
Toolbox
In other languages