How can I add my own translated menu How can I add my own translated menu
 

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

How can I add my own translated menu

Started by meloniq, June 30, 2005, 12:13:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

meloniq

How can I add my own translated menu?

I add to template.html line
<td bgcolor="#63533A" align="center" width="776">{CASTLE_PARTY_MENU}</td>

to theme.php
function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
    user_save_profile();

    $template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . $section,
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{MAIN_MENU}' => theme_main_menu(),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CASTLE_PARTY_MENU}' => $template_castle_party_menu
        );

and also
// HTML template for castle party menu
$template_castle_party_menu = <<<EOT
          :: <a href="http://castleparty.com/cp2005.php" class="menu_linki">{CASTLE_PARTY_CPROK}</a>
          :: <a href="http://castleparty.com/news.php" class="menu_linki">{CASTLE_PARTY_NEWS}</a>
          :: <a href="http://castleparty.com/history.php" class="menu_linki">{CASTLE_PARTY_HISTORIA}</a>
          :: <a href="http://castleparty.com/castle.php" class="menu_linki">{CASTLE_PARTY_ZAMEK}</a>
          :: <a href="http://castleparty.com/arrive.php" class="menu_linki">{CASTLE_PARTY_DOJAZD}</a>
          :: <a href="http://castleparty.com/concerts.php" class="menu_linki">{CASTLE_PARTY_KONCERTY}</a>
          :: <a href="http://castleparty.com/compilations.php" class="menu_linki">{CASTLE_PARTY_SKLADANKI}</a>
          :: <a href="http://castleparty.com/whoandwhen.php" class="menu_linki">{CASTLE_PARTY_KTOIKIEDY}</a> ::<br>
          :: <a href="http://castleparty.com/tickets.php" class="menu_linki">{CASTLE_PARTY_BILETY}</a>
          :: <a href="http://castleparty.com/accomodation.php" class="menu_linki">{CASTLE_PARTY_NOCLEGI}</a>
          :: <a href="http://castleparty.com/forum/" class="menu_linki">{CASTLE_PARTY_FORUM}</a>
          :: <a href="http://castleparty.com/gallery.php" class="menu_linki">{CASTLE_PARTY_GALERIA}</a>
          :: <a href="http://goth.int.pl/gallery/" class="menu_linki">{CASTLE_PARTY_GALERIEFANOW}</a>
          :: <a href="http://castleparty.com/video.php" class="menu_linki">{CASTLE_PARTY_VIDEO}</a>
          :: <a href="http://castleparty.com/bands.php" class="menu_linki">{CASTLE_PARTY_ZESPOLY}</a>
          :: <a href="http://castleparty.com/links.php" class="menu_linki">{CASTLE_PARTY_LINKI}</a>
          :: <a href="http://castleparty.com/contact.php" class="menu_linki">{CASTLE_PARTY_KONTAKT}</a> ::
EOT;


I add to polish.php
$lang_castle_party_menu = array(
  'castle_party_cprok' => 'Castle Party 2005',
  'castle_party_news' => 'news',
  'castle_party_historia' => 'historia',
  'castle_party_zamek' => 'zamek',
  'castle_party_dojazd' => 'dojazd',
  'castle_party_koncerty' => 'koncerty',
  'castle_party_skladanki' => 'składanki',
  'castle_party_ktoikiedy' => 'kto i kiedy',
  'castle_party_bilety' => 'bilety',
  'castle_party_noclegi' => 'noclegi',
  'castle_party_forum' => 'forum',
  'castle_party_galeria' => 'galeria',
  'castle_party_galeriefanow' => 'galerie fanów',
  'castle_party_video' => 'video',
  'castle_party_zespoly' => 'zespoły',
  'castle_party_linki' => 'linki',
  'castle_party_kontakt' => 'kontakt',
);

and also to english.php
$lang_castle_party_menu = array(
  'castle_party_cprok' => 'Castle Party 2005',
  'castle_party_news' => 'news',
  'castle_party_historia' => 'history',
  'castle_party_zamek' => 'castle',
  'castle_party_dojazd' => 'arrival',
  'castle_party_koncerty' => 'concerts',
  'castle_party_skladanki' => 'compilations',
  'castle_party_ktoikiedy' => 'who and when',
  'castle_party_bilety' => 'tickets',
  'castle_party_noclegi' => 'accomodation',
  'castle_party_forum' => 'forum',
  'castle_party_galeria' => 'gallery',
  'castle_party_galeriefanow' => 'fans gallery',
  'castle_party_video' => 'video',
  'castle_party_zespoly' => 'bands',
  'castle_party_linki' => 'links',
  'castle_party_kontakt' => 'contact',
);


So, what I have to change yet / to add ?

How to make to thin links changed also? (from "cp2005.php?lang=pl" to "cp2005.php?lang=en")

I greet
and I thank for every help ;]
meloniq

meloniq

Nobody helped me, but I made this menu :D
If question did not stay without answer, I put solution below:

Step 1: I add to template.html
<td bgcolor="#63533A" align="center" width="776">{CASTLE_PARTY_MENU}</td>

Step 2: I added in theme.php my line
function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir;

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
    user_save_profile();

    $template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . $section,
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{MAIN_MENU}' => theme_main_menu(),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CASTLE_PARTY_MENU}' => theme_castle_party_menu(),
        );

    echo template_eval($template_header, $template_vars);
}


