Text home link tied to language Text home link tied to language
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Text home link tied to language

Started by coopersita, August 08, 2004, 04:42:12 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

coopersita

Hi, I'm new to Coppermine. I was wondering if there is a way to add custom links that will also change language along with the standard menu items?

I was thinking of at least adding a function that changes those links (home, About us, Contact) between the two most common languages I expect users to use (Spanish, and English also as default for all other languages), but I'm not sure in which variable is the language chosen by the user stored...

Any ideas on how to do it? I figured it would be simple (a simple if-else structure)...

Any help will be welcomed.

Joachim Müller

coppermine uses language files you are encouraged to modify as needed. If you need a "home" link in the classic theme for example, you edit themes/classic/theme.php, find// HTML template for main menu
$template_main_menu = <<<EOT
                <span class="topmenu">
and add after it                        <a href="{HOME_LINK_TGT}" title="{HOME_LINK_TITLE}">{HOME_LINK_LNK}</a> ::Then you find    $param = array('{ALB_LIST_TGT}' => "index.php$cat_l",
        '{ALB_LIST_TITLE}' => $lang_main_menu['alb_list_title'],
        '{ALB_LIST_LNK}' => $lang_main_menu['alb_list_lnk'],
and add after it        '{HOME_LINK_TGT}' => "index.php",
        '{HOME_LINK_TITLE}' => $lang_main_menu['home_link_title'],
        '{HOME_LINK_LNK}' => $lang_main_menu['home_link_lnk'],

Next, you will have to modify all language files you plan to use. Edit lang/yourlanguage.php, e.g. lang/english.php, find $lang_main_menu = array(and add after it (in a new line)  'home_link_title' => 'Go to the gallery start page',
  'home_link_lnk' => 'Gallery home',


Save the whole enchilada, upload the modified files to your webserver and test it.

GauGau

coopersita

Thanks, I'll give it a try. I wish there were a manual with a llist of all template tags and such...

coopersita

It worked like a charm.

I only wish there was a default language folder, so that I don't have to change all language files (in languages other than the ones I changed it doesn't show any link at all...). I think I'll just eras all other languages but the esencial ones for this site.

Thanks again

Joachim Müller

you're encouraged to leave only those language files on your server you actually want to use. Remove all unused languages.

In cpg1.4, there will be a language fallback routine - if a translation doesn't exist in a special language, coppermine will default back to english and show the untranslated bit in english.

GauGau