• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.

Add more than one language?

Status
Not open for further replies.

booyaka95

Chevereto Noob
Can someone help me i would at more languages on my image hoster..
in the right corner a flag for german etc..
 
Is this the effect you where aiming for?

This is based of chevereto 1.7 which has multi language support by default, I just made it switchable.
 
booyaka95 said:
Please tell me how to do this :D
Ok well, it's nothing fancy but here's it:
Find in engine.php :
Code:
// LANGUAGE

include('lang/'.LANG.'.php');

if (LANG!=='es') { $lang = LANG; }
Replace it with this:
Code:
// LANGUAGE
//if (LANG !=='es') { $lang = LANG; }

if (isset($_GET['lang'])) {
    $lang = $_GET['lang'];
    $_SESSION['chev_lang'] = $_GET['lang']; //storing current language in session 
    } elseif (isset($_SESSION['chev_lang'])) {
    $lang = $_SESSION['chev_lang']; //getting the language from the session    
    } else {
    $lang = LANG;
    }
include('lang/'.$lang.'.php');

Find in index.php
Code:
<!-- selector -->
Replace it with:
Code:
<!--language selector-->
<div id="languages" class="lang_selector">
    <!--dutch/ used this a template-->
    <a href="<?=$_SERVER['PHP_SELF']?>?lang=nl" title="Dutch"><img src="<?=PATH_SCRIPT;?>site-img/lang/nl.png" alt="dutch"></a>
    
    <a href="<?=$_SERVER['PHP_SELF']?>?lang=fr" title="French"><img src="<?=PATH_SCRIPT;?>site-img/lang/fr.png" alt="French"></a>
    <a href="<?=$_SERVER['PHP_SELF']?>?lang=es" title="Spanis"><img src="<?=PATH_SCRIPT;?>site-img/lang/es.png" alt="Spanis"></a>
    <a href="<?=$_SERVER['PHP_SELF']?>?lang=en" title="English"><img src="<?=PATH_SCRIPT;?>site-img/lang/gb.png" alt="English"></a>
    <a href="<?=$_SERVER['PHP_SELF']?>?lang=cn" title="Chinees"><img src="<?=PATH_SCRIPT;?>site-img/lang/cn.png" alt="Chinees"></a>    
    </div>
<!-- selector -->
Now all these languages are hard coded. If want to add more just adding another line copied from one of the examples.

Now add to the end of estilo.css
Code:
/* Langauge selectors */
div#languages {
position:relative;
float:right;
border:0px;
text-decoration:none;
}
#languages img {
border:0px;
}
Finally download and extract this zip
into site-image/lang

http://www.famfamfam.com/lab/icons/flags/

This should give you the same result as the image I showed earlier. If not don't hesitate to ask.
[Edit]
Sorry if anyone already followed this but if forgot to tell that you need to put
Code:
session_start();
right after the <? in index.php
This is so that it remembers which language the user selected.
 
booyaka95 said:
Does it work with Chevereto 1.6 ?
I haven't tested it but looking at the 1.6rev2 zip it should. As long as it has multiple language support it should work.
 
Status
Not open for further replies.
Back
Top