From f40b706eda465195d9f9585e8fa429a31da870c8 Mon Sep 17 00:00:00 2001 From: tetragon Date: Wed, 25 Oct 2006 14:31:33 +0000 Subject: Display error instead of dying horribly when locale not found git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@303 4979c152-3d1c-0410-bac9-87ea11338e46 --- bin/admin.pl | 3 ++- bin/login.pl | 3 ++- bin/oe.pl | 3 ++- menu.pl | 6 ++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/admin.pl b/bin/admin.pl index 5229d7e6..9642fc62 100755 --- a/bin/admin.pl +++ b/bin/admin.pl @@ -43,7 +43,8 @@ use LedgerSMB::User; $form = new Form; -$locale = LedgerSMB::Locale->get_handle(${LedgerSMB::Sysconfig::language}); +$locale = LedgerSMB::Locale->get_handle(${LedgerSMB::Sysconfig::language}) or + $form->error("Locale not loaded: $!\n"); $locale->encoding('UTF-8'); $form->{charset} = 'UTF-8'; #$form->{charset} = $locale->encoding; diff --git a/bin/login.pl b/bin/login.pl index a3a70b9b..2ef1c8aa 100755 --- a/bin/login.pl +++ b/bin/login.pl @@ -47,7 +47,8 @@ use LedgerSMB::Locale; $form = new Form; -$locale = LedgerSMB::Locale->get_handle(${LedgerSMB::Sysconfig::language}); +$locale = LedgerSMB::Locale->get_handle(${LedgerSMB::Sysconfig::language}) or + $form->error("Locale not loaded: $!\n"); $locale->encoding('UTF-8'); $form->{charset} = 'UTF-8'; #$form->{charset} = $locale->encoding; diff --git a/bin/oe.pl b/bin/oe.pl index a97088a7..5e9606b8 100755 --- a/bin/oe.pl +++ b/bin/oe.pl @@ -1945,7 +1945,8 @@ sub invoice { $form->{type} = "invoice"; # locale messages - $locale = LedgerSMB::Locale->get_handle($myconfig{countrycode}); + $locale = LedgerSMB::Locale->get_handle($myconfig{countrycode}) or + $form->error("Locale not loaded: $!\n"); #$form->{charset} = $locale->encoding; $form->{charset} = 'UTF-8'; $locale->encoding('UTF-8'); diff --git a/menu.pl b/menu.pl index f0e918e4..781854c0 100755 --- a/menu.pl +++ b/menu.pl @@ -87,7 +87,8 @@ use DBI qw(:sql_types); # check for user config file, could be missing or ??? eval { require("$userspath/$form->{login}.conf"); }; if ($@) { - $locale = LedgerSMB::Locale->get_handle($myconfig{countrycode}); + $locale = LedgerSMB::Locale->get_handle($myconfig{countrycode}) or + $form->error("Locale not loaded: $!\n"); $form->{charset} = $locale->encoding; $form->{charset} = 'UTF-8'; $locale->encoding('UTF-8'); @@ -99,7 +100,8 @@ if ($@) { } # locale messages -$locale = LedgerSMB::Locale->get_handle($myconfig{countrycode}); +$locale = LedgerSMB::Locale->get_handle($myconfig{countrycode}) or + $form->error("Locale not loaded: $!\n"); #$form->{charset} = $locale->encoding; $form->{charset} = 'UTF-8'; $locale->encoding('UTF-8'); -- cgit v1.2.3