Step 3: make own function (in theme.php)
function theme_castle_party_menu()
{

    global $lang_castle_party_menu, $template_castle_party_menu;

    static $castle_party_menu = '';

    if ($castle_party_menu != '') return $castle_party_menu;

    $param = array(
        '{CASTLE_PARTY_CPROK}' => $lang_castle_party_menu['castle_party_cprok'],
        '{CASTLE_PARTY_NEWS}' => $lang_castle_party_menu['castle_party_news'],
        '{CASTLE_PARTY_HISTORIA}' => $lang_castle_party_menu['castle_party_historia'],
        '{CASTLE_PARTY_ZAMEK}' => $lang_castle_party_menu['castle_party_zamek'],
        '{CASTLE_PARTY_DOJAZD}' => $lang_castle_party_menu['castle_party_dojazd'],
        '{CASTLE_PARTY_KONCERTY}' => $lang_castle_party_menu['castle_party_koncerty'],
        '{CASTLE_PARTY_SKLADANKI}' => $lang_castle_party_menu['castle_party_skladanki'],
        '{CASTLE_PARTY_KTOIKIEDY}' => $lang_castle_party_menu['castle_party_ktoikiedy'],
        '{CASTLE_PARTY_BILETY}' => $lang_castle_party_menu['castle_party_bilety'],
        '{CASTLE_PARTY_NOCLEGI}' => $lang_castle_party_menu['castle_party_noclegi'],
        '{CASTLE_PARTY_FORUM}' => $lang_castle_party_menu['castle_party_forum'],
        '{CASTLE_PARTY_GALERIA}' => $lang_castle_party_menu['castle_party_galeria'],
        '{CASTLE_PARTY_GALERIEFANOW}' => $lang_castle_party_menu['castle_party_galeriefanow'],
        '{CASTLE_PARTY_VIDEO}' => $lang_castle_party_menu['castle_party_video'],
        '{CASTLE_PARTY_ZESPOLY}' => $lang_castle_party_menu['castle_party_zespoly'],
        '{CASTLE_PARTY_LINKI}' => $lang_castle_party_menu['castle_party_linki'],
        '{CASTLE_PARTY_KONTAKT}' => $lang_castle_party_menu['castle_party_kontakt'],
        '{CASTLE_PARTY_LANG}' => $lang_castle_party_menu['castle_party_lang'],
        '{CASTLE_PARTY_LANGFG}' => $lang_castle_party_menu['castle_party_langfg'],
        );

   $castle_party_menu = template_eval($template_castle_party_menu, $param);
    return $castle_party_menu;
}


Step 4: make menu (also in theme.php)
// HTML template for castle party menu
$template_castle_party_menu = <<<EOT
          :: <a href="http://castleparty.com/cp2005.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_CPROK}</a>
          :: <a href="http://castleparty.com/news.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_NEWS}</a>
          :: <a href="http://castleparty.com/history.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_HISTORIA}</a>
          :: <a href="http://castleparty.com/castle.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_ZAMEK}</a>
          :: <a href="http://castleparty.com/arrive.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_DOJAZD}</a>
          :: <a href="http://castleparty.com/concerts.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_KONCERTY}</a>
          :: <a href="http://castleparty.com/compilations.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_SKLADANKI}</a>
          :: <a href="http://castleparty.com/whoandwhen.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_KTOIKIEDY}</a> ::<br>
          :: <a href="http://castleparty.com/tickets.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_BILETY}</a>
          :: <a href="http://castleparty.com/accomodation.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_NOCLEGI}</a>
          :: <a href="http://castleparty.com/forum/{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_FORUM}</a>
          :: <a href="http://castleparty.com/gallery.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_GALERIA}</a>
          :: <a href="http://goth.int.pl/gallery/{CASTLE_PARTY_LANGFG}" class="menu_linki">{CASTLE_PARTY_GALERIEFANOW}</a>
          :: <a href="http://castleparty.com/video.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_VIDEO}</a>
          :: <a href="http://castleparty.com/bands.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_ZESPOLY}</a>
          :: <a href="http://castleparty.com/links.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_LINKI}</a>
          :: <a href="http://castleparty.com/contact.php{CASTLE_PARTY_LANG}" class="menu_linki">{CASTLE_PARTY_KONTAKT}</a> ::
EOT;


Step 5: make translation (e.g. lang/english.php - in my case polish.php, english.php and german.php)
$lang_castle_party_menu = array(
  'castle_party_cprok' => 'Castle Party 2005',
  'castle_party_news' => 'news',
  'castle_party_historia' => 'history',
  'castle_party_zamek' => 'castle',
  'castle_party_dojazd' => 'arrival',
  'castle_party_koncerty' => 'concerts',
  'castle_party_skladanki' => 'compilations',
  'castle_party_ktoikiedy' => 'who and when',
  'castle_party_bilety' => 'tickets',
  'castle_party_noclegi' => 'accomodation',
  'castle_party_forum' => 'forum',
  'castle_party_galeria' => 'gallery',
  'castle_party_galeriefanow' => 'fans gallery',
  'castle_party_video' => 'video',
  'castle_party_zespoly' => 'bands',
  'castle_party_linki' => 'links',
  'castle_party_kontakt' => 'contact',
  'castle_party_lang' => '?lang=en',
  'castle_party_langfg' => '?lang=english',
);


and this already all ;)
maybe this guide someone will was be useful...

I greet
meloniq