phpdoc/I18n/I18n.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="robots" content="index, follow, all" />
<title>I18n\I18n | Internationalization</title>
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="../css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="../css/sami.css">
<script src="../js/jquery-1.11.1.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/typeahead.min.js"></script>
<script src="../sami.js"></script>
<meta name="MobileOptimized" content="width">
<meta name="HandheldFriendly" content="true">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
</head>
<body id="class" data-name="class:I18n_I18n" data-root-path="../">
<div id="content">
<div id="left-column">
<div id="control-panel">
<form id="search-form" action="../search.html" method="GET">
<span class="glyphicon glyphicon-search"></span>
<input name="search"
class="typeahead form-control"
type="search"
placeholder="Search">
</form>
</div>
<div id="api-tree"></div>
</div>
<div id="right-column">
<nav id="site-nav" class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-elements">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../index.html">Internationalization</a>
</div>
<div class="collapse navbar-collapse" id="navbar-elements">
<ul class="nav navbar-nav">
<li><a href="../classes.html">Classes</a></li>
<li><a href="../namespaces.html">Namespaces</a></li>
<li><a href="../interfaces.html">Interfaces</a></li>
<li><a href="../traits.html">Traits</a></li>
<li><a href="../doc-index.html">Index</a></li>
<li><a href="../search.html">Search</a></li>
</ul>
</div>
</div>
</nav>
<div class="namespace-breadcrumbs">
<ol class="breadcrumb">
<li><span class="label label-default">class</span></li>
<li><a href="../I18n.html">I18n</a></li>
<li>I18n</li>
</ol>
</div>
<div id="page-content">
<div class="page-header">
<h1>I18n</h1>
</div>
<p> class
<strong>I18n</strong> extends <abbr title="Patterns\Abstracts\AbstractSingleton">AbstractSingleton</abbr> implements
<abbr title="Patterns\Interfaces\TranslatableInterface">TranslatableInterface</abbr>
</p>
<div class="description">
<p>Internationalization class</p> <p>For more information, see:
- <a href="http://www.unicode.org/reports/tr35/">http://www.unicode.org/reports/tr35/</a>
- <a href="http://userguide.icu-project.org/locale">http://userguide.icu-project.org/locale</a>
- <a href="http://userguide.icu-project.org/formatparse/datetime">http://userguide.icu-project.org/formatparse/datetime</a>
- <a href="http://www.php.net/manual/en/book.intl.php">http://www.php.net/manual/en/book.intl.php</a></p> </div>
<h2>Methods</h2>
<div class="container-fluid underlined">
<div class="row">
<div class="col-md-2 type">
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a>
</div>
<div class="col-md-8 type">
<a href="#method_setLoader">setLoader</a>(
<abbr title="I18n\I18n\LoaderInterface">LoaderInterface</abbr> $loader)
<p>Store the loader</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
<a href="../I18n/LoaderInterface.html"><abbr title="I18n\LoaderInterface">LoaderInterface</abbr></a>
</div>
<div class="col-md-8 type">
<a href="#method_getLoader">getLoader</a>()
<p>Gets the loader</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
</div>
<div class="col-md-8 type">
<a href="#method_loadFile">loadFile</a>(
string $file_name,
null|string $dir_name = null)
<p>Load a new language file</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a>
</div>
<div class="col-md-8 type">
<a href="#method_setLanguage">setLanguage</a>(
string $lang,
bool $throw_errors = true,
bool $force_rebuild = false)
<p>Loads a new language</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getLanguage">getLanguage</a>()
<p>Get the current language code used</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a>
</div>
<div class="col-md-8 type">
<a href="#method_setDefaultFromHttp">setDefaultFromHttp</a>()
<p>Try to get the browser default locale and use it</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
bool
</div>
<div class="col-md-8 type">
<a href="#method_isAvailableLanguage">isAvailableLanguage</a>(
string $lang)
<p>Check if a language code is available in the Loader</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
null|string
</div>
<div class="col-md-8 type">
<a href="#method_getAvailableLocale">getAvailableLocale</a>(
string $lang)
<p>Get the full locale info for a language code</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
array
</div>
<div class="col-md-8 type">
<a href="#method_getAvailableLanguages">getAvailableLanguages</a>()
<p>Get the list of <code>Loader::available_languages</code></p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a>
</div>
<div class="col-md-8 type">
<a href="#method_setLocale">setLocale</a>(
string $locale)
<p>Define a new locale for the system</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getLocale">getLocale</a>()
<p>Get the current locale used by the system</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a>
</div>
<div class="col-md-8 type">
<a href="#method_setTimezone">setTimezone</a>(
string $timezone)
<p>Define a new timezone for the system</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getTimezone">getTimezone</a>()
<p>Get the current timezone used by the system</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
bool
</div>
<div class="col-md-8 type">
<a href="#method_hasLocalizedString">hasLocalizedString</a>(
string $index)
<p>Check if a translation exists for an index</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getLocalizedString">getLocalizedString</a>(
string $index)
<p>Get the translation of an index</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_parseString">parseString</a>(
string $str,
array $arguments = null)
<p>Parse a translated string making some parameters replacements</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
array
</div>
<div class="col-md-8 type">
<a href="#method_parseStringMetadata">parseStringMetadata</a>(
string $str)
<p>Get the meta-data of a language string</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getCurrency">getCurrency</a>(
string $lang = null)
<p>Get the currency of the current locale</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getHttpHeaderLocale">getHttpHeaderLocale</a>()
<p>Get the browser requested locale if so</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
array
</div>
<div class="col-md-8 type">
<a href="#method_getAvailableLanguagesNames">getAvailableLanguagesNames</a>(
string $lang = null)
<p>Get the full list of <code>Loader::available_languages</code> option like human readable names</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getLanguageCode">getLanguageCode</a>(
string $lang = null)
<p>Get the language code of the current locale</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getRegionCode">getRegionCode</a>(
string $lang = null)
<p>Get the region code of the current locale</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getScriptCode">getScriptCode</a>(
string $lang = null)
<p>Get the script code of the current locale</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
array
</div>
<div class="col-md-8 type">
<a href="#method_getKeywords">getKeywords</a>(
string $lang = null)
<p>Get the keywords of the current locale</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
null|string
</div>
<div class="col-md-8 type">
<a href="#method_getKeyword">getKeyword</a>(
string $keyword,
string $lang = null)
<p>Get one keyword value of the current locale</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getPrimaryLanguage">getPrimaryLanguage</a>(
string $for_locale = null,
string $lang = null)
<p>Get the primary language of a locale</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getLanguageName">getLanguageName</a>(
string $for_locale = null,
string $lang = null)
<p>Get the language name of a locale</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getCountryName">getCountryName</a>(
string $for_locale = null,
string $lang = null)
<p>Get the country name of a locale</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getLocaleScript">getLocaleScript</a>(
string $for_locale = null,
string $lang = null)
<p>Get the script name of a locale</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
string
</div>
<div class="col-md-8 type">
<a href="#method_getLocaleVariant">getLocaleVariant</a>(
string $for_locale = null,
string $lang = null)
<p>Get the variant name of a locale</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
static
string
</div>
<div class="col-md-8 type">
<a href="#method_getLocalizedNumberString">getLocalizedNumberString</a>(
int $number,
string $lang = null)
<p>Get a localized number value</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
static
string
</div>
<div class="col-md-8 type">
<a href="#method_getLocalizedPriceString">getLocalizedPriceString</a>(
int $number,
string $lang = null)
<p>Get a localized price value</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
static
string
</div>
<div class="col-md-8 type">
<a href="#method_getLocalizedDateString">getLocalizedDateString</a>(
<a target="_blank" href="http://php.net/DateTime"><abbr title="DateTime">DateTime</abbr></a> $date,
string $mask = null,
string $charset = 'UTF-8',
string $lang = null)
<p>Get a localized date value</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
static
string
</div>
<div class="col-md-8 type">
<a href="#method_translate">translate</a>(
string $index,
array $args = null,
string $lang = null)
<p>Process a translation with arguments</p> </div>
<div class="col-md-2"></div>
</div>
<div class="row">
<div class="col-md-2 type">
static
string
</div>
<div class="col-md-8 type">
<a href="#method_pluralize">pluralize</a>(
array $indexes = array(),
int $number,
array $args = null,
string $lang = null)
<p>Process a translation with arguments depending on a counter</p> </div>
<div class="col-md-2"></div>
</div>
</div>
<h2>Details</h2>
<div id="method-details">
<div class="method-item">
<h3 id="method_setLoader">
<div class="location">at line 212</div>
<code>
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a>
<strong>setLoader</strong>(
<abbr title="I18n\I18n\LoaderInterface">LoaderInterface</abbr> $loader)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Store the loader</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
<abbr title="I18n\I18n\LoaderInterface">LoaderInterface</abbr></td>
<td>$loader</td>
<td>
</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a></td>
<td>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getLoader">
<div class="location">at line 223</div>
<code>
<a href="../I18n/LoaderInterface.html"><abbr title="I18n\LoaderInterface">LoaderInterface</abbr></a>
<strong>getLoader</strong>()</code>
</h3>
<div class="details">
<div class="method-description">
<p>Gets the loader</p> </div>
<div class="tags">
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
<a href="../I18n/LoaderInterface.html"><abbr title="I18n\LoaderInterface">LoaderInterface</abbr></a></td>
<td>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_loadFile">
<div class="location">at line 235</div>
<code>
<strong>loadFile</strong>(
string $file_name,
null|string $dir_name = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Load a new language file</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$file_name</td>
<td>
</td>
</tr>
<tr>
<td>
null|string</td>
<td>$dir_name</td>
<td>
</td>
</tr>
</table>
<h4>Exceptions</h4>
<table class="table table-condensed">
<tr>
<td><a href="../I18n/I18nException.html"><abbr title="I18n\I18nException">I18nException</abbr></a></td>
<td>
</td>
</tr>
<tr>
<td><a target="_blank" href="http://php.net/Exception"><abbr title="Exception">Exception</abbr></a></td>
<td>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_setLanguage">
<div class="location">at line 273</div>
<code>
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a>
<strong>setLanguage</strong>(
string $lang,
bool $throw_errors = true,
bool $force_rebuild = false)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Loads a new language</p> <p>This will actually define a new default Locale and load the language strings database.</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$lang</td>
<td>A language code to use by default</td>
</tr>
<tr>
<td>
bool</td>
<td>$throw_errors</td>
<td>Throw errors while re-creating the databases (default is <code>false</code>)</td>
</tr>
<tr>
<td>
bool</td>
<td>$force_rebuild</td>
<td>Force the system to rebuild the databases using <code>I18n\Generator</code> (default is <code>false</code>)</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a></td>
<td>Returns <code>$this</code> for method chaining</td>
</tr>
</table>
<h4>Exceptions</h4>
<table class="table table-condensed">
<tr>
<td><a href="../I18n/I18nInvalidArgumentException.html"><abbr title="I18n\I18nInvalidArgumentException">I18nInvalidArgumentException</abbr></a></td>
<td>it the language is not available</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getLanguage">
<div class="location">at line 293</div>
<code>
string
<strong>getLanguage</strong>()</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the current language code used</p> </div>
<div class="tags">
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The current language code in use</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_setDefaultFromHttp">
<div class="location">at line 303</div>
<code>
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a>
<strong>setDefaultFromHttp</strong>()</code>
</h3>
<div class="details">
<div class="method-description">
<p>Try to get the browser default locale and use it</p> </div>
<div class="tags">
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a></td>
<td>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_isAvailableLanguage">
<div class="location">at line 318</div>
<code>
bool
<strong>isAvailableLanguage</strong>(
string $lang)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Check if a language code is available in the Loader</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$lang</td>
<td>A language code to use by default</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
bool</td>
<td>Returns <code>true</code> if the language code exists, <code>false</code> otherwise</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getAvailableLocale">
<div class="location">at line 333</div>
<code>
null|string
<strong>getAvailableLocale</strong>(
string $lang)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the full locale info for a language code</p> <p>This will look in the <code>Loader::available_languages</code> option to retrieve the full
locale string corresponding to a language code.</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$lang</td>
<td>A language code to use by default</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
null|string</td>
<td>The full locale string if found</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getAvailableLanguages">
<div class="location">at line 349</div>
<code>
array
<strong>getAvailableLanguages</strong>()</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the list of <code>Loader::available_languages</code></p> </div>
<div class="tags">
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
array</td>
<td>The array defined in the Loader</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_setLocale">
<div class="location">at line 363</div>
<code>
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a>
<strong>setLocale</strong>(
string $locale)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Define a new locale for the system</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$locale</td>
<td>The full locale string to define</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a></td>
<td>Returns <code>$this</code> for method chaining</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getLocale">
<div class="location">at line 374</div>
<code>
string
<strong>getLocale</strong>()</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the current locale used by the system</p> </div>
<div class="tags">
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The full locale string currently in use</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_setTimezone">
<div class="location">at line 385</div>
<code>
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a>
<strong>setTimezone</strong>(
string $timezone)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Define a new timezone for the system</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$timezone</td>
<td>The full timezone string to define</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
<a href="../I18n/I18n.html"><abbr title="I18n\I18n">I18n</abbr></a></td>
<td>
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getTimezone">
<div class="location">at line 397</div>
<code>
string
<strong>getTimezone</strong>()</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the current timezone used by the system</p> </div>
<div class="tags">
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The full timezone string currently in use</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_hasLocalizedString">
<div class="location">at line 408</div>
<code>
bool
<strong>hasLocalizedString</strong>(
string $index)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Check if a translation exists for an index</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$index</td>
<td>The original string or index to find translation of</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
bool</td>
<td>Returns <code>true</code> if the translation exists, <code>false</code> otherwise</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getLocalizedString">
<div class="location">at line 419</div>
<code>
string
<strong>getLocalizedString</strong>(
string $index)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the translation of an index</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$index</td>
<td>The original string or index to find translation of</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The translation found if so, <code>$index</code> otherwise</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_parseString">
<div class="location">at line 432</div>
<code>
string
<strong>parseString</strong>(
string $str,
array $arguments = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Parse a translated string making some parameters replacements</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$str</td>
<td>The original string to work on</td>
</tr>
<tr>
<td>
array</td>
<td>$arguments</td>
<td>A table of arguments to replace, like <code>var=>val</code> pairs for
the replacement of <code>%var%</code> by <code>val</code> in the final string (by default)</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The string with replacements</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_parseStringMetadata">
<div class="location">at line 454</div>
<code>
array
<strong>parseStringMetadata</strong>(
string $str)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the meta-data of a language string</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$str</td>
<td>
</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
array</td>
<td>array( (string) $str , (array) $info )</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getCurrency">
<div class="location">at line 503</div>
<code>
string
<strong>getCurrency</strong>(
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the currency of the current locale</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The currency code for the current locale</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getHttpHeaderLocale">
<div class="location">at line 522</div>
<code>
string
<strong>getHttpHeaderLocale</strong>()</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the browser requested locale if so</p> </div>
<div class="tags">
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The browser prefered locale</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getAvailableLanguagesNames">
<div class="location">at line 534</div>
<code>
array
<strong>getAvailableLanguagesNames</strong>(
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the full list of <code>Loader::available_languages</code> option like human readable names</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
array</td>
<td>The available languages table with the value as the human readable description
of the corresponding locale</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getLanguageCode">
<div class="location">at line 559</div>
<code>
string
<strong>getLanguageCode</strong>(
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the language code of the current locale</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The language code for the current locale</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getRegionCode">
<div class="location">at line 571</div>
<code>
string
<strong>getRegionCode</strong>(
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the region code of the current locale</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The region code for the current locale</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getScriptCode">
<div class="location">at line 582</div>
<code>
string
<strong>getScriptCode</strong>(
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the script code of the current locale</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The script code for the current locale</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getKeywords">
<div class="location">at line 593</div>
<code>
array
<strong>getKeywords</strong>(
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the keywords of the current locale</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
array</td>
<td>The keywords for the current locale</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getKeyword">
<div class="location">at line 605</div>
<code>
null|string
<strong>getKeyword</strong>(
string $keyword,
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get one keyword value of the current locale</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$keyword</td>
<td>The keyword to search</td>
</tr>
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
null|string</td>
<td>The keyword value for the current locale if found</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getPrimaryLanguage">
<div class="location">at line 618</div>
<code>
string
<strong>getPrimaryLanguage</strong>(
string $for_locale = null,
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the primary language of a locale</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$for_locale</td>
<td>The locale to work on, by default this will be the current locale</td>
</tr>
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use, by default this will be the current locale</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The primary language for the locale in the requested language</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getLanguageName">
<div class="location">at line 630</div>
<code>
string
<strong>getLanguageName</strong>(
string $for_locale = null,
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the language name of a locale</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$for_locale</td>
<td>The locale to work on, by default this will be the current locale</td>
</tr>
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use, by default this will be the current locale</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The language name for the locale in the requested language</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getCountryName">
<div class="location">at line 642</div>
<code>
string
<strong>getCountryName</strong>(
string $for_locale = null,
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the country name of a locale</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$for_locale</td>
<td>The locale to work on, by default this will be the current locale</td>
</tr>
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use, by default this will be the current locale</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The country name for the locale in the requested language</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getLocaleScript">
<div class="location">at line 654</div>
<code>
string
<strong>getLocaleScript</strong>(
string $for_locale = null,
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the script name of a locale</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$for_locale</td>
<td>The locale to work on, by default this will be the current locale</td>
</tr>
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use, by default this will be the current locale</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The script name for the locale in the requested language</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getLocaleVariant">
<div class="location">at line 666</div>
<code>
string
<strong>getLocaleVariant</strong>(
string $for_locale = null,
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get the variant name of a locale</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$for_locale</td>
<td>The locale to work on, by default this will be the current locale</td>
</tr>
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use, by default this will be the current locale</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The variant name for the locale in the requested language</td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getLocalizedNumberString">
<div class="location">at line 710</div>
<code> static
string
<strong>getLocalizedNumberString</strong>(
int $number,
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get a localized number value</p> <p>This is called by aliases <code>_N</code> and <code>numberify</code>.</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
int</td>
<td>$number</td>
<td>The number value to parse</td>
</tr>
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use, by default this will be the current locale</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The number value written in the locale</td>
</tr>
</table>
<h4>See also</h4>
<table class="table table-condensed">
<tr>
<td>_N()</td>
<td></td>
</tr>
<tr>
<td>numberify()</td>
<td></td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getLocalizedPriceString">
<div class="location">at line 736</div>
<code> static
string
<strong>getLocalizedPriceString</strong>(
int $number,
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get a localized price value</p> <p>This is called by aliases <code>_C</code> and <code>currencify</code>.</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
int</td>
<td>$number</td>
<td>The price value to parse</td>
</tr>
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use, by default this will be the current locale</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The price value written in the locale with a currency sign</td>
</tr>
</table>
<h4>See also</h4>
<table class="table table-condensed">
<tr>
<td>_C()</td>
<td></td>
</tr>
<tr>
<td>currencify()</td>
<td></td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_getLocalizedDateString">
<div class="location">at line 765</div>
<code> static
string
<strong>getLocalizedDateString</strong>(
<a target="_blank" href="http://php.net/DateTime"><abbr title="DateTime">DateTime</abbr></a> $date,
string $mask = null,
string $charset = 'UTF-8',
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Get a localized date value</p> <p>This is called by aliases <code>_D</code> and <code>datify</code>.</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
<a target="_blank" href="http://php.net/DateTime"><abbr title="DateTime">DateTime</abbr></a></td>
<td>$date</td>
<td>The date value to parse as a <code>DateTime</code> object</td>
</tr>
<tr>
<td>
string</td>
<td>$mask</td>
<td>A mask to use for date writing (by default, the <code>datetime_mask_icu</code> translation
string will be used, or no mask at all if it is not defined)</td>
</tr>
<tr>
<td>
string</td>
<td>$charset</td>
<td>The charset to use (default is <code>utf-8</code>)</td>
</tr>
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language to use, by default this will be the current locale</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>The date value written in the locale</td>
</tr>
</table>
<h4>See also</h4>
<table class="table table-condensed">
<tr>
<td>_D()</td>
<td></td>
</tr>
<tr>
<td>datify()</td>
<td></td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_translate">
<div class="location">at line 817</div>
<code> static
string
<strong>translate</strong>(
string $index,
array $args = null,
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Process a translation with arguments</p> <p>This is the core method of the class: it searches the translation of <code>$index</code> in the
current language, rebuilds it replacing the keys of <code>$args</code> by their values and returns
the corresponding localized translated string.</p>
<p>This is called by aliases <code>_T</code> and <code>translate</code>.</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>$index</td>
<td>The index of the translation</td>
</tr>
<tr>
<td>
array</td>
<td>$args</td>
<td>The optional array of arguments for the final string replacements</td>
</tr>
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language code to load translation from</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>Returns the translated string if it exists in the current language, with variables replacements</td>
</tr>
</table>
<h4>See also</h4>
<table class="table table-condensed">
<tr>
<td>_T()</td>
<td></td>
</tr>
<tr>
<td>translate()</td>
<td></td>
</tr>
</table>
</div>
</div>
</div>
<div class="method-item">
<h3 id="method_pluralize">
<div class="location">at line 859</div>
<code> static
string
<strong>pluralize</strong>(
array $indexes = array(),
int $number,
array $args = null,
string $lang = null)</code>
</h3>
<div class="details">
<div class="method-description">
<p>Process a translation with arguments depending on a counter</p> <p>This will first choose in <code>$indexes</code> the corresponding value for the counter <code>$number</code>
and then process the translation of the chosen string with arguments.</p>
<p>This is called by aliases <code>_P</code> and <code>pluralize</code>.</p> </div>
<div class="tags">
<h4>Parameters</h4>
<table class="table table-condensed">
<tr>
<td>
array</td>
<td>$indexes</td>
<td>An array of translation strings indexes to choose in considering the counter value</td>
</tr>
<tr>
<td>
int</td>
<td>$number</td>
<td>The value of the counter to consider</td>
</tr>
<tr>
<td>
array</td>
<td>$args</td>
<td>The optional array of arguments for the final string replacements</td>
</tr>
<tr>
<td>
string</td>
<td>$lang</td>
<td>The language code to load translation from</td>
</tr>
</table>
<h4>Return Value</h4>
<table class="table table-condensed">
<tr>
<td>
string</td>
<td>Returns the translated string fot the counter value if it exists, in the current language and with variables replacements</td>
</tr>
</table>
<h4>See also</h4>
<table class="table table-condensed">
<tr>
<td>_P()</td>
<td></td>
</tr>
<tr>
<td>pluralize()</td>
<td></td>
</tr>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="footer">
Generated by <a href="http://sami.sensiolabs.org/">Sami, the API Documentation Generator</a>.
</div>
</div>
</div>
</body>
</html>