Sugar i18n: Difference between revisions

From OLPC
Jump to navigation Jump to search
(tweaking... possibly merge)
No edit summary
Line 1: Line 1:
== Translate Sugar or activities ==
{{merge | Customizing NAND images}}
----


* Go to the [http://translate.fedoraproject.org/releases/olpc OLPC release set] on [http://translate.fedoraproject.org Fedora Translations] to find out which projects needs translation and to download the current translation files (or the POT).
This is a tutorial (recovered from an [[IRC]] session in the <tt>#olpc-peru</tt> channel, on how to enable [[Sugar]] in [[Spanish]]. Other locales/languages may adapt accordingly.
*: ''Please check if the translation hasn't been filed [http://dev.laptop.org/query?status=new&status=assigned&status=reopened&component=localization&order=priority querying Trac] first''
* Once your translation is ready
*# open a new [http://dev.laptop.org/newticket Trac ticket], (uou will need an account ([http://dev.laptop.org/login login] or [http://dev.laptop.org/register register]))
*# make it an ''enhancemente'' in the ''localization'' component, and
*# '''attach''' your translation (as a <tt>.po</tt> file).


<span style="font-size:120%; color:red; ">'''BIG FAT WARNING:''' You must make sure that your browser is set by default to '''UTF-8'''.</span>
; WARNING : What follows is more an empiric report instead of a well thought out, fact-based, guide. If anybody can give more 'academic weight' to the subject by means of annotations or corrections, please do so.


Else, your precious characters will most likely be victims of the [http://en.wikipedia.org/wiki/Sirius_Cybernetics_Corporation Sirius Cybernetics Corporation]... for which you may find solace in their detractors' [http://en.wikipedia.org/wiki/Places_in_The_Hitchhiker's_Guide_to_the_Galaxy#Happi-Werld_III ''rally song'']:
== Verify i18n ==
: "I teleported home last night with Ron and Sid and Meg
: Ron stole Meggy's heart away and I got Sidney's leg."


For language codes, refer to [[ISO 639]].
Most of the ''internaliz/sation'' (aka i18n) present in the [[activities]] or environment relies on three things:
# the <tt>LANG</tt> and <tt>LANGUAGES</tt> environment variables;
# the different ''locales'' in the system; and
# the existance of the appropriate 'catalogs' of localized strings in each ''locale'' (<tt>.mo</tt> files).

; <tt>LANG</tt> and <tt>LANGUAGES</tt> : serve to declare the ''base'' <tt>LANG</tt>uage, and the default sequence of linguistic preferences when trying to chose one that is not available. They are defined in the <tt>/etc/sysconfig/i18n</tt>
<blockquote>{{Box File | /etc/sysconfig/i18n |
LANG&#61;es_AR
LANGUAGE&#61;es_AR.UTF-8:es_AR:es.UTF-8:es:en_US.UTF-8:en}}</blockquote>
; Locales & string catalogs : are basically the definition of how a particular location represents some aspects (ie: decimal and thousands separators, time formats, etc.) Each ''locale'' has an <tt>LC_MESSAGES</tt> sub-directory where catalogs of strings (<tt>.mo</tt> files) are stored by applications.
<blockquote><pre>
/usr/share/locale
/es_AR.UTF-8/LC_MESSAGES
/es_AR/LC_MESSAGES
/es.UTF-8/LC_MESSAGES
/es/LC_MESSAGES
/en_US.UTF-8/LC_MESSAGES
/en/LC_MESSAGES</pre></blockquote>
: A particular application or [[activity]] may have a set of (i18n) strings for each locale in a <tt>.mo</tt> file, or most likely a set of standard ones in select locales. What is important, is to have a <tt>sugar.mo</tt> in ''at least'' your base language (ie: <tt>.../locale/es/LC_MESSAGES/sugar.mo</tt> independently if your locale is [[OLPC Argentina|Argentina]], [[OLPC Peru|Peru]] or [[OLPC Uruguay|Uruguay]] in the case of [[Spanish]]. Similarly, for other languages. If the system can't find the right locale, it will default to the native language of the application&mdash;most probably English.

: [[Activity Bundle]]s have their own [[Activity Bundle#Bundle Structure|''locale'' subdirectory structure]] where they store their string catalogs (<tt>.mo</tt> files).

:''NOTE: given that .PO files also store language info, the above relationship between .mo (a derivative of a .po files) and the actual directory needs to be verified!''

So in order to have [[Sugar]] in your own language, you must have a <tt>.mo</tt> (derived from an appropriate <tt>.po</tt> file) in a corresponding <tt>.../locale/''language_pref''/LC_MESSAGES</tt> directory.

In order to verify this you can do the following:
echo LANG # to see what is the currently default language of your system
echo LANGUAGES # to see the sequence of languages the system fallbacks to
And verify in which of those ''locales'' a <tt>sugar.mo</tt> file is found. If you fail to have the appropriate combination, then you should try to set it up by following the instructions below.

== Sugar in your language ==

=== Obtaining the .po ===

In order to generate the corresponding <tt>.mo</tt> file, we must have a <tt>.po</tt> for the target language (ie: <tt>es.po</tt>). You can find the currently available file in the [http://dev.laptop.org/git?p=sugar;a=tree;h=b88c3744a456d9d72e243d98ea5fd1deba41fb45;hb=7b0d65a21147388790dc6e490d8735d93759762e;f=po git po tree] (currently it has the [http://dev.laptop.org/git?p=sugar;a=blob_plain;h=50b6dbee2ea4a8118c95c0bd5358e495531e4540;f=po/es.po es.po], [http://dev.laptop.org/git?p=sugar;a=blob_plain;h=fb37cfbbc9ebc875ff44baacf233868623ff3d96;f=po/ha.po ha.po], [http://dev.laptop.org/git?p=sugar;a=blob_plain;h=e7824d6f3615660c1e8d316e8a66ba6461eb1776;f=po/ig.po ig.po], [http://dev.laptop.org/git?p=sugar;a=blob_plain;h=318d23fef56282a0a9814b94111f64eb3c53699f;f=po/it.po it.po], and [http://dev.laptop.org/git?p=sugar;a=blob_plain;h=6752ed89ccd193f39dfa01af60e4a30d699a147e;f=po/yo.po yo.po] files).

If you don't find the <tt>.po</tt> in your language you can always grab an existing one, copy it to an appropriate name (ie: ur.po) and translate it into said language (in the example ur=urdu).

=== Making the .mo ===

In order to generate a particular <tt>.mo</tt> from its <tt>.po</tt> you must have access to <tt>gettext</tt>, which if you don't have in your system you can install it by doing
yum install gettext # for Red Hat / Fedora systems
apt-get install gettext # for Ubuntu / Debian systems
msgfmt es.po -o es.mo # to create the given .mo

cp es.mo /usr/share/locale/es.UTF-8/LC_MESSAGES/sugar.mo


== Keyboard in your language ==
== Keyboard in your language ==
Line 78: Line 37:
/sbin/telinit 3
/sbin/telinit 3
/sbin/telinit 5
/sbin/telinit 5


----
----


{{cleanup}}
: ''what follows is a dump/resume of the chat session... will translate and format''

* entrar en consola (o vía ssh) y fijarse si existe el siguiente archivo:
*: /usr/share/locale/es/LC_MESSAGES/sugar.mo
*: (pueden existir otros como aspell.mo y hal.mo)
* el es.PO esta en:
*: [http://dev.laptop.org/git?p=sugar;a=blob;h=50b6dbee2ea4a8118c95c0bd5358e495531e4540;hb=c1346a530301a420eb30918f45dc18b142fa1589;f=po/es.po HTML]
*: [http://dev.laptop.org/git?p=sugar;a=blob_plain;h=50b6dbee2ea4a8118c95c0bd5358e495531e4540;f=po/es.po UTF-8]
*: other - http://gnrfan.org/files/olpc/l10n/es.po.gz
*::wget -c http://gnrfan.org/files/olpc/l10n/es.po.gz
*::gunzip es.po.gz
*: si tienen un .POT (Portable Object *Template*) y quieren crear un .PO para nu nuevo idioma se lo renombra:
*:* cp sugar.pot es.po
* proceder a instalar <tt>gettext</tt> segun la distro: (por lo menos en el build 406 no está)
** yum install gettext # Red Hat
** apt-get install gettext # Ubuntu / Debian
* crear el .MO
*: msgfmt es.po -o es.mo
* asegurarse que el LANG esté bien configurado (fundamental el .UTF-8)
*: es_AR.UTF-8
* instalar el .MO
*: mkdir -p /usr/share/locale/es.UTF-8/LC_MESSAGES
*: cp es.mo /usr/share/locale/es.UTF-8/LC_MESSAGES/sugar.mo
* configurar la variable de entorno en /etc/sysconfig/i18n debe decir
*: LANG="es.UTF-8"
*: la variable LANGUAGE va poniendo lenguajes por prioridad
*:: LANGUAGE="es_PE.UTF-8:es_ES.UTF-8:es.UTF-8:es_PE:es_UE:es:en_US.UTF-8:en"
* reboot!



[[Category:Sugar]]
[[Category:Sugar]]

Revision as of 09:20, 23 July 2007

Translate Sugar or activities

  • Go to the OLPC release set on Fedora Translations to find out which projects needs translation and to download the current translation files (or the POT).
    Please check if the translation hasn't been filed querying Trac first
  • Once your translation is ready
    1. open a new Trac ticket, (uou will need an account (login or register))
    2. make it an enhancemente in the localization component, and
    3. attach your translation (as a .po file).

BIG FAT WARNING: You must make sure that your browser is set by default to UTF-8.

Else, your precious characters will most likely be victims of the Sirius Cybernetics Corporation... for which you may find solace in their detractors' rally song:

"I teleported home last night with Ron and Sid and Meg
Ron stole Meggy's heart away and I got Sidney's leg."

For language codes, refer to ISO 639.

Keyboard in your language

What good is seeing the interface in a particular language if your keyboard is in another? Here's how you get your keyboard in your language. (extracted from Customizing NAND images).

 File: /etc/X11/xorg.conf
Section "InputDevice"
Identifier "Keyboard1"
...
Option "XkbLayout" "en"
Option "XkbOptions" "olpc"
EndSection

You should modify the "XkbLayout" "en" to whatever layout you want (ie: es, pt, ...). In order to enable the language switch (Key arabic.jpg or Key thai.jpg) you should set "XkbLayout" "en,ara" or other combinations (ie: "en,th"; "en,ur"; etc.) and Option "XkbOptions" "olpc" to "olpc,olpc2"

 File: /etc/X11/xorg.conf
Section "InputDevice"
Identifier "Keyboard1"
...
Option "XkbLayout" "en,th"
Option "XkbOptions" "olpc,olpc2"
EndSection

After saving the changes, and in order to enable them, you must either reboot the machine, or issue the following commands:

/sbin/telinit 3
/sbin/telinit 5