Php/docs/resourcebundle.locales

提供:Dev Guides
< Php
移動先:案内検索

ResourceBundle::getLocales

resourcebundle_locales

(PHP 5 >= 5.3.2, PHP 7, PECL intl >= 2.0.0)

ResourceBundle::getLocales -- resourcebundle_localesサポートするロケールを取得する


説明

オブジェクト指向型

public ResourceBundle::getLocales ( string $bundlename ) : array

手続き型

resourcebundle_locales ( string $bundlename ) : array

ResourceBundle 名を指定して、サポートするロケールを取得します。


パラメータ

bundlename
ロケールを取得したい ResourceBundle のパス、あるいは 空文字列を指定するとデフォルトのロケール一覧を取得できます。


返り値

このバンドルがサポートするロケールの一覧を返します。


例1 resourcebundle_locales() の例

<?php$bundle = "/user/share/data/myapp";echo join(PHP_EOL, resourcebundle_locales($bundle));?>

上の例の出力は、 たとえば以下のようになります。


es
root

例2 オブジェクト指向の例

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

上の例の出力は、 たとえば以下のようになります。


es
root

参考