This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.
<html><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"><title>Adding a new locale</title><linkrel="stylesheet"type="text/css"href="manual.css"><metaname="generator"content="DocBook XSL Stylesheets V1.76.0"><linkrel="home"href="index.html"title="JpGraph Manual"><linkrel="up"href="ch06.html"title="Chapter6.Error handling"></head><bodybgcolor="white"text="black"link="#0000FF"vlink="#840084"alink="#0000FF"><divclass="navheader"><tablewidth="100%"summary="Navigation header"><tr><thcolspan="3"align="center">Adding a new locale</th></tr><tr><tdwidth="20%"align="left"></td><thwidth="60%"align="center">Chapter6.Error handling</th><tdwidth="20%"align="right"></td></tr></table><hr></div><divclass="sect1"title="Adding a new locale"><divclass="titlepage"><div><div><h2class="title"style="clear: both"><aname="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
<codeclass="code">printf()</code> family of functions.</p>
<p>To create a localized error resource file You should first copy the
"<codeclass="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
"<codeclass="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
<codeclass="filename">lang/en.inc.php</code> should be copied to
<codeclass="filename">lang/fr.inc.php</code> and the error messages translated. The
French locale can then be used by using the string "<codeclass="code">fr</code>" as identified
in <codeclass="code">SettErrLocale()</code> as described above.</p>