summaryrefslogtreecommitdiff
path: root/rt/lib/RT/I18N
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2015-07-10 18:15:08 -0700
committerMark Wells <mark@freeside.biz>2015-07-10 18:15:08 -0700
commit88bf5db0cca989c51237c661a13078eef08b3674 (patch)
tree0a84e1b5e7fd239f57fab678bf40c5311b0064a0 /rt/lib/RT/I18N
parent9c15ffe3a5ee987e30e10c6a0ad1b5bf0b2a12e3 (diff)
parente7eb845db1afab1cbdbc34ff9c387c5ac554659e (diff)
Merge branch 'FREESIDE_4_BRANCH' of git.freeside.biz:/home/git/freeside into 4.x
Diffstat (limited to 'rt/lib/RT/I18N')
-rw-r--r--rt/lib/RT/I18N/cs.pm42
-rw-r--r--rt/lib/RT/I18N/de.pm2
-rw-r--r--rt/lib/RT/I18N/fr.pm12
-rw-r--r--rt/lib/RT/I18N/i_default.pm2
-rwxr-xr-xrt/lib/RT/I18N/ru.pm6
5 files changed, 21 insertions, 43 deletions
diff --git a/rt/lib/RT/I18N/cs.pm b/rt/lib/RT/I18N/cs.pm
index 30da114d0..59057d3ae 100644
--- a/rt/lib/RT/I18N/cs.pm
+++ b/rt/lib/RT/I18N/cs.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -81,43 +81,21 @@ sub quant {
# Normal case:
# Note that the formatting of $num is preserved.
- #return( $handle->numf($num) . ' ' . $handle->numerate($num, @forms) );
- return( $handle->numerate($num, @forms) );
- # Most human languages put the number phrase before the qualified phrase.
+ return( $handle->numf($num) . ' ' . $handle->numerate($num, @forms) );
}
sub numerate {
- # return this lexical item in a form appropriate to this number
- my($handle, $num, @forms) = @_;
- my $s = ($num == 1);
-
- return '' unless @forms;
- return
- $s ? $forms[0] :
- ( $num > 1 && $num < 5 ) ? $forms[1] :
- $forms[2];
-}
-
-#--------------------------------------------------------------------------
+ # return this lexical item in a form appropriate to this number
+ my($handle, $num, @forms) = @_;
-sub numf {
- my($handle, $num) = @_[0,1];
- if($num < 10_000_000_000 and $num > -10_000_000_000 and $num == int($num)) {
- $num += 0; # Just use normal integer stringification.
- # Specifically, don't let %G turn ten million into 1E+007
- } else {
- $num = CORE::sprintf("%G", $num);
- # "CORE::" is there to avoid confusion with the above sub sprintf.
- }
- while( $num =~ s/^([-+]?\d+)(\d{3})/$1,$2/s ) {1} # right from perlfaq5
- # The initial \d+ gobbles as many digits as it can, and then we
- # backtrack so it un-eats the rightmost three, and then we
- # insert the comma there.
+ return '' unless @forms;
- $num =~ tr<.,><,.> if ref($handle) and $handle->{'numf_comma'};
- # This is just a lame hack instead of using Number::Format
- return $num;
+ my $fallback = (grep defined, @forms)[0];
+ return $forms[0] // $fallback if $num == 1;
+ return $forms[1] // $fallback
+ if $num > 1 and $num < 5;
+ return $forms[2] // $fallback;
}
RT::Base->_ImportOverlays();
diff --git a/rt/lib/RT/I18N/de.pm b/rt/lib/RT/I18N/de.pm
index 3a40a7f9e..65238151d 100644
--- a/rt/lib/RT/I18N/de.pm
+++ b/rt/lib/RT/I18N/de.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
diff --git a/rt/lib/RT/I18N/fr.pm b/rt/lib/RT/I18N/fr.pm
index 904b84199..cd1273d7a 100644
--- a/rt/lib/RT/I18N/fr.pm
+++ b/rt/lib/RT/I18N/fr.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -56,11 +56,11 @@ use strict;
use warnings;
sub numf {
- my ($handle, $num) = @_[0,1];
- my $fr_num = $handle->SUPER::numf($num);
- # French prefer to print 1000 as 1(nbsp)000 rather than 1,000
- $fr_num =~ tr<.,><,\x{A0}>;
- return $fr_num;
+ my ($handle, $num) = @_[0,1];
+ my $fr_num = $handle->SUPER::numf($num);
+ # French prefer to print 1000 as 1(nbsp)000 rather than 1,000
+ $fr_num =~ tr<.,><,\x{A0}>;
+ return $fr_num;
}
RT::Base->_ImportOverlays();
diff --git a/rt/lib/RT/I18N/i_default.pm b/rt/lib/RT/I18N/i_default.pm
index 316f51a64..a8d1acec8 100644
--- a/rt/lib/RT/I18N/i_default.pm
+++ b/rt/lib/RT/I18N/i_default.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
diff --git a/rt/lib/RT/I18N/ru.pm b/rt/lib/RT/I18N/ru.pm
index 5b34d777a..c77e864e1 100755
--- a/rt/lib/RT/I18N/ru.pm
+++ b/rt/lib/RT/I18N/ru.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
# <sales@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -61,7 +61,7 @@ sub quant {
return $num unless @forms;
return $forms[3] if !$num && $forms[3];
- return $num .' '. $handle->numerate($num, @forms);
+ return $handle->numf($num) .' '. $handle->numerate($num, @forms);
}
sub numerate {
@@ -75,7 +75,7 @@ sub numerate {
} else {
$form = 2;
}
- return $forms[$form];
+ return $forms[$form] || (grep defined, @forms)[0];
}
RT::Base->_ImportOverlays();