From 138412133fb53b5419640311bbd5f253d7407373 Mon Sep 17 00:00:00 2001 From: tetragon Date: Fri, 15 Jun 2007 16:09:28 +0000 Subject: Minor refactoring to &date git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1280 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/Locale.pm | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'LedgerSMB/Locale.pm') diff --git a/LedgerSMB/Locale.pm b/LedgerSMB/Locale.pm index 80b3446f..0a38961e 100644 --- a/LedgerSMB/Locale.pm +++ b/LedgerSMB/Locale.pm @@ -16,7 +16,7 @@ Locale support module for LedgerSMB. Uses Locale::Maketext::Lexicon as a base. Returns a locale handle for accessing the other methods. Inherited from Locale::Maketext. -=item text ($string) +=item text ($string, @params) Returns the translation for the given string. This is a legacy wrapper that merely calls $self->maketext. @@ -136,41 +136,27 @@ sub date { } else { - $date = substr( $date, 2 ); ( $yy, $mm, $dd ) = ( $date =~ /(..)(..)(..)/ ); } $dd *= 1; - $mm--; $yy += 2000 if length $yy == 2; + $dd = substr( "0$dd", -2 ); + $mm = substr( "0$mm", -2 ); if ( $myconfig->{dateformat} =~ /^dd/ ) { - - $mm++; - $dd = substr( "0$dd", -2 ); - $mm = substr( "0$mm", -2 ); $longdate = "$dd$spc$mm$spc$yy"; - } elsif ( $myconfig->{dateformat} =~ /^yy/ ) { - - $mm++; - $dd = substr( "0$dd", -2 ); - $mm = substr( "0$mm", -2 ); $longdate = "$yy$spc$mm$spc$dd"; - } else { - - $mm++; - $dd = substr( "0$dd", -2 ); - $mm = substr( "0$mm", -2 ); $longdate = "$mm$spc$dd$spc$yy"; - } + if ( defined $longformat ) { - $longdate = &text( $self, $longmonth[ --$mm ] ) . " $dd $yy"; + $longdate = $self->text( $longmonth[ --$mm ] ) . " $dd $yy"; } $longdate; } -- cgit v1.2.3