gettext library |
[eluser]Elianora la blanche[/eluser]
Hi ! I found this article in the wiki : gettext and choose the first method by Tassimo, I created the locale dirs and lang.po/lang.mo files I put that in my controller : Code: $this->lang->load_gettext('fr_FR'); Code: <h1><?php echo $this->lang->line('wcp_welcome_text'); ?> CodeIgniter</h1> here is my lang.po content : Code: msgid "welcome_text" the problem is it prints nothing thanks for help and sorry for my english
[eluser]xwero[/eluser]
I don't see a method in the library that outputs a line and the Code: $this->gettextbis->line('messSingle', array('plural' => 'messPlur', 'count' => 2, 'd' => 18)); You have to correct the class if you want to work with it.
[eluser]Elianora la blanche[/eluser]
in the wiki page is written Quote:It’s based on the original CI_Language library, and doesn’t replaces the original line methothe basic line function should work... gettextbis is in the second method with another library... or maybe I didn't understand all ^^
[eluser]xwero[/eluser]
I didn't check the zip attached to the wiki page. There the Gettextbis method needs to renamed to MY_Language and then it should work. I guess he named the library like that and forgot to change the constructor when he ported it to CI.
[eluser]Elianora la blanche[/eluser]
I corrected the class like this : Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); now I get a fatal error : Quote:Fatal error: Call to undefined function get_instance() in /home/elianora/public_html/codeigniter/system/application/libraries/MY_Language.php on line 83 here is the line : Code: $CI =& get_instance(); in system/libraries/Language.php we can find the same line and it seems to work...
[eluser]Truong Chuong DUong[/eluser]
I just make a library which can auto translate all text between {t} and {/t} in the view, I posted here in case some one want to use it instead calling the gettext function in the view: http://www.chuongduong.net/page/15/codei...-view.html The view code might be: Code: <html> |
Welcome Guest, Not a member yet? Register Sign In |