class ResourceBundle implements IteratorAggregate, Countable (View source)

Methods

__construct(string $locale, string $bundle, bool $fallback = true)

No description

static ResourceBundle|null
create(string $locale, string $bundle, bool $fallback = true)

(PHP >= 5.3.2, PECL intl >= 2.0.0)
Create a resource bundle

mixed
get(string|int $index, bool $fallback = true)

(PHP >= 5.3.2, PECL intl >= 2.0.0)
Get data from the bundle

int
count()

(PHP >= 5.3.2, PECL intl >= 2.0.0)
Get number of elements in the bundle

static array|false
getLocales(string $bundle)

(PHP >= 5.3.2, PECL intl >= 2.0.0)
Get supported locales

int
getErrorCode()

(PHP >= 5.3.2, PECL intl >= 2.0.0)
Get bundle's last error code.

string
getErrorMessage()

(PHP >= 5.3.2, PECL intl >= 2.0.0)
Get bundle's last error message.

getIterator()

No description

Details

__construct(string $locale, string $bundle, bool $fallback = true)

No description

Parameters

string $locale

Locale for which the resources should be loaded (locale name, e.g. en_CA).

string $bundle

The directory where the data is stored or the name of the .dat file.

bool $fallback

[optional]

Whether locale should match exactly or fallback to parent locale is allowed.

static ResourceBundle|null create(string $locale, string $bundle, bool $fallback = true)

(PHP >= 5.3.2, PECL intl >= 2.0.0)
Create a resource bundle

Parameters

string $locale

Locale for which the resources should be loaded (locale name, e.g. en_CA).

string $bundle

The directory where the data is stored or the name of the .dat file.

bool $fallback

[optional]

Whether locale should match exactly or fallback to parent locale is allowed.

Return Value

ResourceBundle|null

ResourceBundle object or null on error.

mixed get(string|int $index, bool $fallback = true)

(PHP >= 5.3.2, PECL intl >= 2.0.0)
Get data from the bundle

Parameters

string|int $index

Data index, must be string or integer.

bool $fallback

Return Value

mixed

the data located at the index or NULL on error. Strings, integers and binary data strings are returned as corresponding PHP types, integer array is returned as PHP array. Complex types are returned as ResourceBundle object.

int count()

(PHP >= 5.3.2, PECL intl >= 2.0.0)
Get number of elements in the bundle

Return Value

int

The custom count as an integer.

The return value is cast to an integer.

static array|false getLocales(string $bundle)

(PHP >= 5.3.2, PECL intl >= 2.0.0)
Get supported locales

Parameters

string $bundle

Path of ResourceBundle for which to get available locales, or empty string for default locales list.

Return Value

array|false

the list of locales supported by the bundle.

int getErrorCode()

(PHP >= 5.3.2, PECL intl >= 2.0.0)
Get bundle's last error code.

Return Value

int

error code from last bundle object call.

string getErrorMessage()

(PHP >= 5.3.2, PECL intl >= 2.0.0)
Get bundle's last error message.

Return Value

string

error message from last bundle object's call.

Traversable getIterator()

Since: 8.0

No description

Return Value

Traversable

An instance of an object implementing Iterator or Traversable