Topics

User Functions

Events

There are no upcoming events

What's New

Stories

1 new Stories in the last 2 weeks

Comments last 2 weeks


Trackbacks last 2 weeks

No new trackback comments

Links last 2 weeks

No recent new links

NEW FILES last 14 days

No new files

Welcome to Geeklog Saturday, May 25 2013 @ 11:36 AM EDT


 Forum Index > Extensions > Cool Hacks New Topic Post Reply
 Dynamic NLS for GeekLog
   
Anonymous: Anonymous
 12/20/04 11:17AM (Read 1112 times)  



”Dynamic” NLS for GeekLog


I have inserted following code into my lib-common. And now I can call any page on my site with additional parameter “nls” (for National Language Support).


So if I viewing something, I can go to the address bar and:


if thwe current page has no parameters (say /my_site/index.php) then:


index.php?nls=russian (for russian)


or, if they are parameters (say /my_site/index.php?item=……..), then I use & instead of ?,


index.php?item=about&nls=russian


It shows help text in asked language, provided, that the language file exists. If not, then the default language will be used. Default language can be recalled by passing with no nls parameters. Like this: index.php.


Should you use it – go to your lib-common.php, take a backup, and try do following:


// Similarly set language


// lib-common.php line ca. 270 search for "language"
// you should find this:
// Similarly set language
//
// code for dynamic NLS support [Vasilij, dec. 2004, but (!) Remember, this is more like for demo.
// sending of forms, using different language, then default language in config.php will fail.
// code enforces using default language, if requested language file not found.
// you can now call any page on your web adding nls=danish (for nanish) or nls=russian (for russian, and so on)
// you shlould have langusge files installed on the system to get any use of this script:


$nls = @$HTTP_GET_VARS["nls"];
$lng_file = $_CONF['path_language'] . $nls . '.php';
if (file_exists($lng_file)) {
$_CONF['language'] = $nls;
} else {
if( isset( $HTTP_COOKIE_VARS[$_CONF['cookie_language']]) && empty( $_USER['language'] )) {
if( is_file( $_CONF['path_language'] . $HTTP_COOKIE_VARS[$_CONF['cookie_language']] . '.php' )) {
$_USER['language'] = $HTTP_COOKIE_VARS[$_CONF['cookie_language']];
$_CONF['language'] = $HTTP_COOKIE_VARS[$_CONF['cookie_language']];
}
}else if( !empty( $_USER['language'] )) {
if( is_file( $_CONF['path_language'] . $_USER['language'] . '.php' )) {
$_CONF['language'] = $_USER['language'];
}
}
}


May be you can use it.

Vasilij
vasilij@email.dk

and the site is here www.booknu.dk/members

 
 Quote
Content generated in: 0.14 seconds
New Topic Post Reply

Normal Topic Normal Topic
Sticky Topic Sticky Topic
Locked Topic Locked Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Able to post 
Filtered HTML Allowed 
Censored Content