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

SF.net SVN: ledger-smb:[4966] trunk



Revision: 4966
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4966&view=rev
Author:   einhverfr
Date:     2012-07-11 08:30:35 +0000 (Wed, 11 Jul 2012)
Log Message:
-----------
Locale issues in trunk resolved

Modified Paths:
--------------
    trunk/LedgerSMB/Locale.pm
    trunk/LedgerSMB/Sysconfig.pm
    trunk/LedgerSMB.pm
    trunk/lsmb-request.pl

Modified: trunk/LedgerSMB/Locale.pm
===================================================================
--- trunk/LedgerSMB/Locale.pm	2012-07-11 02:45:57 UTC (rev 4965)
+++ trunk/LedgerSMB/Locale.pm	2012-07-11 08:30:35 UTC (rev 4966)
@@ -74,12 +74,11 @@
 
 package LedgerSMB::Locale;
 
-use LedgerSMB::Sysconfig;
 use base 'Locale::Maketext';
+use LedgerSMB::Sysconfig;
 use Locale::Maketext::Lexicon;
 use Encode;
 
-
 Locale::Maketext::Lexicon->import(
     {
         '*'     => [ Gettext => "${LedgerSMB::Sysconfig::localepath}/*.po", ],

Modified: trunk/LedgerSMB/Sysconfig.pm
===================================================================
--- trunk/LedgerSMB/Sysconfig.pm	2012-07-11 02:45:57 UTC (rev 4965)
+++ trunk/LedgerSMB/Sysconfig.pm	2012-07-11 08:30:35 UTC (rev 4966)
@@ -45,7 +45,7 @@
 );
 
 # if you have latex installed set to 1
-our $latex = eval {require LedgerSMB::Template::LaTeX}; 
+our $latex = eval {require Template::Plugin::Latex}; 
 
 # Defaults to 1 megabyte
 our $max_post_size = 1024 * 1024;
@@ -143,8 +143,6 @@
 my $modules_loglevel_overrides='';
 
 for (sort $cfg->Parameters('log4perl_config_modules_loglevel')){
-  print STDERR "Sysconfig key=$_ value=" . 
-        $cfg->val('log4perl_config_modules_loglevel', $_) ."\n";
   $modules_loglevel_overrides.='log4perl.logger.'.$_.'='.
         $cfg->val('log4perl_config_modules_loglevel', $_)."\n";
 }
@@ -212,6 +210,6 @@
          $rc=system("mkdir -p $tempdir");#TODO what if error?
      #$logger->info("created tempdir \$tempdir rc=\$rc"); log4perl not initialised yet!
      }
- print STDERR localtime()." Sysconfig.pm created tempdir $tempdir rc=$rc\n";
 }
+
 1;

Modified: trunk/LedgerSMB.pm
===================================================================
--- trunk/LedgerSMB.pm	2012-07-11 02:45:57 UTC (rev 4965)
+++ trunk/LedgerSMB.pm	2012-07-11 08:30:35 UTC (rev 4966)
@@ -217,6 +217,7 @@
 use LedgerSMB::User;
 use LedgerSMB::Setting;
 use LedgerSMB::Company_Config;
+use Carp;
 use strict;
 use utf8;
 
@@ -289,10 +290,11 @@
             $cookie{$name} = $value;
         }
     }
+    warn $LedgerSMB::Sysconfig::localepath;
     #HV set _locale already to default here,so routines lower in stack can use it;e.g. login.pl
-    $self->{_locale}=LedgerSMB::Locale->get_handle('en');
-    #$self->{_locale}=LedgerSMB::Locale->get_handle($LedgerSMB::Sysconfig::language);
-    #$self->error( __FILE__ . ':' . __LINE__ .": Locale ($LedgerSMB::Sysconfig::language) not loaded: $!\n" ) unless $self->{_locale};
+    #$self->{_locale}=LedgerSMB::Locale->get_handle('en');
+    $self->{_locale}=LedgerSMB::Locale->get_handle($LedgerSMB::Sysconfig::language);
+    $self->error( __FILE__ . ':' . __LINE__ .": Locale ($LedgerSMB::Sysconfig::language) not loaded: $!\n" ) unless $self->{_locale};
 
     $self->{action} = "" unless defined $self->{action};
     $self->{action} =~ s/\W/_/g;
@@ -384,9 +386,6 @@
     );
 
     $self->{dbh}->do("set DateStyle to '".$date_setting{$self->{_user}->{dateformat}}."'");
-    #my $locale   = LedgerSMB::Locale->get_handle($self->{_user}->{language})
-    # or $self->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
-    #$self->{_locale} = $locale;
     $self->{_locale}=LedgerSMB::Locale->get_handle($self->{_user}->{language})
      or $self->error(__FILE__.':'.__LINE__.": Locale not loaded: $!\n");
 
@@ -439,6 +438,7 @@
 sub get_user_info {
     my ($self) = @_;
     $self->{_user} = LedgerSMB::User->fetch_config($self);
+    $self->{_user}->{language} ||= 'en';
 }
 #This function needs to be moved into the session handler.
 sub _get_password {
@@ -811,7 +811,7 @@
 sub error {
 
     my ( $self, $msg ) = @_;
-
+    Carp::confess();
     if ( $ENV{GATEWAY_INTERFACE} ) {
 
         $self->{msg}    = $msg;

Modified: trunk/lsmb-request.pl
===================================================================
--- trunk/lsmb-request.pl	2012-07-11 02:45:57 UTC (rev 4965)
+++ trunk/lsmb-request.pl	2012-07-11 08:30:35 UTC (rev 4966)
@@ -21,6 +21,7 @@
 package LedgerSMB::Handler;
 
 use LedgerSMB::Sysconfig;
+use LedgerSMB::Locale;
 use Digest::MD5;
 use Try::Tiny;
 
@@ -63,7 +64,9 @@
 
 if ($request->{_user}){
     $LedgerSMB::App_State::User = $request->{_user};
+    warn $request->{_user}->{language};
     $locale =  LedgerSMB::Locale->get_handle($request->{_user}->{language});
+    warn $locale;
     $LedgerSMB::App_State::Locale = $locale;
 } else {
     #$locale = LedgerSMB::Locale->get_handle('en');

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