Welcome to Geeklog, Anonymous Friday, November 22 2024 @ 12:30 am EST
Geeklog Forums
Dynamic NLS for GeekLog
Anonymous
Anonymous
”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
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
9
14
Quote
All times are EST. The time is now 12:30 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content