summaryrefslogtreecommitdiff
path: root/LedgerSMB/Locale.pm
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-12 20:46:20 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-04-12 20:46:20 +0000
commitdf073d6e09c0f87fb2e88cc215ace843a5851d4a (patch)
tree1c15ce909d3e0353b21bbd909e6720fd485a3a53 /LedgerSMB/Locale.pm
parent65458125b8f3814fd6ef4d07b55ab69f62f5a528 (diff)
Formatting with Perltidy
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/branches/1.2@1068 4979c152-3d1c-0410-bac9-87ea11338e46
Diffstat (limited to 'LedgerSMB/Locale.pm')
-rw-r--r--LedgerSMB/Locale.pm192
1 files changed, 98 insertions, 94 deletions
diff --git a/LedgerSMB/Locale.pm b/LedgerSMB/Locale.pm
index 68710445..c89fbef0 100644
--- a/LedgerSMB/Locale.pm
+++ b/LedgerSMB/Locale.pm
@@ -3,15 +3,15 @@
# Locale support module for LedgerSMB
# LedgerSMB::Locale
#
-# LedgerSMB
+# LedgerSMB
# Small Medium Business Accounting software
# http://www.ledgersmb.org/
-#
+#
#
# Copyright (C) 2006
# This work contains copyrighted information from a number of sources all used
-# with permission. It is released under the GNU General Public License
-# Version 2 or, at your option, any later version. See COPYRIGHT file for
+# with permission. It is released under the GNU General Public License
+# Version 2 or, at your option, any later version. See COPYRIGHT file for
# details.
#
#
@@ -30,17 +30,17 @@ use Locale::Maketext::Lexicon;
use HTML::Entities;
use Encode;
-Locale::Maketext::Lexicon->import({
- '*' => [
- Gettext => "${LedgerSMB::Sysconfig::localepath}/*.po",
- ],
- _auto => 1,
- _decode => 1,
-});
+Locale::Maketext::Lexicon->import(
+ {
+ '*' => [ Gettext => "${LedgerSMB::Sysconfig::localepath}/*.po", ],
+ _auto => 1,
+ _decode => 1,
+ }
+);
sub text {
- my ($self, $text, @params) = @_;
- return encode_entities($self->maketext($text, @params));
+ my ( $self, $text, @params ) = @_;
+ return encode_entities( $self->maketext( $text, @params ) );
}
##sub date {
@@ -48,87 +48,91 @@ sub text {
## return $date;
##}
sub date {
- my ($self, $myconfig, $date, $longformat) = @_;
-
- my @longmonth = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec));
- @longmonth = ("January", "February", "March", "April", "May ", "June",
- "July", "August", "September", "October", "November",
- "December") if $longformat;
- my $longdate = '';
-
- return '' if not $date;
-
- my $spc = '';
- my $yy = '';
- my $mm = '';
- my $dd = '';
-
- # get separator
- $spc = $myconfig->{dateformat};
- $spc =~ s/\w//g;
- $spc = substr($spc, 0, 1);
-
- if (!$longformat && $date =~ /^\d{4}\D/){ # reparsing date at this point
- # causes problems!
- return $date;
- }
- if ($date =~ /\D/) {
-
- if ($myconfig->{dateformat} =~ /^yy/) {
- ($yy, $mm, $dd) = split /\D/, $date;
- }
-
- if ($myconfig->{dateformat} =~ /^mm/) {
- ($mm, $dd, $yy) = split /\D/, $date;
- }
-
- if ($myconfig->{dateformat} =~ /^dd/) {
- ($dd, $mm, $yy) = split /\D/, $date;
- }
-
- } else {
-
- $date = substr($date, 2);
- ($yy, $mm, $dd) = ($date =~ /(..)(..)(..)/);
- }
-
- $dd *= 1;
- $mm--;
- $yy += 2000 if length $yy == 2;
-
- if ($myconfig->{dateformat} =~ /^dd/) {
-
- $mm++;
- $dd = substr("0$dd", -2);
- $mm = substr("0$mm", -2);
- $longdate = "$dd$spc$mm$spc$yy";
-
- if (defined $longformat) {
- $longdate = "$dd";
- $longdate .= ($spc eq '.') ? ". " : " ";
- $longdate .= &text($self, $longmonth[--$mm])." $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;
+ my ( $self, $myconfig, $date, $longformat ) = @_;
+
+ my @longmonth = (qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec));
+ @longmonth = (
+ "January", "February", "March", "April",
+ "May ", "June", "July", "August",
+ "September", "October", "November", "December"
+ ) if $longformat;
+ my $longdate = '';
+
+ return '' if not $date;
+
+ my $spc = '';
+ my $yy = '';
+ my $mm = '';
+ my $dd = '';
+
+ # get separator
+ $spc = $myconfig->{dateformat};
+ $spc =~ s/\w//g;
+ $spc = substr( $spc, 0, 1 );
+
+ if ( !$longformat && $date =~ /^\d{4}\D/ ) { # reparsing date at this point
+ # causes problems!
+ return $date;
+ }
+ if ( $date =~ /\D/ ) {
+
+ if ( $myconfig->{dateformat} =~ /^yy/ ) {
+ ( $yy, $mm, $dd ) = split /\D/, $date;
+ }
+
+ if ( $myconfig->{dateformat} =~ /^mm/ ) {
+ ( $mm, $dd, $yy ) = split /\D/, $date;
+ }
+
+ if ( $myconfig->{dateformat} =~ /^dd/ ) {
+ ( $dd, $mm, $yy ) = split /\D/, $date;
+ }
+
+ }
+ else {
+
+ $date = substr( $date, 2 );
+ ( $yy, $mm, $dd ) = ( $date =~ /(..)(..)(..)/ );
+ }
+
+ $dd *= 1;
+ $mm--;
+ $yy += 2000 if length $yy == 2;
+
+ if ( $myconfig->{dateformat} =~ /^dd/ ) {
+
+ $mm++;
+ $dd = substr( "0$dd", -2 );
+ $mm = substr( "0$mm", -2 );
+ $longdate = "$dd$spc$mm$spc$yy";
+
+ if ( defined $longformat ) {
+ $longdate = "$dd";
+ $longdate .= ( $spc eq '.' ) ? ". " : " ";
+ $longdate .= &text( $self, $longmonth[ --$mm ] ) . " $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;
}
1;