Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

2506 Posts in 649 Topics- by 1316 Members - Latest Member: kortuem

eTicket CommunitySupportTips & Tricks (Moderators: jason, Hummdis)Topic: Multi-language interface
Pages: [1]   Go Down
Print
Author Topic: Multi-language interface  (Read 4145 times)
0 Members and 1 Guest are viewing this topic.
mcardin
New Member
*

Karma: +1/-0
Offline Offline

Posts: 1


« on: August 13, 2008, 03:12:40 AM »

Hi people,

As I needed a multi-language interface and because it seems eTicket uses only one language at a time (with lang.php), I added a simple workaround that doesn't interfere with the core. The patch uses Cookies. These are the steps to make it work :

1 : Rename the language files lang_en.php, lang_fr.php, lang_de.php, etc.

2 : Add this line to settings.php :

Code:
$languages = array("en", "fr");

This array should contains all your available language "codes".

3. Add/replace these lines in init.php (near line 66)

Code:
chdir($rootpath_dir);
if (isset($_GET['lang']) && in_array($_GET['lang'], $languages)) {
setcookie("ETICKET_lang", $_GET['lang'], time()+2678400);
$lang = $_GET['lang'];
} else {
if (!empty($_COOKIE['ETICKET_lang'])) {
$lang = $_COOKIE['ETICKET_lang'];
} else {
$lang = "en";
}
}
require_once ('lang_'.$lang.'.php'); // include the language file
// create tables array

4. Now, enter the site using this URL :

http://www.yoursite.com/etickets/index.php?lang=fr (or whatever language you want)

Use the "lang=en" query once because the language is stored in a cookie after that.

TO THE eTICKET TEAM : I think it would be a good idea to make this feature official. I work a lot on multi-languages sites like a lot of web developpers and it would be really useful to offer everyone the eticket service in their own language. Thank you.
Logged
beven
Project Manager/Developer
Global Moderator
Super Member
*****

Karma: +12/-4
Offline Offline

Posts: 804


WWW
« Reply #1 on: August 15, 2008, 10:37:02 PM »

This has actually been implemented in version 2. Along with a while new language file structure.
Logged

Not to be confused with Bob Evans.
Ask not what eTicket community can do for you - ask what you can do for eTicket community.

Version 2 coming out shortly.
tkahl
New Member
*

Karma: +1/-0
Offline Offline

Posts: 1


« Reply #2 on: August 17, 2008, 11:31:29 AM »

Hello,

I also needed a multi language solution. I hve added something similar, but with a different approach.

To make sure that every language variable is defined (like suggested in the original language file), i have added all the code to the lang.php.

Just add the following code before the language definitions in lang.php.
Code:
session_start();
$urllang=$_REQUEST['lang'];
if ($urllang) $_SESSION['lang']=$urllang;
$langfile=dirname(__FILE__)."/lang.{$_SESSION['lang']}.php";
if (file_exists($langfile)) include_once($langfile);

The lang.php should always be the file from the release. Your other language files are named lang.XX.php. As in the solution above, you can switch the languages with the parameter "lang=XX"

Thomas
« Last Edit: August 17, 2008, 11:35:03 AM by tkahl » Logged
gabureiru
New Member
*

Karma: +0/-0
Offline Offline

Posts: 1


« Reply #3 on: October 17, 2008, 10:16:25 AM »

Hi people,

As I needed a multi-language interface and because it seems eTicket uses only one language at a time (with lang.php), I added a simple workaround that doesn't interfere with the core. The patch uses Cookies. These are the steps to make it work :

1 : Rename the language files lang_en.php, lang_fr.php, lang_de.php, etc.

2 : Add this line to settings.php :

Code:
$languages = array("en", "fr");

This array should contains all your available language "codes".

3. Add/replace these lines in init.php (near line 66)

Code:
chdir($rootpath_dir);
if (isset($_GET['lang']) && in_array($_GET['lang'], $languages)) {
setcookie("ETICKET_lang", $_GET['lang'], time()+2678400);
$lang = $_GET['lang'];
} else {
if (!empty($_COOKIE['ETICKET_lang'])) {
$lang = $_COOKIE['ETICKET_lang'];
} else {
$lang = "en";
}
}
require_once ('lang_'.$lang.'.php'); // include the language file
// create tables array

4. Now, enter the site using this URL :

http://www.yoursite.com/etickets/index.php?lang=fr (or whatever language you want)

Use the "lang=en" query once because the language is stored in a cookie after that.

TO THE eTICKET TEAM : I think it would be a good idea to make this feature official. I work a lot on multi-languages sites like a lot of web developpers and it would be really useful to offer everyone the eticket service in their own language. Thank you.

Awsome!!! your contribution really helps me out. Thanks!!!
Logged
rosejay0918
New Member
*

Karma: +0/-0
Offline Offline

Posts: 1


« Reply #4 on: July 01, 2009, 09:21:10 PM »

All can be seen if the language files are named lang. XX. php. Thanks for the seeing code.



_________________
commercial deep fryer
Logged
eTicket Community
   

 Logged
Pages: [1]   Go Up
Print
eTicket CommunitySupportTips & Tricks (Moderators: jason, Hummdis)Topic: Multi-language interface
Jump to: