ResourceBundle::create

resourcebundle_create

ResourceBundle::__construct

リソースバンドルを作成する

説明

オブジェクト指向型 (メソッド)

public static ResourceBundlenull ResourceBundle::create(stringnull $locale, stringnull $bundle, bool $fallback = true)

手続き型

ResourceBundlenull resourcebundle_create(stringnull $locale, stringnull $bundle, bool $fallback = true)

オブジェクト指向型 (コンストラクタ):

public ResourceBundle::__construct(stringnull $locale, stringnull $bundle, bool $fallback = true)

リソースバンドルを作成します。

パラメータ

locale

リソースバンドルを読み込むロケール (en_CA などのロケール名)。

bundle

データが格納されているディレクトリ、あるいは .dat ファイル名。

fallback

ロケールを完全一致とするか、あるいは代替として親ロケールを使うことを許可するか。

戻り値

ResourceBundle オブジェクト、あるいはエラー時に null を返します。

例1 resourcebundle_create の例

<?php
$r 
resourcebundle_create'es'"/usr/share/data/myapp");
echo 
$r['teststring'];
?>

例2 ResourceBundle::create の例

<?php
$r 
ResourceBundle::create'es'"/usr/share/data/myapp");
echo 
$r['teststring'];
?>

上の例の出力は以下となります。

¡Hola, mundo!

参考

  • resourcebundle_get