Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Multiple languages

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
hagman
Smarty Rookie


Joined: 18 Apr 2003
Posts: 10
Location: Östersund, Sweden

PostPosted: Tue Apr 29, 2003 1:07 pm    Post subject: Multiple languages Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Tue Apr 29, 2003 2:51 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
celia
Smarty n00b


Joined: 18 Jun 2003
Posts: 3

PostPosted: Wed Jun 18, 2003 7:43 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
johnpatcher
Smarty n00b


Joined: 03 Jul 2006
Posts: 2

PostPosted: Mon Jul 03, 2006 2:12 pm    Post subject: Reply with quote

Sure its possible, but not sensefull. There are arrays to do something like this.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP