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

Multilanguage Problem

 
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
brainwave
Smarty Rookie


Joined: 09 Jul 2003
Posts: 22

PostPosted: Mon Sep 13, 2004 10:41 am    Post subject: Multilanguage Problem Reply with quote

hi,

I'm using this plugin:
http://smarty.incutio.com/?page=SmartyMultilanguageSupport

Now I need to get the language selected by this plugin in php as an var?!

How do I get this?

Greetings
Sascha
Back to top
View user's profile Send private message
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Mon Sep 13, 2004 10:59 am    Post subject: Reply with quote

Quote from your link...
Quote:

The language will be determined by the browser settings. If you want

to change it explicitly you can use something like this:

<?php
$smarty = new smartyML("de"); // now the language will be german regardless of the browser settings
// [...]
// $smarty->assign(...);
$smarty->display("myTemplate.tpl");
?>
Back to top
View user's profile Send private message
brainwave
Smarty Rookie


Joined: 09 Jul 2003
Posts: 22

PostPosted: Mon Sep 13, 2004 11:29 am    Post subject: Reply with quote

yeah ok I know that but I need the browser setting language that the plugin uses in an php-var to use it on an other location too.

something like:

$language = $smarty->getML_language();
echo $language;

Results (for example):
de
Back to top
View user's profile Send private message
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Mon Sep 13, 2004 1:37 pm    Post subject: Reply with quote

Have a try:
[php:1:812ea66808]
echo $smarty->language->_currentLocale;
[/php:1:812ea66808]
Back to top
View user's profile Send private message
brainwave
Smarty Rookie


Joined: 09 Jul 2003
Posts: 22

PostPosted: Tue Sep 14, 2004 7:42 am    Post subject: Reply with quote

thx but this don't work for me...but It brings me to this:

echo $GLOBALS['_NG_LANGUAGE_']->_currentLocale;

and this worked. Thx Kills.

But one more question. I'm not the PHP Champion so I don't know how secure is this GLOBALS thing. Can you help me again?
Back to top
View user's profile Send private message
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Wed Sep 15, 2004 6:08 am    Post subject: Reply with quote

i think you can work with this global var. There are no security problems, i think.

Read more about global vars on www.php.net
Back to top
View user's profile Send private message
brainwave
Smarty Rookie


Joined: 09 Jul 2003
Posts: 22

PostPosted: Wed Sep 15, 2004 11:20 am    Post subject: Reply with quote

thx kills

now I have one more question. anyone here who uses this plugin and who knows how I include a 2nd language file to the global one?
Back to top
View user's profile Send private message
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Wed Sep 15, 2004 1:05 pm    Post subject: Reply with quote

brainwave wrote:
thx kills

now I have one more question. anyone here who uses this plugin and who knows how I include a 2nd language file to the global one?


take a look on the page examples
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