ResourceBundle::getLocales

resourcebundle_locales

(No version information available, might only be in SVN)

ResourceBundle::getLocales -- resourcebundle_localesGet supported locales

Description

Object oriented style

array ResourceBundle::getLocales ( void )

Procedural style

array resourcebundle_locales ( ResourceBundle $r )

Get the list of locales supported by the bundle. The list is taken from the bundle table named res_index which should contain a table named InstalledLocales, which contains locales as keys. This bundle should be either in data directory as .res file or part of the .dat file for this function to work.

Parameters

r

ResourceBundle object.

Return Values

Returns the list of locales supported by the bundle.

Examples

Example #1 resourcebundle_locales() example

<?php
$r 
resourcebundle_create'es'"/usr/share/data/myapp");
echo 
join("\n"resourcebundle_locales($r));
?>

Example #2 OO example

<?php
$r 
= new ResourceBundle'es'"/usr/share/data/myapp");
echo 
join("\n"$r->getLocales());
?>

The above example will output:

es
root

See Also

add a note add a note

User Contributed Notes 1 note

up
0
jared at enhancesoft dot com
1 month ago
If you call this method with an empty string, it will return a list of all locales available in the ICU library (via the intl extension):

<?php
print_r
(ResourceBundle::getLocales(''));

/* Output might show
  * Array
  * (
  *    [0] => af
  *    [1] => af_NA
  *    [2] => af_ZA
  *    [3] => am
  *    [4] => am_ET
  *    [5] => ar
  *    [6] => ar_AE
  *    [7] => ar_BH
  *    [8] => ar_DZ
  *    [9] => ar_EG
  *    [10] => ar_IQ
  *  ...
  */
?>
To Top