All error messages that can be generated by the library are listed in Appendix H
The library includes two (actually two and one pseudo) localizations of the error messages. As of version 2.5 the library supports English and German error messages. The choice of which localization of error messages that should be used can be done in two ways; either by specifying a global define in jpg-config.inc.php or
As of version 2.5 there are three localization options
English error messages ("en")
German error messages ("de")
Production error messages. This is not really a localization but a different set of error messages which does not give detailed error messages but a generic message suitable for a production server where the end user is not helped by detailed graph script errors. Instead a generic message is shown together with an error code that corresponds to the detailed error. ("prod")
In order to specify the error message localization the following
define in jpg-config.inc.php
must be set the
define('DEFAULT_ERR_LOCALE','en');
The possible (string) options are
"en", English locale
"de", German locale
"prod", The production version of the error messages.
It is also possible to dynamically set the localization of error
messages by calling the static method
JpGraphErr::SetErrLocale($aLocaleString)
.For example, in order
to dynamically change to German locale the following method call would be
used:
JpGraphErr::SetErrLocale('de');
As an example of the German locale the "Header Already Sent" error message localized in German are shown in Figure 6.3
There is one potential issue with specifying the locale dynamically. Since
the call to set the locale happens in the script at a certain point this
means that if the error occur before that point the locale change has not
yet happened and the default locale specified in
jpg-config.inc.php
will be used.
On a production server it is common not to show detailed specific error messages to the public which could potentially give a away security vulnerabilities. For this purpose there is a "pseudo" locale of the error messages. This is specified by setting the locale (as described above) to the string "prod". If this is done a generic error message with an error code will be shown instead. The custom support receiving information on this error can then pass on the detailed error code to the development team for further investigation. In Figure 6.4 the same error as is shown in Figure 6.1 is displayed using the "prod" locale. As you can see in this case only a more end-user appropriate message together with the error code is displayed.
The problem number corresponds to the error codes that are listed in Appendix H
It is possible to customize this "production" error message by
changing the actual text in the file
"lang/prod.inc.php
"