Location: PHPKode > projects > Aukyla Platform > aukyla/doc/html/a00119.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>Aukyla PHP Framework</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="StyleSheet" href="auton.css" type="text/css" media="screen">
  </head>

  <body>
    <div id="mainmenu">
      <a href="http://www.auton.nl/" class="home">Home</a>
    </div>
    <div id="submenu">
      <a class="logo" href="http://www.auton.nl/"></a>

      <div class="head">Ads</div>
      <a href="http://sourceforge.net/"><img src="http://sourceforge.net/sflogo.php?group_id=116358&amp;type=1" alt="SourceForge.net Logo" style="padding: 2px 4px; width: 88px; height: 31px; border: 0px"></a>
      <a href="http://getfirefox.com/" title="Get Firefox - The Browser, Reloaded."><img src="http://www.mozilla.org/products/firefox/buttons/getfirefox_small.png" alt="Get Firefox" style="width: 110px; height: 32px; border: 0px"></a>
    </div>
    <div id="main">
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="index.html">Main&nbsp;Page</a> | <a class="qindex" href="hierarchy.html">Class&nbsp;Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical&nbsp;List</a> | <a class="qindex" href="annotated.html">Class&nbsp;List</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Class&nbsp;Members</a> | <a class="qindex" href="pages.html">Related&nbsp;Pages</a></div>
<h1>Locale Class Reference</h1><a href="a00046.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
Provides localization functions. 
<p>
Currently the only localization offered is translation of messages to the user's language.<p>
The most important functions for use with this class are the static <a class="el" href="a00119.html#e0">init()</a> function and the related <a class="el" href="a00119.html#m0">i18n()</a> function.<p>
For information about generating translations, please refer to the "Creating translations" section on the Main Page. 
<p>

<p>
Definition at line <a class="el" href="a00219.html#l00037">37</a> of file <a class="el" href="a00219.html">Locale.php</a>.<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00119.html#a0">__construct</a> ()</td></tr>

<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00119.html#e0">init</a> ($modulename, $language= '')</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00119.html#e1">language</a> ()</td></tr>

<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00119.html#e2">availableLanguages</a> ()</td></tr>

<tr><td colspan="2"><br><h2>Related Functions</h2></td></tr>
<tr><td colspan="2">(Note that these are not member functions.) <br><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00119.html#m0">i18n</a> ($string)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Translates a string to the user's language.  <a href="#m0"></a><br></td></tr>
</table>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="a0" doxytag="Locale::__construct"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">Locale::__construct           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Constructor.<p>
You do not have to instantiate this class yourself, instead you can use the static functions provided by this class.
<p>
Definition at line <a class="el" href="a00219.html#l00045">45</a> of file <a class="el" href="a00219.html">Locale.php</a>.    </td>
  </tr>
</table>
<a class="anchor" name="e2" doxytag="Locale::availableLanguages"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">Locale::availableLanguages           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Returns a list of available languages.<p>
<dl compact><dt><b>Returns:</b></dt><dd>An array containing <code>code</code> =&gt; <code>language</code> pairs where <code>code</code> is the language code and <code>language</code> is the full name of the language.</dd></dl>

<p>
Definition at line <a class="el" href="a00219.html#l00189">189</a> of file <a class="el" href="a00219.html">Locale.php</a>.    </td>
  </tr>
</table>
<a class="anchor" name="e0" doxytag="Locale::init"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">Locale::init           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname" nowrap> <em>modulename</em>, </td>
        </tr>
        <tr>
          <td class="md" nowrap align="right"></td>
          <td class="md"></td>
          <td class="md" nowrap>$&nbsp;</td>
          <td class="mdname" nowrap> <em>language</em> = <code>''</code></td>
        </tr>
        <tr>
          <td class="md"></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"><code> [static]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Initializes the translations for a module. Every module which has its own translation file should call this function once to load the translations before it does a call to the <a class="el" href="a00119.html#m0">i18n()</a> function.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>modulename</em>&nbsp;</td><td>The name of a module whose translations should be initialized, like 'base' or 'plugins/Frontends/Dummy'. </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>language</em>&nbsp;</td><td>The language for which the translations should be loaded. If this argument is ommitted, the currently active language is used (which is probably what you want most of the time).</td></tr>
  </table>
</dl>
<dl compact><dt><b>Note:</b></dt><dd>Setting <code>language</code> to a different setting than the currently set language will reset <em>all</em> previously loaded translations.</dd></dl>

<p>
Definition at line <a class="el" href="a00219.html#l00066">66</a> of file <a class="el" href="a00219.html">Locale.php</a>.
<p>
Referenced by <a class="el" href="a00220.html#l00115">Login::login()</a>.    </td>
  </tr>
</table>
<a class="anchor" name="e1" doxytag="Locale::language"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">Locale::language           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [static]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Returns the currently used language.
<p>
Definition at line <a class="el" href="a00219.html#l00175">175</a> of file <a class="el" href="a00219.html">Locale.php</a>.    </td>
  </tr>
</table>
<hr><h2>Friends And Related Function Documentation</h2>
<a class="anchor" name="m0" doxytag="Locale::i18n"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
  <tr>
    <td class="mdRow">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top">i18n           </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">$&nbsp;</td>
          <td class="mdname1" valign="top" nowrap> <em>string</em>          </td>
          <td class="md" valign="top">&nbsp;)&nbsp;</td>
          <td class="md" nowrap><code> [related]</code></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Translates a string to the user's language. 
<p>
If no translation for the string can be found, the string remains unchanged.<p>
You can specify a maximum of 9 arguments which should be expanded inside the string. Argument expansion is done even when the string itself can't be translated. You should use these arguments instead of variables directly in the string, because the use of variables would make the string to be translated itself variable, which will most likely result in the system not being able to find a suitable translation.<p>
<b>Example: </b> <div class="fragment"><pre class="fragment"> <a class="code" href="a00119.html#m0">i18n</a>('%1 apple(s) and %2 banana(s)', $apples, $bananas)
</pre></div>expands to <div class="fragment"><pre class="fragment"> <span class="stringliteral">"$apples apple(s) and $bananas banana(s)"</span>
</pre></div>in the user's language.<p>
<dl compact><dt><b>Warning:</b></dt><dd>The string you specify may contain Aukyla XML data, but providing any non-valid XML data will result in errors in the <a class="el" href="a00134.html">Output</a> system. This also means special characters like double quotes should be escaped using XML entities. </dd></dl>

<p>
Definition at line <a class="el" href="a00219.html#l00241">241</a> of file <a class="el" href="a00219.html">Locale.php</a>.    </td>
  </tr>
</table>
<hr>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="a00219.html">Locale.php</a></ul>
    </div>
  </body>
</html>
Return current item: Aukyla Platform