Vor einiger Zeit hatte ich eine Änderung in b2evolution implementiert, damit die Bezeichnungen (z.B. “Leave a comment”) auf meiner Seite auch in der jeweiligen Standard-Sprache des Browsers angezeigt werden. Leider hatte ich das nur im b2evolution-Forum dokumentiert. Da der Themenmixer derzeit das gleiche Problem hat, hier noch mal die Beschreibung, wie ich es implementiert habe:

[Mehr:]

…………………………………………………

I added the following lines at the beginning of the “_main.php” (before the line “skin_content_header(); // Sets charset!”):

if( $current_User->locale == ”) 
$urs_language = substr(locale_from_httpaccept(),0,2); 
locale_temp_switch( locale_from_httpaccept() ); 
else 
$urs_language = substr($current_User->locale,0,2); 
locale_temp_switch( $current_User->locale ); 

This changes the locale to the primary language of the browser (if not logged in) or to the locale of the user which is currently logged in.

I also can display different static texts (e.g. in menues etc.) depending of the users’s language.

I do this e.g. with the following IF clause:

<?php if ($urs_language == “de”) 
// do things for german language 
else 
// do things for other languages 
?> 

…………………………………………………

Verschiedene Sprachen in b2evolution

Leave a Reply

Your email address will not be published. Required fields are marked *