English 中文(简体)
如何从文字上删除可用何种语文
原标题:How does gettext figure out what languages are available

我最近花了一些时间翻译了一种PHP应用程序,该软件与Appa2号一道投向了Linot。 为了获得文本,我需要联系我所希望支持的每一种语文的系统名录,因此,我很想知道,有什么办法支持用所有语文文本。

我的当地人档案属于我的项目的子目录:

./locale/sv_SE/LC_MESSAGES/default.po
./locale/es_BO/LC_MESSAGES/default.po

和代码:正文。 php就是这样:

<?php
setlocale(LC_ALL, "es_BO.utf8");
bindtextdomain("default", "locale/"); # usually works
textdomain("default");
echo echo _("test");
?>

The C code is exactly the same code but with some headers.

如果我不把现有的v_SE locale与es_BO连接起来,那么该法典不会产生我的西班牙文译文:

sudo ln -s /usr/lib/locale/sv_SE.utf8 /usr/lib/locale/es_BO.utf8

<>Updates

我认为,我的问题是错的“我如何避免把ln-s指挥,或仅仅告诉我我,如果我以错误的方式处理此事?”基本上我想知道,为什么在文字上将这些档案放在/usr/lib/ locale”上,或者我如何简单地利用文字来翻译信息。

Update2 I tried using setlocal(LC_MESSAGES, "es_BO.utf8") but it still needs the messages in /usr/lib/locale.

问题回答

为了检查某些翻译是否适当工作,你应适当利用语文环境。

#!/bin/bash
export LANG=es_BO
./yourprog

我认为,由于LANG=sv_SE在你目前的系统中发挥作用,你目前的语言黑板发挥了作用。 否则,我建议更多地阅读gettext

使用<代码> 当地——a,以获得贵国系统生成的当地人名单。 在本清单中添加:dit /etc/ locale.gen和rerun locale-gen

(因此,案文根本看不出任何东西,而是试图使用目前的地方,如果它失败,它只能回到<条码>。





相关问题
How does gettext handle dynamic content?

In php (or maybe gettext in general), what does gettext do when it sees a variable to dynamic content? I have 2 cases in mind. 1) Let s say I have <?=$user1?> poked John <?=$user2?>. ...

Explain the Need for Mutexes in Locales, Please

Reading the question Why doesn’t C++ STL support atoi(const string& ) like functions?, I encountered a comment which warned that GCC (at least) has a bug that can slow down multi-threaded ...

How does Vistalizer work

How does Vistalizer manage to override the language limit in Windows Vista Home edition. Which api s does it use to allow installation of Multiple language packages.

Localized exceptions (within a Struts2 app)

I am developing a Struts 2 application with support for multiple languages. If one of the domain objects needs to throw an exception, how can it do so in such a way that the error message is no ...

Rails Globalize plugin help

Has anyone gotten the Globalize plugin to work Rails 2.3.2 or later? If so, could you direct me to some useful info?

热门标签