Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: How do I localize Strings on my theme that I know are in the lang files already.  (Read 4055 times)

0 Members and 1 Guest are viewing this topic.

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray

I have created a custom botton named "Home" on my theme, and I want to localize it.

I know there's already a translation of "Home" in $lang_list_catagories['home']

If I look at the "Register" button in the theme.php, I see that a tag is used {REGISTER_LNK}

I found the section below in the theme.php that mapped {REGISTER_LNK} to $lang_main_menu['register_lnk']


So I added these lines to my theme.php:

Code: [Select]

...

$template_main_menu1 = <<<EOT
...

<!-- BEGIN home -->
                                        <td><img name="spacer" src="images/spacer.gif" width="5" height="33"

border="0" id="spacer" alt="" /></td>
                                        <td><img name="button1_r1_c1"

src="themes/hardwood/images/button1_r1_c1.gif" width="10" height="33" border="0" id="button1_r1_c1" alt=""

/></td>
                                        <td background="themes/hardwood/images/button1_r1_c2.gif">
                                                <a href="/" title="{HOME}">{HOME}</a>
                                        </td>
                                        <td><img name="button1_r1_c3"

src="themes/hardwood/images/button1_r1_c3.gif" width="10" height="33" border="0" id="button1_r1_c3" alt=""

/></td>
<!-- END home -->
...

function theme_main_menu1()
...
    $param = array('{MY_GAL_TGT}' => "index.php?cat=$my_gallery_id",
        '{MY_GAL_TITLE}' => $lang_main_menu['my_gal_title'],
        '{MY_GAL_LNK}' => $lang_main_menu['my_gal_lnk'],
        '{MEMBERLIST_TGT}' => "usermgr.php",
        '{MEMBERLIST_TITLE}' => $lang_main_menu['memberlist_title'],
        '{MEMBERLIST_LNK}' => $lang_main_menu['memberlist_lnk'],
        '{MY_PROF_TGT}' => "profile.php?op=edit_profile",
        '{MY_PROF_LNK}' => $lang_main_menu['my_prof_lnk'],
        '{FAQ_TGT}' => "faq.php",
        '{FAQ_TITLE}' => $lang_main_menu['faq_title'],
        '{FAQ_LNK}' => $lang_main_menu['faq_lnk'],
        '{ADM_MODE_TGT}' => "admin.php?admin_mode=1&referer=$REFERER",
        '{ADM_MODE_TITLE}' => $lang_main_menu['adm_mode_title'],
        '{ADM_MODE_LNK}' => $lang_main_menu['adm_mode_lnk'],
        '{USR_MODE_TGT}' => "admin.php?admin_mode=0&referer=$REFERER",
        '{USR_MODE_TITLE}' => $lang_main_menu['usr_mode_title'],
        '{USR_MODE_LNK}' => $lang_main_menu['usr_mode_lnk'],
        '{UPL_PIC_TGT}' => "upload.php",
        '{UPL_PIC_TITLE}' => $lang_main_menu['upload_pic_title'],
        '{UPL_PIC_LNK}' => $lang_main_menu['upload_pic_lnk'],
        '{REGISTER_TGT}' => "register.php",
        '{REGISTER_TITLE}' => $lang_main_menu['register_title'],
        '{REGISTER_LNK}' => $lang_main_menu['register_lnk'],
        '{LOGIN_TGT}' => "login.php?referer=$REFERER",
        '{LOGIN_LNK}' => $lang_main_menu['login_lnk'],
        '{LOGOUT_TGT}' => "logout.php?referer=$REFERER",
        '{LOGOUT_LNK}' => $lang_main_menu['logout_lnk'] . " [" . USER_NAME . "]",
        '{HOME}' => $lang_list_categories['home'],
        );

Unfortunately it yields a blank zero size button, so the peices aren't doing what I think they are doing.  What would have been the correct way to do this?
« Last Edit: November 09, 2004, 07:47:00 am by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de

