Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter language issue
#1

[eluser]sehummel[/eluser]
I'm hoping someone can help me with this, because I'm stumped. It involves the language files in CI. I have a group of files in folders for each language. The file in question is called email_lang.php. I have it German, Italian, Japanese and Chinese folders. The lines I am trying to call exist in all four files. And there are no other instances of the lines in the those language files.

In my model, I call the language this way:

Code:
$this->lang->load('email', $this->session->userdata('language'));

The use of the userdata() function works everywhere on the site and in all of the emails except for this one. I've tested it, and the language switches successfully when I want it to. For instance, I can delete a given file like japanese/email_lang.php from the server and then try to call it by doing this:
Code:
$this->lang->load('email', 'japanese');

I get an error about not being able to load the file, which is what you would expect. What I don't expect is that if I comment the first line above completely, I still get the text in my email. The problem is that it is always the English text. This line is not doing anything to the text in the email. Here is a bigger block of code:

Code:
$this->lang->load('email', $this->session->userdata('language'));

        $auto = '&lt;html&gt;&lt;body><font face="Arial, Helvetica" size=3>' .$this->lang->line('email7') . ' ' . $this->input->post('first') . ',<br/><br/>' . $this->lang->line('email8') . '<br/><br/>';

        $auto .= $this->lang->line('email9'). '<br/><br/>';

        $auto .= $this->lang->line('email10');

        $auto .= '</font>&lt;/body&gt;&lt;/html>';


        $config['mailtype'] = "html";
        $config['charset'] = "iso-8859-1";
        $this->email->initialize($config);

        $this->email->from((email address)', 'OEM Division Sales');
        $this->email->to($this->input->post('email'));
        $this->email->subject('Thank you for contacting xxx OEM Division');
        $this->email->message($auto);

        $this->email->send();

I've done everything I can to get the text into one of the other languages. I've moved all of this from the model to the controller. No dice. I've tried passing the userdata() from the controller to the model. Nope. I've tried commenting this code out and then the email doesn't send, so I know it's this code that has the issue. I've tried clearing the cache in my browser and restarting it. Nada. I've looked for somewhere where I've hard-coded the language to English and there are no places where I've done that. I've even change the initial language CI loads and I still get English.

This seems like such a simple thing to do, but I've been at this for a day and I'm just spinning my wheels. Anyone have any other ideas where this might be falling down. I'm using the same code I'm using elsewhere on the site to get the email to send in a the selected language. I don't think the issue is the language selection, because that works flawlessly everywhere else. So like I said, I'm stumped. Can anyone help?
#2

[eluser]toopay[/eluser]
[quote author="sehummel" date="1305327017"]The use of the userdata() function works everywhere on the site and in all of the emails except for this one. [/quote]

Did you mean your issues is with session function?




Theme © iAndrew 2016 - Forum software by © MyBB