我正在使用 perl/catalyst 构建一个网站,并且为多语言问题所困扰。
我应该将字符串放在 Perl 代码文件(.pl .pm)之外的文件中,并且它应该在服务器的整个生命周期中保留在内存中。
起初,我尝试在催化剂设置期间将其放入 $c->config 中,因此我使用了标准 perl 风格的 file-IO open LANG, " 但我发现之后启动配置中的实际内容是 pack(H*, ...)
。我不知道我的绳子怎么了。
更多信息:上面讨论的所有文件都是 utf-8 编码的。
谁能帮助我或为多语言问题提供另一个更好的解决方案?
I'm building a website using perl/catalyst and I'm bothered with multi-language problem.
I'm supposed to put the strings in a file other than perl code file(.pl .pm), and it should stay within the memory throughout the lifetime of the server.
At first I try to put it into $c->config during setup of catalyst, so I used standard perl-style file-IO open LANG, "<file"
but I found out that after start up what's actually in the config is pack(H*, ...)
. I don't know what happened to my string.
Some more information: All file discussed above was utf-8 encoded.
Could anyone help me or give another better solution to multi-language problem?
发布评论
评论(1)
使用行业标准GNU gettext。它由 CatalystX::I18N 支持。
Use the industry standard GNU gettext. It's supported by CatalystX::I18N.