• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space

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 😀
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.
 
Status
Not open for further replies.
Back
Top