ePages 6.10 - DE_EPAGES/Object/API/Object/SiteLocale.pm

Package DE_EPAGES::Object::API::Object::SiteLocale

object interface for SiteLocale. Provides information about regional settings. Includes functions for locale-specific number and currency formats.

Base
DE_EPAGES::Object::API::Object::Object

Functions

className
dbPackage
format
formatAttributes
formatDateTime
formatFloat
formatInteger
formatMoney
parse
parseDateTime
roundMoney

className

Returns the class name, used for DAL access.

Syntax
$ClassName = $SiteLocale->className;
Return
$ClassName (String)
class name

dbPackage

Returns the database package, used for DAL access.

Syntax
$DbPackage = $SiteLocale->dbPackage;
Return
$DbPackage (String)
database package name

format

Formats numbers in float/integer/money and DateTime objects to date/datetime/time strings.

Syntax
$Formatted = $Object->format($Value, $Format, $CurrencyID);
Input
$Value (float/object)
number in perl or DateTime object
$Format (string)
(integer/float/money/date/datetime/time)
$CurrencyID (char(3))
currency identifier (for money)
Return
$Formatted (string)
formatted value

formatAttributes

Returns the format options for number formatter.

Syntax
$hFormatAttributes = $Object->formatAttributes($CurrencyID);
Input
$CurrencyID (char(3))
currency identifier
Return
$hFormatAttributes (ref.hash)
options of formatter, keys:
  • SymbolCurrency
  • PosFormatCurrency
  • NegFormatCurrency
  • MinorUnitCurrency
  • DecimalSep
  • ThousandSep
  • NegFormatNumbers
  • NegFormatCurrency
  • PosFormatCurrency

formatDateTime

Returns the formatted date and time string in the Store time zone.

Syntax
$Formatted = $Object->formatDateTime($DateTime, $Type);
$Formatted = $Object->formatDateTime($DateTime, $Type, $Pattern);
Example
print $Object->formatDateTime( DateTime->now(), 'date' );
Input
$DateTime (object)
DateTime object
$Type (string)
date/time/datetime
$Pattern (string)
(optional) short/medium/long/full
or custom strftime format, for example '%Y-%m-%d'
(default: short)
Return
$Formatted (string)
formatted value

formatFloat

Returns the formatted number (insert thousand sep and decimal point).

Syntax
$Formatted = $Object->formatFloat($Number);
my $Formatted = $Object->formatFloat($Number, $Precision);
Example
print $Object->formatFloat( 12345.6789, 3 );
Input
$Number (float)
number
$Precision (float)
(optional) maximum number of digits right to the decimal
point
Return
$Formatted (string)
formatted value

formatInteger

Returns the formatted number (insert thousand sep).

Syntax
my $Formatted = $Object->formatInteger($Number);
Input
$Number (int)
number
Return
$Formatted (string)
formatted value

formatMoney

Returns the formatted number (insert thousand sep and decimal point).

Syntax
$Formatted = $Object->formatMoney($Number, $CurrencyID);
Input
$Number (float)
number
$CurrencyID (char(3))
currency identifier
Return
$Formatted (string)
formatted value

parse

Parse a formatted numbers of float/integer/money.

Syntax
$Value = $Object->parse($Formatted, $CurrencyID);
Input
$Formatted (string)
formatted value
$CurrencyID (char(3))
currency identifier (for money)
Return
$Value (float)
number in perl or DateTime object

parseDateTime

Parse a formatted date and time strings. The current Store time zone is assumed.

Syntax
$DateTime = $Object->parseDateTime($Formatted, $Type, $Pattern);
Input
$Formatted (string)
formatted value
$Type (string)
date/time/datetime
$Pattern (string)
(optional) short/medium/long/full
or custom strftime format, for example '%Y-%m-%d'
(default: short)
Return
$DateTime (object)
DateTime object

roundMoney

Round number for money (formatAttributes includes MinorUnitCurrency).

Syntax
$Rounded = $Object->roundMoney($Number, $CurrencyID);
Input
$Number (float)
number in perl
$CurrencyID (char(3))
currency identifier
Return
$Rounded (float/int)
rounded number