CodeIgniter Forums
Sending Emails in Multiple languages - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Sending Emails in Multiple languages (/showthread.php?tid=37577)



Sending Emails in Multiple languages - El Forum - 01-13-2011

[eluser]Glazz[/eluser]
Hi,

I was wondering how do you guys send multilanguage emails.

I know how to use the language file, but i need to have some variables inside the email messages, i tried using the parser, but no success, because the parser doesn't check passes data for variables.

I don't want to make multiple views, i want to have only 1 view, that holds the html and css and inside that view i hold some vars, like {top} {message} {footer}, but inside message i need to have other variables, that's the problem, i don't know how to make it change the vars..

I know i can use str_replace, but there is another way ?

Thanks in advance Wink


Sending Emails in Multiple languages - El Forum - 01-14-2011

[eluser]Cristian Gilè[/eluser]
Quote:I know how to use the language file, but i need to have some variables inside the email messages, i tried using the parser, but no success, because the parser doesn’t check passes data for variables.

Please, provide your code.

Cristian Gilè


Sending Emails in Multiple languages - El Forum - 01-14-2011

[eluser]Glazz[/eluser]
Hi,

In my controller i have something like this:
Code:
$this->load->library('parser');
        
        $data = array(
            'nome' => 'teste',
            'topo'        => $this->lang->line('email_topo'),
        );

        $email = $this->parser->parse('email_template', $data, true);

View (email_template):
Code:
<html>
<head>
<title>{titulo}</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body,td,th {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 9px;
    color: #333;
}
body {
    background-color: #dedede;
}
-->
</style></head>
<body>
{topo}

</body>
</html>

Language file (not all of the file):
Code:
$lang['email_topo'] = 'Exmo(a). Sr(a). {nome},';

Current output:
Exmo(a). Sr(a). {nome},

Expected output:
Exmo(a). Sr(a). teste,


The problem is that i need to have variables in the language lines, maybe i will sprintf or something


Sending Emails in Multiple languages - El Forum - 03-14-2011

[eluser]surfweb[/eluser]
I think I found the error:

change this string in the file Whois.servers.php: .eu|whois.eu|FREE with .eu|whois.eu|AVAILABLE


Sending Emails in Multiple languages - El Forum - 03-14-2011

[eluser]surfweb[/eluser]
Sorry ... I was wrong thread