Edit themes/yourtheme/theme.php, find
Code: [Select]
'{HOME}' => $lang_list_categories['home'],and replace with
Code: [Select]
'{HOME}' => $lang_main_menu['home'],
Edit lang/yourlanguage.php (e.g. lang/english.php) and add a translation for the word home, find
Code: [Select]
// ------------------------------------------------------------------------- //
// File theme.php
// ------------------------------------------------------------------------- //

$lang_main_menu = array(
  'alb_list_title' => 'Go to the album list',
  'alb_list_lnk' => 'Album list',
  'my_gal_title' => 'Go to my personal gallery',
  'my_gal_lnk' => 'My gallery',
  'my_prof_lnk' => 'My profile',
  'adm_mode_title' => 'Switch to admin mode',
  'adm_mode_lnk' => 'Admin mode',
  'usr_mode_title' => 'Switch to user mode',
  'usr_mode_lnk' => 'User mode',
  'upload_pic_title' => 'Upload a file into an album', //cpg1.3.0
  'upload_pic_lnk' => 'Upload file', //cpg1.3.0
  'register_title' => 'Create an account',
  'register_lnk' => 'Register',
  'login_lnk' => 'Login',
  'logout_lnk' => 'Logout',
  'lastup_lnk' => 'Last uploads',
  'lastcom_lnk' => 'Last comments',
  'topn_lnk' => 'Most viewed',
  'toprated_lnk' => 'Top rated',
  'search_lnk' => 'Search',
  'fav_lnk' => 'My Favorites',
  'memberlist_title' => 'Show Memberlist', //cpg1.3.0
  'memberlist_lnk' => 'Memberlist', //cpg1.3.0
  'faq_title' => 'Frequently Asked Questions on the picture gallery &quot;Coppermine&quot;', //cpg1.3.0
  'faq_lnk' => 'FAQ', //cpg1.3.0
);
and replace with
Code: [Select]
// ------------------------------------------------------------------------- //
// File theme.php
// ------------------------------------------------------------------------- //

$lang_main_menu = array(
  'alb_list_title' => 'Go to the album list',
  'alb_list_lnk' => 'Album list',
  'my_gal_title' => 'Go to my personal gallery',
  'my_gal_lnk' => 'My gallery',
  'my_prof_lnk' => 'My profile',
  'adm_mode_title' => 'Switch to admin mode',
  'adm_mode_lnk' => 'Admin mode',
  'usr_mode_title' => 'Switch to user mode',
  'usr_mode_lnk' => 'User mode',
  'upload_pic_title' => 'Upload a file into an album', //cpg1.3.0
  'upload_pic_lnk' => 'Upload file', //cpg1.3.0
  'register_title' => 'Create an account',
  'register_lnk' => 'Register',
  'login_lnk' => 'Login',
  'logout_lnk' => 'Logout',
  'lastup_lnk' => 'Last uploads',
  'lastcom_lnk' => 'Last comments',
  'topn_lnk' => 'Most viewed',
  'toprated_lnk' => 'Top rated',
  'search_lnk' => 'Search',
  'fav_lnk' => 'My Favorites',
  'memberlist_title' => 'Show Memberlist', //cpg1.3.0
  'memberlist_lnk' => 'Memberlist', //cpg1.3.0
  'faq_title' => 'Frequently Asked Questions on the picture gallery &quot;Coppermine&quot;', //cpg1.3.0
  'faq_lnk' => 'FAQ', //cpg1.3.0
  'home' => 'Home', // your custom translation
);

Joachim
Logged

donnoman

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1615
  • From donovanbray.com
    • Donovan Bray

Thanks Joachim, but I was hoping to leverage the fact that "Home" has already been translated.

If I have to have users of my theme edit thier own language file, I might as well just leave it alone, and let them edit it in the theme.php.

Thanks anyway, this is so minor I don't even think I'm going to persue it anymore.
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 20 queries.