[dokuwiki] Re: How to show button with dynamic label ?

  • From: Werner Flamme <werner.flamme@xxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 16 May 2006 10:17:44 +0200

Oliver Geisen schrieb:

Hello,

i'd like to use "html_btn()" to display a button with variable/dynamic label. So there can't be a translation for it. For now this seems impossible because buttons need to be translated, at least in english, or they won't contain anything in the label.

The cause for this behaveour is the line:

  $label = $lang['btn_'.$name];

in inc/html.php. If nothing exist, $label is NULL. I can only solve my problem by changeing this code, but this breaks further upgrades.

What can i do ?


Oliver Geisen _____________________________ Systemadministrator Kreisboten Verlag Mühlfellner KG 82362 Weilheim i. Ob. Tel. 0881/686-904 Fax 0881/686-74


--DokuWiki mailing list - more info at http://wiki.splitbrain.org/wiki:mailinglist



Oliver,

you may define an array $defaultbuttonlabel that will contain all the labels you like ;-)

Then you can write:
  $label = $lang['btn_'.$name];
  if ( strlen($label) == 0)
    $label = $defaultbuttonlabel['btn_'.$name];

Of course you may use a 2dimensional array, so you can write
    $label = $defaultbuttonlabel[$mylanguage]['btn_'.$name];
where $mylanguage is e.g. 'en' or 'de'.

HTH,
Werner


-- DokuWiki mailing list - more info at http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: