Fixed and clarified both the procedural and OOP variants, and updated examples. Addresses bug #53995.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@320463 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Justin Martin 2011-12-05 21:35:52 +00:00
parent db4dfaad2a
commit ad1cf1f199

View file

@ -15,7 +15,7 @@
<methodsynopsis>
<type>array</type>
<methodname>ResourceBundle::getLocales</methodname>
<void />
<methodparam><type>string</type><parameter>bundlename</parameter></methodparam>
</methodsynopsis>
<para>
Procedural style
@ -23,13 +23,10 @@
<methodsynopsis>
<type>array</type>
<methodname>resourcebundle_locales</methodname>
<methodparam><type>ResourceBundle</type><parameter>r</parameter></methodparam>
<methodparam><type>string</type><parameter>bundlename</parameter></methodparam>
</methodsynopsis>
<para>
Get the list of locales supported by the bundle. The list is taken from the bundle table
named <code>res_index</code> which should contain a table named <code>InstalledLocales</code>,
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.
Get available locales from ResourceBundle name.
</para>
</refsect1>
@ -38,10 +35,11 @@
<para>
<variablelist>
<varlistentry>
<term><parameter>r</parameter></term>
<term><parameter>bundlename</parameter></term>
<listitem>
<para>
<classname>ResourceBundle</classname> object.
Path of ResourceBundle for which to get available locales, or
empty string for default locales list.
</para>
</listitem>
</varlistentry>
@ -64,23 +62,31 @@
<programlisting role="php">
<![CDATA[
<?php
$r = resourcebundle_create( 'es', "/usr/share/data/myapp");
echo join("\n", resourcebundle_locales($r));
$bundle = "/user/share/data/myapp";
echo join(PHP_EOL, resourcebundle_locales($bundle);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
es
root
]]>
</screen>
</example>
<example>
<title>OO example</title>
<programlisting role="php">
<![CDATA[
<?php
$r = new ResourceBundle( 'es', "/usr/share/data/myapp");
echo join("\n", $r->getLocales());
$bundle = "/usr/share/data/myapp";
$r = new ResourceBundle( 'es', $bundle);
echo join("\n", $r->getLocales($bundle));
?>
]]>
</programlisting>
&example.outputs;
&example.outputs.similar;
<screen>
<![CDATA[
es