Setting gettext to work with wamp

562 views Asked by At

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: \n"
"POT-Creation-Date: 2015-06-15 23:00+0100\n"
"PO-Revision-Date: 2015-06-16 12:07+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.1\n"
"X-Poedit-Basepath: .\n"
"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);\n"
"Language: sr_RS@latin\n"

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

There are 0 answers