Business-Cart-Generic

 view release on metacpan or  search on metacpan

data/languages.csv  view on Meta::CPAN

"name","code","locale","charset","date_format_short","date_format_long","time_format","text_direction","currency_id","numeric_separator_decimal","numeric_separator_thousands"
"English","en_US","en_US.UTF-8,en_US,english","utf-8","%m/%d/%Y","%A %d %B, %Y","%H:%M:%S","ltr","1",".",","
"English","en_AU","en_AU.UTF-8,en_AU,english","utf-8","%d/%m/%Y","%A %d %B, %Y","%H:%M:%S","ltr","4",".",","

lib/Business/Cart/Generic/Database/Create.pm  view on Meta::CPAN

	my($engine)      = $self -> engine;
	my($result)      = $self -> creator -> create_table(<<SQL);
create table $table_name
(
id $primary_key,
currency_id integer not null references currencies(id),
charset varchar(255) not null,
code char(5) not null,
date_format_long varchar(255) not null,
date_format_short varchar(255) not null,
locale varchar(255) not null,
name varchar(255) not null,
numeric_separator_decimal varchar(255) NOT NULL,
numeric_separator_thousands varchar(255) NOT NULL,
text_direction varchar(255) not null,
time_format varchar(255) not null,
upper_name varchar(255) not null
) $engine
SQL
	$self -> report($table_name, 'created', $result);

lib/Business/Cart/Generic/Database/Import.pm  view on Meta::CPAN

sub clean_language_data
{
	my($self)          = @_;
	my($input_path)    = "$FindBin::Bin/../data/raw.languages.txt";
	my(@original_data) = slurp($input_path, {chomp => 1});

	my(@field);
	my($line);
	my(@raw_data);

	push @raw_data, '"name","code","locale","charset","date_format_short","date_format_long","time_format","text_direction","currency_id","numeric_separator_decimal","numeric_separator_thousands"';

	for $line (@original_data)
	{
		# Expected format:
		# INSERT INTO osc_languages VALUES (2,'English','en_AU','en_AU.UTF-8,en_AU,english','utf-8','%d/%m/%Y','%A %d %B, %Y','%H:%M:%S','ltr',1,'.',',',0,1);

		$line  = substr($line, 0, - 2); # Discard );.
		@field = split(/VALUES \(/, $line);
		$field[1]  =~ s/,(en_(?:AU|US)),/#$1#/; # locale.
		$field[1]  =~ s/B,/B#/;                 # date_format_long.
		$field[1]  =~ s/'.',',',/'.','#',/;     # numeric_separator_thousands.
		$field[1]  =~ tr/'/"/;   # For Text::CSV_XS.
		@field     = split(/\s*,\s*/, $field[1]);
		$field[3]  =~ s/#/,/g; # locale.
		$field[6]  =~ s/#/,/;  # date_format_long.
		$field[11] =~ s/#/,/;  # numeric_separator_thousands.

		push @raw_data, join(',', @field[1 .. 11]);
	}

	my($output_path) = "$FindBin::Bin/../data/languages.csv";

	open(OUT, '>', $output_path) || die "Can't open($output_path): $!";

lib/Business/Cart/Generic/Database/Import.pm  view on Meta::CPAN


	for my $line (@$zone)
	{
		$result = $rs -> create
			({
			 charset                     => $$line{charset},
			 code                        => $$line{code},
			 currency_id                 => $$line{currency_id},
			 date_format_long            => $$line{date_format_long},
			 date_format_short           => $$line{date_format_long},
			 locale                      => $$line{locale},
			 name                        => $$line{name},
			 numeric_separator_decimal   => $$line{numeric_separator_decimal},
			 numeric_separator_thousands => $$line{numeric_separator_thousands},
			 text_direction              => $$line{text_direction},
			 time_format                 => $$line{time_format},
			 upper_name                  => uc $$line{name},
			});
	}

} # End of populate_languages_table.

lib/Business/Cart/Generic/Schema/Result/Language.pm  view on Meta::CPAN

  data_type: 'varchar'
  is_nullable: 0
  size: 255

=head2 date_format_short

  data_type: 'varchar'
  is_nullable: 0
  size: 255

=head2 locale

  data_type: 'varchar'
  is_nullable: 0
  size: 255

=head2 name

  data_type: 'varchar'
  is_nullable: 0
  size: 255

lib/Business/Cart/Generic/Schema/Result/Language.pm  view on Meta::CPAN

  "currency_id",
  { data_type => "integer", is_foreign_key => 1, is_nullable => 0 },
  "charset",
  { data_type => "varchar", is_nullable => 0, size => 255 },
  "code",
  { data_type => "char", is_nullable => 0, size => 5 },
  "date_format_long",
  { data_type => "varchar", is_nullable => 0, size => 255 },
  "date_format_short",
  { data_type => "varchar", is_nullable => 0, size => 255 },
  "locale",
  { data_type => "varchar", is_nullable => 0, size => 255 },
  "name",
  { data_type => "varchar", is_nullable => 0, size => 255 },
  "numeric_separator_decimal",
  { data_type => "varchar", is_nullable => 0, size => 255 },
  "numeric_separator_thousands",
  { data_type => "varchar", is_nullable => 0, size => 255 },
  "text_direction",
  { data_type => "varchar", is_nullable => 0, size => 255 },
  "time_format",



( run in 1.166 second using v1.01-cache-2.11-cpan-ceb78f64989 )