diff --git a/reference/intl/book.xml b/reference/intl/book.xml index 5eaa3e93d1..ade782073b 100644 --- a/reference/intl/book.xml +++ b/reference/intl/book.xml @@ -94,6 +94,7 @@ &reference.intl.normalizer; &reference.intl.messageformatter; &reference.intl.dateformatter; + &reference.intl.resourcebundle; &reference.intl.grapheme; &reference.intl.idn; diff --git a/reference/intl/resourcebundle.xml b/reference/intl/resourcebundle.xml new file mode 100644 index 0000000000..40488d1548 --- /dev/null +++ b/reference/intl/resourcebundle.xml @@ -0,0 +1,107 @@ + + + + The ResourceBundle class + ResourceBundle + + + + +
+ &reftitle.intro; + + 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. + + + This class implements access to ICU resource data files. These files are binary data + arrays which ICU uses to store the localized data. + + + 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. + + + ResourceBundle supports direct access to the data through array access + pattern and iteration via foreach, + as well as access via class methods. The result will be PHP value for simple resources and + ResourceBundle object for complex ones. All resources are read-only. + +
+ + +
+ &reftitle.classsynopsis; + + + + + ResourceBundle + + + + + + ResourceBundle + + + + + Methods + + + + + + +
+ + + +
+ &reftitle.seealso; + + + + + ICU Resource Management + + + + ICU Data + + + +
+
+ + &reference.intl.entities.resourcebundle; + +
+ + diff --git a/reference/intl/resourcebundle/count.xml b/reference/intl/resourcebundle/count.xml new file mode 100644 index 0000000000..7a68a55eea --- /dev/null +++ b/reference/intl/resourcebundle/count.xml @@ -0,0 +1,118 @@ + + + + + ResourceBundle::count + resourcebundle_count + Get number of elements in the bundle + + + + &reftitle.description; + + Object oriented style + + + int + ResourceBundle::count + + + + Procedural style + + + int + resourcebundle_count + ResourceBundler + + + Get the number of elements in the bundle. + + + + + &reftitle.parameters; + + + + r + + + ResourceBundle object. + + + + + + + + + + &reftitle.returnvalues; + + Returns number of elements in the bundle. + + + + + &reftitle.examples; + + <function>resourcebundle_count</function> example + + +]]> + + + + OO example + +count(); +?> +]]> + + &example.outputs; + + + + + + + + &reftitle.seealso; + + + resourcebundle_get + + + + + + diff --git a/reference/intl/resourcebundle/create.xml b/reference/intl/resourcebundle/create.xml new file mode 100644 index 0000000000..4309d2d23e --- /dev/null +++ b/reference/intl/resourcebundle/create.xml @@ -0,0 +1,149 @@ + + + + + ResourceBundle::create + resourcebundle_create + ResourceBundle::__construct + Create a resource bundle + + + + &reftitle.description; + + Object oriented style (method) + + + static + ResourceBundle + ResourceBundle::create + stringlocale + stringbundlename + boolfallback + + + Procedural style + + + ResourceBundle + resourcebundle_create + stringlocale + stringbundlename + boolfallback + + + Object oriented style (constructor): + + + ResourceBundle::__construct + stringlocale + stringbundlename + boolfallback + + + Creates a resource bundle. + + + + + &reftitle.parameters; + + + + locale + + + Locale for which the resources should be loaded (locale name, e.g. en_CA). + + + + + bundlename + + + The directory where the data is stored or the name of the .dat file. + + + + + fallback + + + Whether locale should match exactly or fallback to parent locale is allowed. + + + + + + + + + + &reftitle.returnvalues; + + Returns ResourceBundle object or &false; on error. + + + + + &reftitle.examples; + + <function>resourcebundle_create</function> example + + +]]> + + + + <function>ResourceBundle::create</function> example + + +]]> + + + &example.outputs; + + + + + + + &reftitle.seealso; + + + resourcebundle_get + + + + + + diff --git a/reference/intl/resourcebundle/get-error-code.xml b/reference/intl/resourcebundle/get-error-code.xml new file mode 100644 index 0000000000..f970f78c54 --- /dev/null +++ b/reference/intl/resourcebundle/get-error-code.xml @@ -0,0 +1,120 @@ + + + + + ResourceBundle::getErrorCode + resourcebundle_get_error_code + Get bundle's last error code. + + + + &reftitle.description; + + Object oriented style + + + int + ResourceBundle::getErrorCode + + + + Procedural style + + + int + resourcebundle_get_error_code + ResourceBundler + + + Get error code from the last function performed by the bundle object. + + + + + &reftitle.parameters; + + + + r + + + ResourceBundle object. + + + + + + + + + + &reftitle.returnvalues; + + Returns error code from last bundle object call. + + + + + &reftitle.examples; + + <function>resourcebundle_get_error_code</function> example + + +]]> + + + + OO example + + +]]> + + + + + + &reftitle.seealso; + + + resourcebundle_get_error_message + intl_get_error_code + intl_is_failure + + + + + + diff --git a/reference/intl/resourcebundle/get-error-message.xml b/reference/intl/resourcebundle/get-error-message.xml new file mode 100644 index 0000000000..4a0fe1a29f --- /dev/null +++ b/reference/intl/resourcebundle/get-error-message.xml @@ -0,0 +1,120 @@ + + + + + ResourceBundle::getErrorMessage + resourcebundle_get_error_message + Get bundle's last error message. + + + + &reftitle.description; + + Object oriented style + + + string + ResourceBundle::getErrorMessage + + + + Procedural style + + + string + resourcebundle_get_error_message + ResourceBundler + + + Get error message from the last function performed by the bundle object. + + + + + &reftitle.parameters; + + + + r + + + ResourceBundle object. + + + + + + + + + + &reftitle.returnvalues; + + Returns error message from last bundle object's call. + + + + + &reftitle.examples; + + <function>resourcebundle_get_error_message</function> example + + +]]> + + + + OO example + + +]]> + + + + + + &reftitle.seealso; + + + resourcebundle_get_error_code + intl_get_error_code + intl_is_failure + + + + + + diff --git a/reference/intl/resourcebundle/get.xml b/reference/intl/resourcebundle/get.xml new file mode 100644 index 0000000000..b9e9c23c52 --- /dev/null +++ b/reference/intl/resourcebundle/get.xml @@ -0,0 +1,129 @@ + + + + + ResourceBundle::get + resourcebundle_get + Get data from the bundle + + + + &reftitle.description; + + Object oriented style + + + mixed + ResourceBundle::get + string|intindex + + + Procedural style + + + mixed + resourcebundle_get + ResourceBundler + string|intindex + + + Get the data from the bundle by index or string key. + + + + + &reftitle.parameters; + + + + r + + + ResourceBundle object. + + + + + index + + + Data index, must be string or integer. + + + + + + + + + + &reftitle.returnvalues; + + 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 ResourceBundle object. + + + + + &reftitle.examples; + + <function>resourcebundle_get</function> example + + +]]> + + + + OO example + +get('somestring'); +?> +]]> + + &example.outputs; + + + + + + + + &reftitle.seealso; + + + resourcebundle_count + + + + + + diff --git a/reference/intl/resourcebundle/locales.xml b/reference/intl/resourcebundle/locales.xml new file mode 100644 index 0000000000..87b2df05ee --- /dev/null +++ b/reference/intl/resourcebundle/locales.xml @@ -0,0 +1,122 @@ + + + + + ResourceBundle::getLocales + resourcebundle_locales + Get supported locales + + + + &reftitle.description; + + Object oriented style + + + array + ResourceBundle::getLocales + + + + Procedural style + + + array + resourcebundle_locales + ResourceBundler + + + 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. + + + + + &reftitle.parameters; + + + + r + + + ResourceBundle object. + + + + + + + + + + &reftitle.returnvalues; + + Returns the list of locales supported by the bundle. + + + + + &reftitle.examples; + + <function>resourcebundle_locales</function> example + + +]]> + + + + OO example + +getLocales()); +?> +]]> + + &example.outputs; + + + + + + + + &reftitle.seealso; + + + resourcebundle_get + + + + + +