1) partialy undoing gugux changes (label use '%s' if they want to place the widget within the label!)

2) useing a regular lang()-call with parameters instead of a message array, which got translated by the constructor
This commit is contained in:
Ralf Becker 2003-08-08 16:29:34 +00:00
parent 01f9a86272
commit cd1025f9cf

View File

@ -17,12 +17,6 @@
class et_media extends so_sql class et_media extends so_sql
{ {
var $messages = array(
'nothing_found' => 'Nothing matched search criteria !!!',
'anz_found' => '%1 matches on search criteria',
'saved' => 'Entry saved',
'error_writeing' => 'Error: writeing !!!'
);
var $types = array( var $types = array(
'' => 'Select one ...', '' => 'Select one ...',
'cd' => 'Compact Disc', 'cd' => 'Compact Disc',
@ -31,7 +25,7 @@
'video' => 'Video Tape' 'video' => 'Video Tape'
); );
function et_media($lang_on_messages = True) function et_media()
{ {
$this->tmpl = CreateObject('etemplate.etemplate','et_media.edit'); $this->tmpl = CreateObject('etemplate.etemplate','et_media.edit');
@ -42,13 +36,6 @@
'edit' => True, 'edit' => True,
'writeLangFile' => True 'writeLangFile' => True
); );
if ($lang_on_messages)
{
reset($this->messages);
while (list($key,$msg) = each($this->messages))
$this->messages[$key] = lang($msg);
}
} }
function edit($content='',$msg = '') function edit($content='',$msg = '')
@ -65,7 +52,7 @@
if (isset($content['save'])) if (isset($content['save']))
{ {
$msg .= $this->messages[!$this->save() ? 'saved' : 'error_writeing']; $msg .= !$this->save() ? lang('Entry saved') : lang('Error: writeing !!!');
} }
elseif (isset($content['read'])) elseif (isset($content['read']))
{ {
@ -74,7 +61,7 @@
if (!$found) if (!$found)
{ {
$msg .= $this->messages['nothing_found']; $msg .= lang('Nothing matched search criteria !!!');
} }
elseif (count($found) == 1) elseif (count($found) == 1)
{ {
@ -134,7 +121,7 @@
$entry[$row] = $data; $entry[$row] = $data;
} }
$content = array( $content = array(
'msg' => sprintf($this->messages['anz_found'],count($found)), 'msg' => lang('%1 matches on search criteria',count($found)),
'entry' => $entry 'entry' => $entry
); );
$this->tmpl->read('et_media.show'); $this->tmpl->read('et_media.show');
@ -144,15 +131,13 @@
/*! /*!
@function writeLangFile @function writeLangFile
@abstract writes langfile with all templates and messages registered here @abstract writes langfile with all templates and types here
@discussion can be called via [write Langfile] in the eTemplate editor or @discussion can be called via [write Langfile] in the eTemplate editor or
@discussion http://domain/phpgroupware/index.php?et_media.et_media.writeLangFile @discussion http://domain/phpgroupware/index.php?et_media.et_media.writeLangFile
*/ */
function writeLangFile() function writeLangFile()
{ {
$etm = new et_media(False); // no lang on messages return $this->tmpl->writeLangFile('et_media','en',$this->types);
return $this->tmpl->writeLangFile('et_media','en',$etm->messages+$etm->types);
} }
}; };