[eluser]Unknown[/eluser]
My approach:
I have created MY_language_helper.php in application/helpers
Code:
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
$language = "en_US";
$lang_path = APPPATH."language/locale";
putenv("LC_ALL=$language");
setlocale(LC_ALL, $language);
bindtextdomain("lang", $lang_path);
bind_textdomain_codeset("lang","UTF-8");
textdomain("lang");
?>
This helper is autoloading with the following line in application/config/autoload.php
Code:
$autoload['helper'] = array('url','language');
My folders for language are
Code:
application/language/locale/en_US/LC_MESSAGES/lang.mo and lang.po
I have a typical controller calling a view where there are some test examples of echoing greek letters.
Here is the view
Code:
<?php
echo _("α");
echo _("β");
echo _("γ");
echo _("δ");
echo _("ε");
echo _("ζ");
?>
This echoes αβγδεζ and with the mo file must produce abcdez but it produces αβcδεζ so it only translate the letter c. So gettext is working but not for all the strings i want to translate. If i create a simple php file the translation is going normally. I have also tried in my own simple mvc (just an index.php controllers, views and a router.php) and i have the same problem with codeigniter. Also if i put helper code inside the view the problem remains. I have restarted my server, in poedit i have used utf-8 everywhere etc..
Any help acceptable :-)