Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [MOD] Multi-language simple Mod  (Read 993 times)

Zemistr

  • Newbie
  • *
  • Karma: 0
  • Posts: 3
[MOD] Multi-language simple Mod
« on: March 21, 2010, 01:21:44 AM »

Open:
Code: [Select]
snews.php


Find all:
Code: [Select]
s('language')
Replace with:
Code: [Select]
lang()


Find:
Code: [Select]
// CONFIGURATION VARIABLES
Add after:
Code: [Select]
function lang(){
if($_POST['language'] != ''){
$_SESSION['language'] = $_POST['language'];
$lang = $_SESSION['language'];
}elseif($_SESSION['language'] != ''){
$lang = $_SESSION['language'];
}else{
$lang = s('language');
}
return $lang;
}
lang();



Find:
Code: [Select]
echo html_input('text', 'language', 'lang', lang() == '' ? 'EN' : lang(), l('a_language'), '', '', '', '', '', '', '', '', '', '');
Replace with:
Code: [Select]
echo html_input('text', 'language', 'lang', s('language') == '' ? 'EN' : s('language'), l('a_language'), '', '', '', '', '', '', '', '', '', '');


Anywhere in template add:
Code: [Select]
<form action="<? echo $_SERVER['REQUEST_URI']; ?>" method="post" id="lang" style="display:none;"><p><input type="hidden" name="language" value="" id="lang_value" /></p></form>
<div>
<a href="javascript:;" onclick="document.getElementById('lang_value').value='CS';document.getElementById('lang').submit();">CZ</a>
<a href="javascript:;" onclick="document.getElementById('lang_value').value='SK';document.getElementById('lang').submit();">SK</a>
<a href="javascript:;" onclick="document.getElementById('lang_value').value='EN';document.getElementById('lang').submit();">EN</a>
<? echo '( '.lang().' )'; ?>
</div>
Logged

stephane

  • Full Member
  • ***
  • Karma: 6
  • Posts: 194
Re: [MOD] Multi-language simple Mod
« Reply #1 on: March 23, 2010, 03:49:28 PM »

Very interesting and useful. I will try it soon.
Thanks for this Mod.

Stephane

Hummm... I tried it but don't understand how it works  ???
How displaying content for English version or French version (for example). Where are we suppose to write the different content ?

 
« Last Edit: March 24, 2010, 02:23:51 PM by stephane »
Logged

sibas

  • Sr. Member
  • ****
  • Karma: 23
  • Posts: 451
    • www.simply4all.net
Re: [MOD] Multi-language simple Mod
« Reply #2 on: January 17, 2013, 12:14:27 PM »

Please update the function lang like this
Code: [Select]
<?php 
function lang(){
if(isset($_POST['language']) != ''){
$_SESSION['language'] = $_POST['language'];
$lang $_SESSION['language'];
}elseif(isset($_SESSION['language']) != ''){
$lang $_SESSION['language'];
}else{
$lang s('language');
}
return $lang;
}
// lang();
?>



lang(); after the function lang() is not needed as creates problems with function s($var).  :)
Logged