[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[6191] addons/1.3/wxPOS



Revision: 6191
          http://sourceforge.net/p/ledger-smb/code/6191
Author:   einhverfr
Date:     2013-10-28 08:16:04 +0000 (Mon, 28 Oct 2013)
Log Message:
-----------
Adding locale classes for POS

Modified Paths:
--------------
    addons/1.3/wxPOS/scripts/Console.pm

Added Paths:
-----------
    addons/1.3/wxPOS/locale/
    addons/1.3/wxPOS/scripts/LedgerSMB/
    addons/1.3/wxPOS/scripts/LedgerSMB/Locale.pm

Modified: addons/1.3/wxPOS/scripts/Console.pm
===================================================================
--- addons/1.3/wxPOS/scripts/Console.pm	2013-10-28 08:04:40 UTC (rev 6190)
+++ addons/1.3/wxPOS/scripts/Console.pm	2013-10-28 08:16:04 UTC (rev 6191)
@@ -47,7 +47,6 @@
 package Console;
 
 use base qw(Wx::Frame);
-use Wx::Event;
 use Wx::Menu;
 use Wx qw(wxDefaultPosition wxDefaultSize wxDEFAULT_FRAME_STYLE wxNO_FULL_REPAINT_ON_RESIZE wxCLIP_CHILDREN wxBITMAP_TYPE_PNG wxMAXIMIZE);
 use Wx::Event qw(EVT_TREE_SEL_CHANGED EVT_CLOSE EVT_IDLE EVT_MENU EVT_KEY_DOWN);
@@ -76,7 +75,6 @@
 
  $WXPOS::State::Notebook = $self->{sesion}->{nb};
 
-EVT_KEY_DOWN($self, \&_process_char);
 #
 ###
 
@@ -136,6 +134,7 @@
  my $tab = $module->new($self->{sesion}, $action);
  $self->{sesion}->{nb}->AddPage($tab, $action, 1);
  $tab->Show();
+ EVT_KEY_DOWN($tab, sub {$self->_process_char});
  return $self;
 }
 

Copied: addons/1.3/wxPOS/scripts/LedgerSMB/Locale.pm (from rev 6179, branches/1.3/LedgerSMB/Locale.pm)
===================================================================
--- addons/1.3/wxPOS/scripts/LedgerSMB/Locale.pm	                        (rev 0)
+++ addons/1.3/wxPOS/scripts/LedgerSMB/Locale.pm	2013-10-28 08:16:04 UTC (rev 6191)
@@ -0,0 +1,167 @@
+
+=head1 NAME
+
+LedgerSMB::Locale - Locale handling class for LedgerSMB
+
+=head1 SYNOPSIS
+
+Locale support module for LedgerSMB.  Uses Locale::Maketext::Lexicon as a base.
+
+=head1 METHODS
+
+=over
+
+=item get_handle ($language_code)
+
+Returns a locale handle for accessing the other methods.  Inherited from 
+Locale::Maketext.
+
+=item text ($string, @params)
+
+Returns the translation for the given string.  This is a legacy wrapper that
+merely calls $self->maketext.
+
+=item date ($myconfig, $date, $longformat)
+
+Returns the given date after formatting it.  $longformat is a ternary flag that
+determines how the date is formatted.  If $longformat is true, the date will be
+given in the form of "_('September') 23 2007".  If $longformat is false but
+defined, the date will be in the form of "_('Sep') 23 2007" unless the date is
+given in the form 'yyyy.mm.dd', in which case it is returned as-is.  If
+$longformat is not defined, the date will be output in the format specified by
+$myconfig->{dateformat}.
+
+=back
+
+=head1 Copyright (C) 2006, The LedgerSMB core team.
+
+ #====================================================================
+ #
+ # Locale support module for LedgerSMB
+ # LedgerSMB::Locale
+ #
+ # 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 details.
+ #
+ # This file contains source code included with or based on SQL-Ledger
+ # which is Copyright Dieter Simader and DWS Systems Inc. 2000-2005
+ # and licensed under the GNU General Public License version 2 or, at
+ # your option, any later version.  For a full list including contact
+ # information of contributors, maintainers, and copyright holders,
+ # see the CONTRIBUTORS file.
+ #
+ # Original Copyright Notice from SQL-Ledger 2.6.17 (before the fork):
+ # Copyright (C) 2000
+ #
+ #  Author: DWS Systems Inc.
+ #     Web: http://www.sql-ledger.org
+ #
+ # Contributors: Thomas Bayen <..hidden..>
+ #               Antti Kaihola <..hidden..>
+ #               Moritz Bunkus (tex)
+ #               Jim Rawlings <..hidden..> (DB2)
+ #
+ #====================================================================
+=cut
+
+package LedgerSMB::Locale;
+
+use base 'Locale::Maketext';
+use Locale::Maketext::Lexicon;
+use Encode;
+
+
+Locale::Maketext::Lexicon->import(
+    {
+        '*'     => [ Gettext => "${LedgerSMB::Sysconfig::localepath}/*.po", ],
+        _auto   => 1,
+        _decode => 1,
+    }
+);
+
+sub text {
+    my ( $self, $text, @params ) = @_;
+    return $self->maketext( $text, @params );
+}
+
+##sub date {
+##	my ($self, $myconfig, $date, $longformat) = @_;
+##	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 ($date  =~ /^\d{4}/){ # db date in
+            ( $yy, $mm, $dd ) = split /\D/, $date;
+        }
+        elsif ( $myconfig->{dateformat} =~ /^yy/ ) {
+            ( $yy, $mm, $dd ) = split /\D/, $date;
+        }
+        elsif ( $myconfig->{dateformat} =~ /^mm/ ) {
+            ( $mm, $dd, $yy ) = split /\D/, $date;
+        }
+        elsif ( $myconfig->{dateformat} =~ /^dd/ ) {
+            ( $dd, $mm, $yy ) = split /\D/, $date;
+        }
+
+    }
+    else {
+        $date = substr( $date, 2 );
+        ( $yy, $mm, $dd ) = ( $date =~ /(..)(..)(..)/ );
+    }
+
+    $dd *= 1;
+    $yy += 2000 if length $yy == 2;
+    $dd = substr( "0$dd", -2 );
+    $mm = substr( "0$mm", -2 );
+
+    if ( $myconfig->{dateformat} =~ /^dd/ ) {
+        $longdate = "$dd$spc$mm$spc$yy";
+    }
+    elsif ( $myconfig->{dateformat} =~ /^yy/ ) {
+        $longdate = "$yy$spc$mm$spc$dd";
+    }
+    else {
+        $longdate = "$mm$spc$dd$spc$yy";
+    }
+
+    if ( defined $longformat ) {
+        $longdate = $self->text( $longmonth[ --$mm ] ) . " $dd $yy";
+    }
+    $longdate;
+}
+
+1;
+

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits