From c836425c17caf9f22601088f6133526d01990f9d Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 7 Sep 2007 08:58:49 +0000 Subject: [PATCH] =?utf8?q?$locale->text()=20so=20erweitert,=20dass=20weite?= =?utf8?q?re=20Argumente=20direkt=20an=20Form::format=5Fstring()=20=C3=BCb?= =?utf8?q?ergeben=20werden.=20Damit=20muss=20man=20nicht=20mehr=20$form->f?= =?utf8?q?ormat=5Fstring($locale->text("#1=20and=20#2"),=20$arg1,=20$arg2)?= =?utf8?q?=20schreiben,=20sondern=20kann=20direkt=20$locale->text("#1=20an?= =?utf8?q?d=20#2",=20$arg1,=20$arg2)=20schreiben.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Locale.pm | 13 ++++++++++--- locale/de/locales.pl | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/SL/Locale.pm b/SL/Locale.pm index a6756fefe..5454e74c5 100644 --- a/SL/Locale.pm +++ b/SL/Locale.pm @@ -91,13 +91,20 @@ sub new { } sub text { - my ($self, $text) = @_; + my $self = shift; + my $text = shift; if (exists $self->{texts}->{$text}) { - return $self->{iconv}->convert($self->{texts}->{$text}); + $text = $self->{iconv}->convert($self->{texts}->{$text}); + } else { + $text = $self->{iconv_english}->convert($text); } - return $self->{iconv_english}->convert($text); + if (@_) { + $text = Form->format_string($text, @_); + } + + return $text; } sub findsub { diff --git a/locale/de/locales.pl b/locale/de/locales.pl index 5bf561091..70ca6d20e 100755 --- a/locale/de/locales.pl +++ b/locale/de/locales.pl @@ -277,7 +277,7 @@ sub extract_text_between_parenthesis { } elsif (($cur_char eq '"') || ($cur_char eq '\'')) { $inside_string = $cur_char; - } elsif ($cur_char eq ")") { + } elsif (($cur_char eq ")") || ($cur_char eq ',')) { return ($text, substr($line, $pos + 1)); } -- 2.20.1