Welcome Guest, Not a member yet? Register   Sign In
Issue's with multilanguage
#1

[eluser]Maaark[/eluser]
Hello,

I just followed this tutorial: http://codeigniter.com/wiki/i18n_Multi-l...ry_Helper/ but I can not make it work.. I added all the files to my ftp, I emptied the $config[language] array and the autoload language array and in the controller I putted:
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Aanmelden extends CI_Controller {
    
    function __construct()
    {
        parent::__construct();
        $this->load->helper('language');
        $this->lang->load('register', 'dutch');
    }

I added in the view:
Code:
<h2>&lt;?= i18n('register_pagetitle');?&gt;</h2>

and in the folder dutch/ I added the file register

But I have to place the , 'dutch' to the controller otherwise it won't work..
The site is placed on a .nl site so application/config/language.php should have set a default_lang dutch..

Could this problem been caused since I use a subdomain?

PS. I'm new to codeigniter Smile

Thanks in advance!
#2

[eluser]Stoney[/eluser]
Hi,

I'm using this i18 library, works like a charm: http://maestric.com/doc/php/codeigniter_i18n

I think you should use
Code:
<h2>&lt;?=lang('register_pagetitle');?&gt;</h2>
instead of:
Quote:
Code:
<h2>&lt;?= i18n('register_pagetitle');?&gt;</h2>
#3

[eluser]Maaark[/eluser]
Thanks for your reply, your suggestion won't work unfortunattely. I think the problem is that the default language isn't loaded propperly, even when I add /nl/ in the url it won't work.
#4

[eluser]approacher[/eluser]
I think whatever language that you want to use must be located inside ...>application/libraries
Hope you got this if I understood your problem.
#5

[eluser]Julio Fagundes[/eluser]
http://maestric.com/doc/php/codeigniter_i18n Smile
#6

[eluser]Maaark[/eluser]
[quote author="approacher" date="1305762250"]I think whatever language that you want to use must be located inside ...>application/libraries
Hope you got this if I understood your problem.[/quote]

The files are located in the libaries folder.

[quote author="Julio Fagundes" date="1305762328"]http://maestric.com/doc/php/codeigniter_i18n Smile[/quote]
That doesn't support to change the pagename for each language?
example:
site.com/nl/nieuws
site.com/en/news

am I right?
#7

[eluser]approacher[/eluser]
[quote author="Maaark" date="1305766727"][quote author="approacher" date="1305762250"]I think whatever language that you want to use must be located inside ...>application/libraries
Hope you got this if I understood your problem.[/quote]

The files are located in the libaries folder.

am I right?[/quote]


Sorry for the mistake... I was willing to tell <b>application\language\ </b>but by mistake I wrote <i>libraries</i>.

Try if it works.
http://ellislab.com/codeigniter/user-gui...guage.html
#8

[eluser]Stoney[/eluser]
[quote author="Julio Fagundes" date="1305762328"]http://maestric.com/doc/php/codeigniter_i18n Smile
That doesn't support to change the pagename for each language?
example:
site.com/nl/nieuws
site.com/en/news

am I right?[/quote]
[/quote]
Yes and No...

Your pages are controllers (or controller functions), so you have to route each language specific page to one controller function.

Code:
// Urls start
$route['^mobiel|^handy|^movil|^cell(/:any)?'] = "mobile$1";
#9

[eluser]Maaark[/eluser]
[quote author="cimet" date="1305806687"][quote author="Julio Fagundes" date="1305762328"]http://maestric.com/doc/php/codeigniter_i18n Smile
That doesn't support to change the pagename for each language?
example:
site.com/nl/nieuws
site.com/en/news

am I right?[/quote]
[/quote]
Yes and No...

Your pages are controllers (or controller functions), so you have to route each language specific page to one controller function.

Code:
// Urls start
$route['^mobiel|^handy|^movil|^cell(/:any)?'] = "mobile$1";
[/quote]

Thanks! That explains a lot!

I fixed it by autoloading the language config :$

Was that stupid?
#10

[eluser]Stoney[/eluser]
The i18 library should load it's config and the appropriate language, after it's initialization.

You can debug it from the CI logs.
BTW as long as it works it can't be stupid Smile.




Theme © iAndrew 2016 - Forum software by © MyBB