Skip to content

Commit

Permalink
Merge pull request #7647 from ehuelsmann/workaround/1.10/cldr-bignum
Browse files Browse the repository at this point in the history
Work around Locale::CLDR::Locales::* loading 'bignum'
  • Loading branch information
ehuelsmann authored Oct 7, 2023
2 parents 8ff2368 + c3c7b92 commit 23b4ed4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
4 changes: 4 additions & 0 deletions lib/LedgerSMB.pm
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ use List::Util qw( pairgrep );
use Locale::CLDR;
use Locales unicode => 1;
use Log::Any;
use Math::BigFloat;
use Math::BigInt;
use PGObject;
use Plack;
use URI;
Expand Down Expand Up @@ -626,6 +628,8 @@ sub enabled_languages {
sub enabled_countries {
my ($self) = @_;

local $Math::BigInt::upgrade = undef;
local $Math::BigFloat::downgrade = undef;
my $regions = Locale::CLDR->new($self->{_user}->{language})->all_regions;
return [
map {
Expand Down
10 changes: 8 additions & 2 deletions lib/LedgerSMB/Database/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ use namespace::autoclean;
use File::Find::Rule;
use File::Spec;
use Locale::CLDR;
use Math::BigFloat;
use Math::BigInt;

=head1 SYNOPSIS
Expand Down Expand Up @@ -125,8 +127,12 @@ sub charts_of_accounts {
###TODO: Define a parameter to the SQL directory!!
my $basedir = File::Spec->catfile('.', 'locale', 'coa');
my $countries = _list_directory($basedir);
my %regions = %{Locale::CLDR->new($self->language)
->all_regions};
my $cldr = do {
local $Math::BigInt::upgrade = undef;
local $Math::BigFloat::downgrade = undef;
Locale::CLDR->new($self->language);
};
my %regions = %{$cldr->all_regions};

return {
map {
Expand Down
8 changes: 7 additions & 1 deletion lib/LedgerSMB/I18N.pm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ we look only to the current locale.

use Locale::CLDR;
use Locales unicode => 1;
use Math::BigFloat;
use Math::BigInt;
use Moose::Role;
use namespace::autoclean;
use LedgerSMB::App_State;
Expand Down Expand Up @@ -127,7 +129,11 @@ Get a country localized list to allow user selection

sub get_country_list {
my $language = shift;
my %regions = Locale::CLDR->new($language)->all_regions->%*;
my %regions = do {
local $Math::BigInt::upgrade = undef;
local $Math::BigFloat::downgrade = undef;
Locale::CLDR->new($language)->all_regions->%*
};
return [
sort { $a->{text} cmp $b->{text} }
map { +{ value => uc($_),
Expand Down
8 changes: 7 additions & 1 deletion old/lib/LedgerSMB/DBObject/User.pm
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ use warnings;
use base qw(LedgerSMB::PGOld);

use Locale::CLDR;
use Math::BigFloat;
use Math::BigInt;

use Carp;
use Log::Any;
Expand Down Expand Up @@ -87,7 +89,11 @@ Sets the options for the user preference screen.
sub get_option_data {
my $self = shift @_;
# Load localized data from current locale
my $locale = Locale::CLDR->new($self->{prefs}{language});
my $locale = do {
local $Math::BigInt::upgrade = undef;
local $Math::BigFloat::downgrade = undef;
Locale::CLDR->new($self->{prefs}{language});
};
$self->{dateformats} = [];
$self->{numberformats} = [];
for my $opt (qw(mm-dd-yyyy mm/dd/yyyy dd-mm-yyyy dd/mm/yyyy dd.mm.yyyy yyyy-mm-dd)){
Expand Down

0 comments on commit 23b4ed4

Please sign in to comment.