Documentation

I18n
in package

Formats data according to local conventions.

This is an easier-to-use helper version of the LocaleInfo set of classes.

To set the locale, set the config param: sprout.locale

The default is AUS - Australia

Table of Contents

Properties

$locale  : mixed

Methods

addressFields()  : mixed
Returns HTML for address fields
currencyISO()  : string
Return currency ISO code
init()  : mixed
Set the locale to the default as per the configuration
initJavaScript()  : string
Return JavaScript code which initialises the I18n javascript library with the locale parameters
longdate()  : mixed
Return a formatted date in a short format (e.g. Mon 3rd Jan 2003)
money()  : mixed
Return a formatted currency value
number()  : mixed
Return a formatted number
setLocale()  : mixed
Set the locale to something other than the default Useful for multi-currency shopping carts, for example.
shortdate()  : mixed
Return a formatted date in a short format (e.g. 3/1/2003)
time()  : mixed
Return a formatted dtime (e.g. 5:30pm)

Properties

$locale

private static mixed $locale

Methods

addressFields()

Returns HTML for address fields

public static addressFields(bool $required) : mixed
Parameters
$required : bool

If the fields should be listed as required or not

currencyISO()

Return currency ISO code

public static currencyISO() : string
Return values
string —

Eg. AUD

init()

Set the locale to the default as per the configuration

public static init() : mixed

initJavaScript()

Return JavaScript code which initialises the I18n javascript library with the locale parameters

public static initJavaScript() : string
Return values
string —

HTML <script> tag

longdate()

Return a formatted date in a short format (e.g. Mon 3rd Jan 2003)

public static longdate([int $timestamp = 0 ]) : mixed
Parameters
$timestamp : int = 0

. A unix timestamp. Defaults to the current time

money()

Return a formatted currency value

public static money(float $number[, mixed $precision = null ]) : mixed
Parameters
$number : float

The number to format

$precision : mixed = null

number()

Return a formatted number

public static number(float $number, int $precision) : mixed
Parameters
$number : float

The number to format

$precision : int

The number of digits to show after the decimal point

setLocale()

Set the locale to something other than the default Useful for multi-currency shopping carts, for example.

public static setLocale(string $country) : mixed
Parameters
$country : string

The country to set the locale to, e.g. 'AUS'.

shortdate()

Return a formatted date in a short format (e.g. 3/1/2003)

public static shortdate([int $timestamp = 0 ]) : mixed
Parameters
$timestamp : int = 0

. A unix timestamp. Defaults to the current time

time()

Return a formatted dtime (e.g. 5:30pm)

public static time([int $timestamp = 0 ]) : mixed
Parameters
$timestamp : int = 0

. A unix timestamp. Defaults to the current time

On this page

Search results