douke6027 2015-06-16 10:20
浏览 59

设置gettext与wamp一起使用

Haven't found this kind of problem here. Well i want to localize my website to English and Serbian language.

It is working for english, but i can't make it work with serbian. My directory structure looks like this (working on WAMP):

My app
  |
  |---Locale
        |
        |---sr_RS
        |    |---LC_MESSAGES
        |          |---messages.po
        |          |---messages.mo
        |---en_US
             |---LC_MESSAGES
                   |---messages.po
                   |---messages.mo

All .mo and .po files where created with poedit. Here is my messages.po file in sr_RS folder:

    msgid ""
msgstr ""
"Project-Id-Version: 
"
"POT-Creation-Date: 2015-06-15 23:00+0100
"
"PO-Revision-Date: 2015-06-16 12:07+0100
"
"Last-Translator: 
"
"Language-Team: 
"
"MIME-Version: 1.0
"
"Content-Type: text/plain; charset=UTF-8
"
"Content-Transfer-Encoding: 8bit
"
"X-Generator: Poedit 1.8.1
"
"X-Poedit-Basepath: .
"
"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);
"
"Language: sr_RS@latin
"

Problem is that when i choose serbian with this code:

<?php

// I18N support information here
$language = "sr_RS";
putenv("LANG=" . $language); 
setlocale(LC_ALL, $language);

// Set the text domain as "messages"
$domain = "messages";
bindtextdomain($domain, "Locale"); 
bind_textdomain_codeset($domain, 'UTF-8');

textdomain($domain);

echo _("pocetna");
?>

default string is echoed, not the translated one.

Help needed! :)

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
    • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
    • ¥16 mybatis的代理对象无法通过@Autowired装填
    • ¥15 可见光定位matlab仿真
    • ¥15 arduino 四自由度机械臂
    • ¥15 wordpress 产品图片 GIF 没法显示
    • ¥15 求三国群英传pl国战时间的修改方法
    • ¥15 matlab代码代写,需写出详细代码,代价私
    • ¥15 ROS系统搭建请教(跨境电商用途)
    • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。