简体   繁体   中英

GNU gettext troubleshooting

I'm trying to get some Spanish translation going on with gettext , I've tried the following steps:

[aesteban@localhost ~]$ ls /usr/share/locale/es_MX/LC_MESSAGES/
libgweather-3.0.mo  mx-1.0.mo  policycoreutils.mo
[aesteban@localhost ~]$ 

and then:

[aesteban@localhost ~]$ msgunfmt /usr/share/locale/es_MX/LC_MESSAGES/mx-1.0.mo 
msgid ""
msgstr ""
"Project-Id-Version: mx\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-04-26 09:42+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: Salvador Cabrera Lozano <salvadorcabrera@gmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n!=1; \n"
"X-Poedit-Language: Spanish\n"
"X-Poedit-Country: MEXICO\n"
"X-Poedit-SourceCharset: utf-8\n"

msgid "A couple of hours ago"
msgstr "Hace un par de horas"

msgid "A couple of weeks ago"
msgstr "Hace un par de semanas"

msgid "A few minutes ago"
msgstr "Hace unos pocos minutos"

msgid "Ages ago"
msgstr "Hace mucho tiempo"

msgid "Earlier today"
msgstr "Hoy mas temprano"

msgid "Last month"
msgstr "El mes pasado"

msgid "Last week"
msgstr "La semana pasada"

msgid "Last year"
msgstr "El año pasado"

msgid "Less than a minute ago"
msgstr "Hace menos de un minuto"

msgid "On %A"
msgstr "El %A"

msgid "Raise application"
msgstr "Restaurar aplicación"

msgid "This month"
msgstr "Este mes"

msgid "This year"
msgstr "Este año"

msgid "Unavailable"
msgstr "No disponible"

msgid "Unknown"
msgstr "Desconocido"

msgid "Yesterday"
msgstr "Ayer"
[aesteban@localhost ~]$

Finally:

[aesteban@localhost ~]$ LANGUAGE="es_MX"
[aesteban@localhost ~]$ 
[aesteban@localhost ~]$ gettext -d /usr/share/locale/es_MX/LC_MESSAGES/mx-1.0.mo "Yesterday"
Yesterday[aesteban@localhost ~]$ 
[aesteban@localhost ~]$

As you can see, gettext returns Yesterday where the expected output is Ayer .

This is my first time tinkering with gettext so I basically have no idea what I'm doing. Any help is appreciated.

Thanks.

I figured it out:

[aesteban@localhost ~]$ LANG=es_MX
[aesteban@localhost ~]$ gettext -d mx-1.0 "Yesterday"
Ayer

...more playing:

[aesteban@localhost ~]$ gettext -d mx-1.0 "A few minutes ago"
Hace unos pocos minutos

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM