linux - GNU gettext 故障排除

标签 linux internationalization locale gettext fedora20

我正在尝试使用 gettext 进行一些西类牙语翻译,我尝试了以下步骤:

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

然后:

[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 ~]$

最后:

[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 ~]$

如您所见,gettext 返回 Yesterday,其中预期输出为 Ayer

这是我第一次修改 gettext,所以我基本上不知道我在做什么。感谢您的帮助。

谢谢。

最佳答案

我想通了:

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

...更多播放:

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

关于linux - GNU gettext 故障排除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35905789/

相关文章:

Linux/Windows : User mode vs Privilege mode time spent

linux - 在哪里可以找到 Centos 6 cron 作业 .sh 文件

django - 适用于 Appengine 或非 SQL 中 Django 模型国际化的任何应用程序?

facebook - Locale=nl_BE (Dutch Belgium) 不再受支持(在像按钮这样的 iframe 中)?

locale - 为什么 Edge 不支持我的 PC 的区域设置(特别是日期格式)?

linux - 我的第一个简单的 cgi bash 文件

linux - 在 Linux 中,如何判断进程使用了​​多少内存?

django - 带有 gettext 的动态消息(AngularJS)

javascript - 创建一个像 JavaScript I18n 国际化的 Lua

ansible debconf 模块无法正常工作以设置默认语言环境