23 lines
3.0 KiB
HTML
23 lines
3.0 KiB
HTML
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Adding a new locale</title><link rel="stylesheet" type="text/css" href="manual.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.0"><link rel="home" href="index.html" title="JpGraph Manual"><link rel="up" href="ch06.html" title="Chapter 6. Error handling"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Adding a new locale</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center">Chapter 6. Error handling</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="sect1" title="Adding a new locale"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2495754"></a>Adding a new locale</h2></div></div></div>
|
||
|
||
<p>All error messages are stored in an array with a specific index that cannot be
|
||
changed. This index is used in the library to reference a specific error message. </p>
|
||
<p>Since error messages can also have additional parameters the error messages also
|
||
includes count that specifies how many arguments must be handled to enable some
|
||
error checking when using the error message in the code (to make sure we have enough
|
||
arguments).</p>
|
||
<p>The arguments are formatted in the error text in the same way as parameters in the
|
||
<code class="code">printf()</code> family of functions.</p>
|
||
<p>To create a localized error resource file You should first copy the
|
||
"<code class="filename">en.inc.php</code>" to a temporary file, rename it according to
|
||
the locale you are creating and then translate each error message according to the
|
||
locale. The make sure that the file is stored under the
|
||
"<code class="filename">jpgraph/lang/</code>" catalogue and the new localized error
|
||
messages can be used. </p>
|
||
<p>For example. To create a French version of the error messages the
|
||
<code class="filename">lang/en.inc.php</code> should be copied to
|
||
<code class="filename">lang/fr.inc.php</code> and the error messages translated. The
|
||
French locale can then be used by using the string "<code class="code">fr</code>" as identified
|
||
in <code class="code">SettErrLocale()</code> as described above.</p>
|
||
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"><a accesskey="u" href="ch06.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>
|