jobberBase Community

Welcome to jobberBase Developer Community!

You are not logged in.

Announcement

Announcement for new users: in order to combat the ever increasing spam, we no longer allow new users to post links in the message body. This limitation is automatically lifted once a new user has a specific number of 'valid' posts.

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!

#1 2009-10-02 17:18:06

totokbali
Member
Registered: 2009-10-02
Posts: 2

Jobberbase Multingual with litle hack

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

#2 2009-10-02 20:12:45

navjotjsingh
Senior Contributor
From: Delhi, India
Registered: 2009-03-14
Posts: 230

Re: Jobberbase Multingual with litle hack

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

#3 2009-10-03 13:07:13

totokbali
Member
Registered: 2009-10-02
Posts: 2

Re: Jobberbase Multingual with litle hack

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

#4 2009-10-07 05:14:07

miles
Member
Registered: 2009-09-24
Posts: 2

Re: Jobberbase Multingual with litle hack

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

#5 2010-06-12 11:37:04

ruddcl
Member
Registered: 2010-06-11
Posts: 5

Re: Jobberbase Multingual with litle hack

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

Board footer

Powered by FluxBB