|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
hagman Smarty Rookie
Joined: 18 Apr 2003 Posts: 10 Location: Östersund, Sweden
|
Posted: Tue Apr 29, 2003 1:07 pm Post subject: Multiple languages |
|
|
Now this should not be that hard to understand.
Code: | // some languge file
$lang['native'] = 'Svenska';
$lang['english'] = 'Swedish';
$lang['code'] = 'sv';
$lang['charset'] = 'iso-8859-1';
$lang['language'] = 'språk';
// Assign
include 'lib/lang/'.$this->language.'.php';
foreach ($lang as $key => $value) {
$tmp[$key] = $value;
}
$smarty->assign('lang', $tmp);
// template
{$lang.native}<br>
{$lang.english} |
_________________ php |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Tue Apr 29, 2003 2:51 pm Post subject: |
|
|
Perhaps this applys more to http://www.phpinsider.com/smarty-forum/viewtopic.php?t=84 _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
celia Smarty n00b
Joined: 18 Jun 2003 Posts: 3
|
Posted: Wed Jun 18, 2003 7:43 pm Post subject: |
|
|
hello
i am very new to php, and smarty, but isnt there a way to put the text i need into variables, with a suffix. hello would be
$hello_e for english and $hello_f for french, where
$hello_f =bonjour
$hello_e = hello
so i set a general language variable, e or f, at the beginning of each session or page.
and i just append the current language variable to any text i call. Of course all my text has to be into variables, in another file.
Does that seem possible? is there something i don t know about php or smarty that makes it impossible?
Thanks _________________ -------------------------------------------------------- |
|
Back to top |
|
johnpatcher Smarty n00b
Joined: 03 Jul 2006 Posts: 2
|
Posted: Mon Jul 03, 2006 2:12 pm Post subject: |
|
|
Sure its possible, but not sensefull. There are arrays to do something like this. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|