mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
add ResourceBundle docs
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@293471 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
64dc3e6ae8
commit
4782b86456
8 changed files with 866 additions and 0 deletions
|
@ -94,6 +94,7 @@
|
|||
&reference.intl.normalizer;
|
||||
&reference.intl.messageformatter;
|
||||
&reference.intl.dateformatter;
|
||||
&reference.intl.resourcebundle;
|
||||
|
||||
&reference.intl.grapheme;
|
||||
&reference.intl.idn;
|
||||
|
|
107
reference/intl/resourcebundle.xml
Normal file
107
reference/intl/resourcebundle.xml
Normal file
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 288721 $ -->
|
||||
<phpdoc:classref xmlns:phpdoc="http://php.net/ns/phpdoc" xml:id="class.resourcebundle" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<title>The ResourceBundle class</title>
|
||||
<titleabbrev>ResourceBundle</titleabbrev>
|
||||
|
||||
<partintro>
|
||||
|
||||
<!-- {{{ NumberFormatter intro -->
|
||||
<section xml:id="resourcebundle.intro">
|
||||
&reftitle.intro;
|
||||
<simpara>
|
||||
Localized software products often require sets of data that are to be customized
|
||||
depending on current locale, e.g.: messages, labels, formatting patterns. ICU
|
||||
resource mechanism allows to define sets of resources that the application can
|
||||
load on locale basis, while accessing them in unified locale-independent fashion.
|
||||
</simpara>
|
||||
<simpara>
|
||||
This class implements access to ICU resource data files. These files are binary data
|
||||
arrays which ICU uses to store the localized data.
|
||||
</simpara>
|
||||
<simpara>
|
||||
ICU resource bundle can hold simple resources and complex resources. Complex resources
|
||||
are containers which can be either integer-indexed or string-indexed (just like PHP arrays).
|
||||
Simple resources can be of the following typos: string, integer, binary data field
|
||||
or integer array.
|
||||
</simpara>
|
||||
<simpara>
|
||||
<classname>ResourceBundle</classname> supports direct access to the data through array access
|
||||
pattern and iteration via <link linkend="control-structures.foreach">foreach</link>,
|
||||
as well as access via class methods. The result will be PHP value for simple resources and
|
||||
<classname>ResourceBundle</classname> object for complex ones. All resources are read-only.
|
||||
</simpara>
|
||||
</section>
|
||||
<!-- }}} -->
|
||||
|
||||
<section xml:id="resourcebundle.synopsis">
|
||||
&reftitle.classsynopsis;
|
||||
|
||||
<!-- {{{ Synopsis -->
|
||||
<classsynopsis>
|
||||
<ooclass>
|
||||
<classname>ResourceBundle</classname>
|
||||
</ooclass>
|
||||
|
||||
<!-- {{{ Class synopsis -->
|
||||
<classsynopsisinfo>
|
||||
<ooclass>
|
||||
<classname>ResourceBundle</classname>
|
||||
</ooclass>
|
||||
</classsynopsisinfo>
|
||||
<!-- }}} -->
|
||||
|
||||
<classsynopsisinfo role="comment">Methods</classsynopsisinfo>
|
||||
<xi:include
|
||||
xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.resourcebundle')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[1])" />
|
||||
<xi:include
|
||||
xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.resourcebundle')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
|
||||
|
||||
</classsynopsis>
|
||||
<!-- }}} -->
|
||||
|
||||
</section>
|
||||
|
||||
<!-- &reference.intl.resourcebundle-constants; -->
|
||||
|
||||
<section xml:id="resourcebundle.seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member>
|
||||
<link xlink:href="&url.icu.resources;">
|
||||
ICU Resource Management
|
||||
</link>
|
||||
</member>
|
||||
<member>
|
||||
<link xlink:href="&url.icu.data;">ICU Data</link>
|
||||
</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</section>
|
||||
</partintro>
|
||||
|
||||
&reference.intl.entities.resourcebundle;
|
||||
|
||||
</phpdoc:classref>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
118
reference/intl/resourcebundle/count.xml
Normal file
118
reference/intl/resourcebundle/count.xml
Normal file
|
@ -0,0 +1,118 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 288721 $ -->
|
||||
<refentry xml:id="resourcebundle.count" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>ResourceBundle::count</refname>
|
||||
<refname>resourcebundle_count</refname>
|
||||
<refpurpose>Get number of elements in the bundle</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>
|
||||
Object oriented style
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>int</type>
|
||||
<methodname>ResourceBundle::count</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Procedural style
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>int</type>
|
||||
<methodname>resourcebundle_count</methodname>
|
||||
<methodparam><type>ResourceBundle</type><parameter>r</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Get the number of elements in the bundle.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>r</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<classname>ResourceBundle</classname> object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns number of elements in the bundle.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><function>resourcebundle_count</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$r = resourcebundle_create( 'es', "/usr/share/data/myapp");
|
||||
echo resourcebundle_count($r);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>OO example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$r = new ResourceBundle( 'es', "/usr/share/data/myapp");
|
||||
echo $r->count();
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
42
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>resourcebundle_get</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
149
reference/intl/resourcebundle/create.xml
Normal file
149
reference/intl/resourcebundle/create.xml
Normal file
|
@ -0,0 +1,149 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 288721 $ -->
|
||||
<refentry xml:id="resourcebundle.create" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>ResourceBundle::create</refname>
|
||||
<refname>resourcebundle_create</refname>
|
||||
<refname>ResourceBundle::__construct</refname>
|
||||
<refpurpose>Create a resource bundle</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>
|
||||
Object oriented style (method)
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<modifier>static</modifier>
|
||||
<type>ResourceBundle</type>
|
||||
<methodname>ResourceBundle::create</methodname>
|
||||
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>bundlename</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>fallback</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Procedural style
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>ResourceBundle</type>
|
||||
<methodname>resourcebundle_create</methodname>
|
||||
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>bundlename</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>fallback</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Object oriented style (constructor):
|
||||
</para>
|
||||
<constructorsynopsis>
|
||||
<methodname>ResourceBundle::__construct</methodname>
|
||||
<methodparam><type>string</type><parameter>locale</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>bundlename</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>fallback</parameter></methodparam>
|
||||
</constructorsynopsis>
|
||||
<para>
|
||||
Creates a resource bundle.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>locale</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Locale for which the resources should be loaded (locale name, e.g. en_CA).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>bundlename</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The directory where the data is stored or the name of the .dat file.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>fallback</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Whether locale should match exactly or fallback to parent locale is allowed.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns <classname>ResourceBundle</classname> object or &false; on error.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><function>resourcebundle_create</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$r = resourcebundle_create( 'es', "/usr/share/data/myapp");
|
||||
echo $r['teststring'];
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title><function>ResourceBundle::create</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$r = ResourceBundle::create( 'es', "/usr/share/data/myapp");
|
||||
echo $r['teststring'];
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
¡Hola, mundo!
|
||||
]]>
|
||||
</screen>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>resourcebundle_get</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
120
reference/intl/resourcebundle/get-error-code.xml
Normal file
120
reference/intl/resourcebundle/get-error-code.xml
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 288721 $ -->
|
||||
<refentry xml:id="resourcebundle.geterrorcode" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>ResourceBundle::getErrorCode</refname>
|
||||
<refname>resourcebundle_get_error_code</refname>
|
||||
<refpurpose>Get bundle's last error code.</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>
|
||||
Object oriented style
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>int</type>
|
||||
<methodname>ResourceBundle::getErrorCode</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Procedural style
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>int</type>
|
||||
<methodname>resourcebundle_get_error_code</methodname>
|
||||
<methodparam><type>ResourceBundle</type><parameter>r</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Get error code from the last function performed by the bundle object.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>r</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<classname>ResourceBundle</classname> object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns error code from last bundle object call.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><function>resourcebundle_get_error_code</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$r = resourcebundle_create( 'es', "/usr/share/data/myapp");
|
||||
echo $r['somestring'];
|
||||
if(intl_is_failure(resourcebundle_get_error_code($r))) {
|
||||
report_error("Bundle error");
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>OO example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$r = new ResourceBundle( 'es', "/usr/share/data/myapp");
|
||||
echo $r['somestring'];
|
||||
if(intl_is_failure(ResourceBundle::getErrorCode($r))) {
|
||||
report_error("Bundle error");
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>resourcebundle_get_error_message</function></member>
|
||||
<member><function>intl_get_error_code</function></member>
|
||||
<member><function>intl_is_failure</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
120
reference/intl/resourcebundle/get-error-message.xml
Normal file
120
reference/intl/resourcebundle/get-error-message.xml
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 288721 $ -->
|
||||
<refentry xml:id="resourcebundle.geterrormessage" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>ResourceBundle::getErrorMessage</refname>
|
||||
<refname>resourcebundle_get_error_message</refname>
|
||||
<refpurpose>Get bundle's last error message.</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>
|
||||
Object oriented style
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>string</type>
|
||||
<methodname>ResourceBundle::getErrorMessage</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Procedural style
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>string</type>
|
||||
<methodname>resourcebundle_get_error_message</methodname>
|
||||
<methodparam><type>ResourceBundle</type><parameter>r</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Get error message from the last function performed by the bundle object.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>r</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<classname>ResourceBundle</classname> object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns error message from last bundle object's call.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><function>resourcebundle_get_error_message</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$r = resourcebundle_create( 'es', "/usr/share/data/myapp");
|
||||
echo $r['somestring'];
|
||||
if(intl_is_failure(resourcebundle_get_error_code($r))) {
|
||||
report_error("Bundle error: ".resourcebundle_get_error_message($r));
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>OO example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$r = new ResourceBundle( 'es', "/usr/share/data/myapp");
|
||||
echo $r['somestring'];
|
||||
if(intl_is_failure(ResourceBundle::getErrorCode($r))) {
|
||||
report_error("Bundle error: ".ResourceBundle::getErrorMessage($r));
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>resourcebundle_get_error_code</function></member>
|
||||
<member><function>intl_get_error_code</function></member>
|
||||
<member><function>intl_is_failure</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
129
reference/intl/resourcebundle/get.xml
Normal file
129
reference/intl/resourcebundle/get.xml
Normal file
|
@ -0,0 +1,129 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 288721 $ -->
|
||||
<refentry xml:id="resourcebundle.get" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>ResourceBundle::get</refname>
|
||||
<refname>resourcebundle_get</refname>
|
||||
<refpurpose>Get data from the bundle</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>
|
||||
Object oriented style
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type>
|
||||
<methodname>ResourceBundle::get</methodname>
|
||||
<methodparam><type>string|int</type><parameter>index</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Procedural style
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>mixed</type>
|
||||
<methodname>resourcebundle_get</methodname>
|
||||
<methodparam><type>ResourceBundle</type><parameter>r</parameter></methodparam>
|
||||
<methodparam><type>string|int</type><parameter>index</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Get the data from the bundle by index or string key.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>r</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<classname>ResourceBundle</classname> object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>index</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Data index, must be string or integer.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns 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 <classname>ResourceBundle</classname> object.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><function>resourcebundle_get</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$r = resourcebundle_create( 'es', "/usr/share/data/myapp");
|
||||
echo resourcebundle_get($r, 'somestring');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>OO example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$r = new ResourceBundle( 'es', "/usr/share/data/myapp");
|
||||
echo $r->get('somestring');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
?Hola, mundo!
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>resourcebundle_count</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
122
reference/intl/resourcebundle/locales.xml
Normal file
122
reference/intl/resourcebundle/locales.xml
Normal file
|
@ -0,0 +1,122 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- $Revision: 288721 $ -->
|
||||
<refentry xml:id="resourcebundle.locales" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<refnamediv>
|
||||
<refname>ResourceBundle::getLocales</refname>
|
||||
<refname>resourcebundle_locales</refname>
|
||||
<refpurpose>Get supported locales</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<para>
|
||||
Object oriented style
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>array</type>
|
||||
<methodname>ResourceBundle::getLocales</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Procedural style
|
||||
</para>
|
||||
<methodsynopsis>
|
||||
<type>array</type>
|
||||
<methodname>resourcebundle_locales</methodname>
|
||||
<methodparam><type>ResourceBundle</type><parameter>r</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.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="parameters">
|
||||
&reftitle.parameters;
|
||||
<para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>r</parameter></term>
|
||||
<listitem>
|
||||
<para>
|
||||
<classname>ResourceBundle</classname> object.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
||||
<refsect1 role="returnvalues">
|
||||
&reftitle.returnvalues;
|
||||
<para>
|
||||
Returns the list of locales supported by the bundle.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><function>resourcebundle_locales</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$r = resourcebundle_create( 'es', "/usr/share/data/myapp");
|
||||
echo join("\n", resourcebundle_locales($r));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<example>
|
||||
<title>OO example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$r = new ResourceBundle( 'es', "/usr/share/data/myapp");
|
||||
echo join("\n", $r->getLocales());
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
es
|
||||
root
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 role="seealso">
|
||||
&reftitle.seealso;
|
||||
<para>
|
||||
<simplelist>
|
||||
<member><function>resourcebundle_get</function></member>
|
||||
</simplelist>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
sgml-omittag:t
|
||||
sgml-shorttag:t
|
||||
sgml-minimize-attributes:nil
|
||||
sgml-always-quote-attributes:t
|
||||
sgml-indent-step:1
|
||||
sgml-indent-data:t
|
||||
indent-tabs-mode:nil
|
||||
sgml-parent-document:nil
|
||||
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
||||
sgml-exposed-tags:nil
|
||||
sgml-local-catalogs:nil
|
||||
sgml-local-ecat-files:nil
|
||||
End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
Loading…
Reference in a new issue