From b6c37e376ec8b5dec4bcec1a6924ea6a1349c182 Mon Sep 17 00:00:00 2001 From: acli Date: Fri, 20 Feb 2004 04:38:02 +0000 Subject: [PATCH] Support %0.0s notation so that we can omit the %s as in Year%s for the Chinese translation. (This won't work for all languages; ultimately the English templates must be fixed.) --- misc/translator/TmplTokenizer.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/misc/translator/TmplTokenizer.pm b/misc/translator/TmplTokenizer.pm index 7b2fece1bf..384dfb2604 100644 --- a/misc/translator/TmplTokenizer.pm +++ b/misc/translator/TmplTokenizer.pm @@ -545,11 +545,17 @@ sub parametrize ($@) { } elsif ($fmt =~ /^%%/) { $fmt = $'; $it .= '%'; - } elsif ($fmt =~ /^%(?:(\d+)\$)?s/) { + } elsif ($fmt =~ /^%(?:(\d+)\$)?(?:(\d+)(?:\.(\d+))?)?s/) { $n += 1; - my $i = (defined $1? $1: $n) - 1; + my($i, $width, $prec) = ((defined $1? $1: $n), $2, $3); $fmt = $'; - $it .= $params[$i] + if (!defined $width && !defined $prec) { + $it .= $params[$i] + } elsif (defined $width && defined $prec && !$width && !$prec) { + ; + } else { + die "Unsupported precision specification in format: $&\n"; #XXX + } } elsif ($fmt =~ /^%[^%a-zA-Z]*[a-zA-Z]/) { $fmt = $'; $it .= $&; -- 2.20.1