Welcome Guest, Not a member yet? Register   Sign In
Variables in Language files !!
#1

[eluser]Mahmoud M. Abdel-Fattah[/eluser]
I'm creating a multi-language website. I'm sending some mails to the users, and of course using variables in the mail, such as ( username, code, etc. ).

now can I use define the whole mail including Variables in the language file ??

or should I make it manually, in the email library file ?? for example :

Quote:if($this->session->userdata('language') == "eng")
$msg = "hello " . $username;
elseif
$msg = "مرحبا " . $username;

then the website admin will edit the language files & the mail library file too !
#2

[eluser]Armchair Samurai[/eluser]
Take a look at printf() and sprintf() - you can echo out the result in your view.
Code:
// in your language file
$lang['greeting'] = 'Hello %s';

// in your view
<?php printf(lang('greeting'), $username);?>
#3

[eluser]RJ[/eluser]
Perfect, just what i needed, thanks @Armchair Samurai




Theme © iAndrew 2016 - Forum software by © MyBB