You are not logged in.
You can post links like google.com which will be rendered as text but you will not be able to post messages that contain complete URLs like www.google.com
Thank you for your understanding!Pages: 1
Attention!- Please backup your files before do this hack.
You may find a demo of this result on http://www.balicareer.com
The files tobe hack are bellow:
1. config.php
2. index.php
3. _template/default/header.tpl
4. _template/default/css/screen.css
5. create folder 'languages' on root
6. move your file translations.ini to languages folder and rename to english.ini
you may add other file translation like german.ini spanish.ini into this folder.
Let's do hack one by one
1. config.php
find the code bellow:
define('ENABLE_RECAPTCHA', $settings['enable_recaptcha']);
define('CAPTCHA_PUBLIC_KEY', $settings['captcha_public_key']);
define('CAPTCHA_PRIVATE_KEY', $settings['captcha_private_key']);
// Setup Smarty
$smarty = new Smarty();
$smarty->template_dir = APP_PATH . '_templates/' . THEME . '/';
$smarty->compile_dir = APP_PATH . '_templates/' . THEME . '/_cache/';
// Create Textile object
$textile = new Textile;Insert the code bellow in above //Setup Smarty
//Define Languages
class Language
{
var $description; //language name
var $filename; //language PHP constants file
}
//a list of languages
$lang_list = array();
//to add new languages
$lang_list[0] = new Language();
$lang_list[0]->description = "English";
$lang_list[0]->filename = "english.ini";
$lang_list[1] = new Language();
$lang_list[1]->description = "Indonesian";
$lang_list[1]->filename = "indonesian.ini";2. Index.php
Delete the code bellow at line arround 19 -24
if (file_exists(APP_PATH . '_includes' . DIRECTORY_SEPARATOR . 'translations.ini')) {
$translations = parse_ini_file(APP_PATH . '_includes' . DIRECTORY_SEPARATOR . 'translations.ini', true);
$smarty->assign('translations', $translations);
} else {
trigger_error('Unable to find the translations file!');
}replace with this code
//select a new language?
if (isset($_POST["new_language"]))
{
$_SESSION["current_language"] = $_POST["new_language"];
}
//current language session variable
if (!isset($_SESSION["current_language"]) ||
$_SESSION["current_language"] < 0 || $_SESSION["current_language"] > count($lang_list))
$_SESSION["current_language"] = 0; //set default language
//include a language file
if (isset($lang_list[$_SESSION["current_language"]]) && file_exists("./languages/".$lang_list[$_SESSION["current_language"]]->filename))
{
$translations = parse_ini_file(APP_PATH . '/languages/'.$lang_list[$_SESSION["current_language"]]->filename, true);
$smarty->assign('translations', $translations);
}
else
{
die("<font color=red><b>ERROR: Couldn't find language file!</b></font>");
}
3. header.tpl
Find the code bellow
</ul>
<div id="the_feed">The new code will be as bellow
</ul>
<ul id="top2">
{if $lang_list_count > 1}
{section name=i loop=$lang_list}
{if $smarty.section.i.index > 0}<font class="lightsmall">/</font> {/if}
<li><a class="lightsmall" href="javascript:document.lang_form.new_language.value={$smarty.section.i.index};document.lang_form.submit();">{$lang_list[i]->description}</a></li>
{/section}
<form name="lang_form" method="post" action="{$BASE_URL}">
<input type="hidden" name="new_language">
</form>
{/if}
</ul>
<div id="the_feed">4. Screen.css
Add 2 line code to define top2 id in header box, see code bellow
div#header ul#top{position:absolute; top:10px; right:10px}
div#header ul#top li{display:inline; margin-left:2px; background-color:transparent; color:#09C}
div#header ul#top2{position:absolute; top:10px; right:210px}
div#header ul#top2 li{display:inline; margin-left:2px; background-color:transparent; color:#09C}That's All.
Offline
Looks good but a problem seems to be there..changing the language brings the site back to homepage instead of keeping on the page where it was clicked.
Offline
You are wright. Let try this way.
1. Add the code bellow somewhere in config.php
define ('BASE_URL_NOW', 'http://' . $_SERVER['SCRIPT_NAME'] . '/');2. Update the header.tpl
Change the action variable to "{$BASE_URL_NOW}" instead of $BASE_URL
<form name="lang_form" method="post" action="{$BASE_URL_NOW}">
<input type="hidden" name="new_language">Offline
I have tried this hack twice on 2 fresh installs of JobberBase 1.8. The links to change languages never appear. Also in my testing I cannot get the $lang_list array to print to screen. I try $lang_list[0]->description and it's blank.
Anyways please verify again that this code above is correct as I would desperately like to try this!
Offline
I need instructions to set up a multilingual site using JooberBase 1.9 I have translated the translations_en.ini file and created translations_ru.ini file
Offline
Pages: 1