Sugar i18n: Difference between revisions
Jump to navigation
Jump to search
(some notes on i18n/l10n for sugar.mo) |
(redirect to a section) |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
#redirect [[Localization#Sugar i18n]] |
|||
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. |
|||
; 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. |
|||
== Verify i18n == |
|||
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=es_AR |
|||
LANGUAGE=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. |
|||
/usr/share/locale |
|||
/es_AR.UTF-8/LC_MESSAGES |
|||
/es_AR/LC_MESSAGES |
|||
/es.UTF-8/LC_MESSAGES |
|||
/es/LC_MESSAGES |
|||
/en_US/LC_MESSAGES |
|||
/en/LC_MESSAGES |
|||
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—most probably English. |
|||
:''NOTE: given that .PO files also store the languages, the above relationship between .mo (a derivative of .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. |
|||
== Installing the .mo == |
|||
{{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:Language support]] |
|||
[[Category:HowTo]] |
Latest revision as of 20:05, 11 September 2007
Redirect to: