Hello,
I have modified my theme this days and i add to my menu the google map mod, but i don't know what to edit in the menu to have the title,name in different language (en,fr etc.) .
This is what i add to the menu to appear the link.
<a href="location_map.php">» Посетени страни</a></p>
but ofcourse in the menu the link appear only in my language.
How to edit the menu and the .lang files to appear in different languages?
link: http://www.abroadbg.com
Thank you in advance
The best way to do is to make lang files for your theme (so you d'ont have to re-apply the modifications if you have to upgrade).
have a look to the grey-style-20 thème (http://sourceforge.net/projects/coppermine/files/Themes/1.4.x/cpg1.4.x_theme_grey-style-20.1.0.1.zip/download) wich had a multilingual feature for link titles (of course you must addapt it)
Quote from: François Keller on November 20, 2009, 02:48:31 PM
The best way to do is to make lang files for your theme (so you d'ont have to re-apply the modifications if you have to upgrade).
have a look to the grey-style-20 thème (http://sourceforge.net/projects/coppermine/files/Themes/1.4.x/cpg1.4.x_theme_grey-style-20.1.0.1.zip/download) wich had a multilingual feature for link titles (of course you must addapt it)
Thank you for the advice
François Keller but i don't have the skills to make lang files :(
QuoteThank you for the advice François Keller but i don't have the skills to make lang files
it's relative simple, try to look in the theme i refer to understand how it works. For 4 yars, i had no idea what php was ;)
Use the variable $USER['lang'] to determine the user's language.
Then use an if/then switch. Could look like this:<?php
if ($USER['lang'] == 'english') {
echo '<a href="location_map.php">» Location map</a></p>';
} elseif ($USER['lang'] == 'german') {
echo '<a href="location_map.php">» Karte</a></p>';
} else {
echo '<a href="location_map.php">» Посетени страни</a></p>';
}
?>
Thank you both for the great hints and advices, i did as François Keller now i start understanding how to make lang files.
But i have other problem.
I create folder with 2 lang files inside the theme folder.
english.php and bulgarian.php, when i press the language flag under my gallery i am able to change the language, but the translated strings doesn't apper until i refresh all the page :-[ . What i can do.
The edits i did are :
in the top of my theme.php i add :
global $CONFIG;
define('THEME_IS_XHTML10_TRANSITIONAL',1); // Remove this if you edit this template until
// you have validated it. See docs/theme.htm.
if (file_exists("./themes/water_drop/lang/{$USER['lang']}.php")) {
require "./themes/water_drop/lang/{$USER['lang']}.php";
}
else {
require "./themes/water_drop/lang/english.php";
}
and the part with the menu look like :
// HTML template for main menu
$template_sys_menu = <<<EOT
<div class="wireframemenu">
<p><h1 class="h1_wireframemenu">{$lang_water_drop['gal_menu']}</h1></p>
<!-- BEGIN home -->
<p><a href="{HOME_TGT}" title="{HOME_TITLE}">» {HOME_LNK}</a></p>
<!-- END home -->
themes/water_drop/lang/english.php :
<?php
if (!defined('IN_COPPERMINE')) { die('Not in Coppermine...'); }
$lang_water_drop = array(
'gal_menu' => 'Menu',
'admin_menu' => 'Administration',
'user_admin_menu' => 'User Admin',
'friends' => 'Friends',
'location_map' => 'Visited Countries',
);
?>
What i did wrong ???
attach your theme folder on your next post (in a zip file)
This is the theme.
Your theme works for me in different languages.
attached, french.php file for you ;)
try to clear your cookies and browser cache
Merci François Keller for the time to try, but seems even after clearing the cookies and browser cache no changes, the lang change only if i click twice on the lang flag, ore refresh the page. Also thanks for the french language :). Any idea if this could be problem with my tags. ???
Greetings Ivo
oh yes, i didn't understant your issue first time, sorry, I have the same problem on my theme and didn't find how to solved this. Maybe a "real" dev can help us :D
Quote from: François Keller on November 22, 2009, 10:05:28 PM
oh yes, i didn't understant your issue first time, sorry, I have the same problem on my theme and didn't find how to solved this. Maybe a "real" dev can help us :D
haha, ok, i see this is not problem just with my theme only. Thanks for the help and the test, we should wait somebody else with more skills to help us :).
Anyway if u are Parisian send me by email yr mobile number ore email i must buy u a drink for the help (i live in Paris partly)
Thanks very much for the help
QuoteAnyway if u are Parisian send me by email yr mobile number ore email i must buy u a drink for the help (i live in Paris partly)
No chance, i'm near from Strasbourg
>:(
OK, thanks anyway
Hi,
http://www.haiticontacts.com/pictures
(@ Joachim Müller, sorry bout the last time but it is frustrating sometimes ;))
I used the code provided here. I tried several options to. I found out I dont have to check the code
<?php
if ($USER['lang'] == 'english') {
//code to be executed //
} elseif ($USER['lang'] == 'german') {
//code to be executed //
} else {
//code to be executed //
}
?>
options, because you can just use
require ("{$USER['lang']}.php") ;
in theme.php as well.
To me it is obvious that upon loading the first time the theme.php reads out the prefered language and set the cookie. Then the code works fine. But upon changing the language it already executed the code and will not read the cookie again. Unless you refresh or click again on the language option in your page.
I have not figured out how to complete this. Maybe because theme.php is just for the layout and the code need to be on another page? Anyone?
Martin
Yeah, whatever. If you think your code is better, use it. Locking.