ERES provides many different features that allows you to generate reports for just about any locale and language. Different internationalization features can require different system or setting configurations depending on your specific requirements.
ERES allows different time zones and locales reports and charts. They are not limited to the locale on the machine where they are created. The locale can be set through API right before the report or chart is run.
For data formatting (date and numeric), ERES allows you to set locale-specific formatting for report elements. Locale-specific formatting allows data elements to be displayed in the correct format for the particular locale that is being used for the report. Locale-specific options are available in the data formatting dialog for Report Designer (see Section 4.1.3.7.3 - Data Formatting for Formulas and Column Fields).
The locale for report and charts, as well as the time zone, can be set at run-time through the API. Note that this only effects the date, the time, and the data formatting.
To set the time zone or locale, you can use the methods in QbReport/QbChart (applies to the entire report/chart) or use LocaleDateTimeFormat
and LocaleNumericFormat
objects (applies to a specific object in the report/chart). The following code fragments shows how to do this with two different approaches.
report.setLocale(Locale.UK); report.settime zone(time zone.gettime zone("GMT"));
Here, the formats are applied to the entire report. Alternatively, you can apply the format to specific data columns as follows:
LocaleNumericFormat currencyFormat = LocaleNumericFormat.getCurrencyInstance(); currencyFormat.setLocale(Locale.UK); int columnIndex = 2; //column 2 is the "Unit Price" column report.getTable().getColumn(columnIndex).setDataFormat(currencyFormat); LocaleDateTimeFormat dateFormat = LocaleDateTimeFormat.getDateInstance(); dateFormat.settime zone(time zone.gettime zone("GMT")); report.getPageFooter().getData(1).setDataFormat(dateFormat);
ERES includes a set of features that removes limitations caused by language differences. By utilizing a simple to use interface, it is possible to translate all text, buttons, and menus within ERES to a different language. Through some basic configuration, you will be able to import, view, and type characters in a foreign language, as well as save and export reports in that language.
Internationalization is supported through the use of an .xml
file, ERES_Language.xml
(located in the <ERES installation directory>). A GUI is provided to work with the ERES_Language.xml
file and replace the lines of English with those of another language.
The ERES_Language.xml
file has the following structure:
<Product name="REPORTDESIGNER" dir="quadbase/reportdesigner/designer"> <File name="ReportMenubar.java"> <CODE>File</CODE> <TEXT>File</TEXT> <CODE>New</CODE> <TEXT>New</TEXT> ... </File> </Product>
The file has the following tree structure: Text
between <Text>
and </Text>
with the translation. ERES will replace <Code>
with <Text>
in the Java Swing UI and/or in the ERES web application. The translation GUI will list all products and each product will list codes that need translation. A same code (for example, File
) may be listed under several products to maintain the completeness of each product. However, the translation for a code is duplicated across all products. The same code cannot have two different translations for different products.
The ERES_Language.xml
file is located in the install directory. It is recommended that you make a copy (of ERES_Language.xml
) and then use the GUI provided (on the copy) to put in the translation without touching the xml file directly. To utilize the user interface, navigate to the ERES root directory and enter the following command:
java -classpath "./lib/ERESOrganizer.jar;.;" quadbase.internationalization.TranslateWizard -file:<fileName> -enc:<encoding>
where <fileName>
represents the xml file that will store the translation and <encoding>
represents the encoding for the translation. For correct results, the proper encoding must be specified. If the file name and encoding are not provided, the default file name (ERES_Language.xml
) and default encoding (Cp1252
) will be used.
An example of the above command is given below:
java -classpath "./lib/ERESOrganizer.jar;.;" quadbase.internationalization.TranslateWizard -file:Chinese.xml -enc:gbk
Where gbk
is the encoding used to save Chinese.xml
file.
When the Translate wizard is started, it appears as below:
You can see the various codes (available for translation) by selecting appropriate Product. Products are shown in a tree on the left that contains all the files available for translation. For example, on the image below you can see expanded QUERYBUILDER product. You can either translate entire product by selecting the product node or just select a file that you want to translate.
The English texts are listed on the left and you can enter the translation on the right. The translation can be entered by clicking on the cell and typing in the text. The translation can be saved (to the file specified by the command that started the wizard) by clicking on the
button. You can navigate to the previous screen by clicking on the button. Note that if a translation for a code has already been set, it will appear for every instance of the code.You can use ERES_Language.xml
(or the copy you modified) in ERES Organizer by adding the -file
and -enc
arguments (e.g. -file:ERES_Language.xml
and -enc:UTF-8
) to the java web start (jnlp) file that starts Organizer (in ERESOrganizer.jnlp
).
For the web application, edit index.jsp
page as follows:
Add an import for the LanguageEncoder
class:
<%@page language="java" import="quadbase.common.util.internal.LanguageEncoder" errorPage = "MenuError.jsp" contentType="text/html; charset=UTF-8" %> <jsp:useBean id="index" scope="session" class="quadbase.auth.bean.Index" /> <jsp:setProperty name="index" property="*"/>
Add a few lines near the beginning of the jsp to load the language file.
<% quadbase.common.util.internal.LanguageEncoder.load("<language file>", "<encoding>"); index.setRequest(request, application); %>
where <language file>
is the language file (for example, Chinese.xml
) and <encoding>
is the encoding (for example, gbk
).
When the user upgrades to a newer version, the ERES_Language.xml
file needs to be upgraded as well. The language upgrade program will copy over the translations from the previously customized ERES_Language.xml
file and append the additional entries in the new version. To use the language upgrade program, navigate to the ERES directory from a console window and use the following command:
java -classpath ".;.\WEB-INF\lib\ERESServer.jar" quadbase.internationalization.UpgradeLanguageXMLFile -from:oldfile -to:newfile -enc:encoding
It may be necessary to replace the semicolon with colon and backslash with slash on non-Window environments.
Oldfile refers to the customized ERES_Language.xml
from a previous version of ERES, newfile refers to the ERES_Language.xml
included in the upgraded ERES installation, and the enc
is the language encoding used in the translation. After running the program, the resulting file will be named ERES_Language.xml
and you can open it with Translate Wizard to further translate any new entries.
Foreign characters can be easily displayed in Designer and various Viewers. To display foreign characters in a report/chart, you will need to have fonts for that language installed in your system. Then, in the report/chart, you can set the font for the object that contains foreign characters to the appropriate system font.
Another option is to modify the font.properties file in the JVM so that foreign characters are supported in the default JVM fonts. For Sun JVMs, the font.properties file is located under the jre/lib
directory. The different language files have names like font.properties.ru
for Russian, font.properties.zh
for Chinese, etc. To change the language settings for the JVM, rename the current font.properties
file to back it up and change the name of the desired language file to font.properties
. With the language settings changed in the JVM, the default fonts in ERES (Dialog, Serif, Monospaced, etc.) will display with foreign characters.
In order to enter foreign characters into any ERES interface (for example, Organizer and Designer), the following changes to the system settings are required:
The default locale of your system must be set to the region for the language you want to use.
The input locale for the system must also be set to the region for the language you want to use
Note that for Windows the settings can be accessed through Regional Options in the Control Panel.
In addition, the font settings in the JVM must be adjusted to the desired language following the instructions discussed in Section 10.1.2.2 - Displaying Foreign Characters.
Once these settings have been applied, foreign characters can be entered in labels, queries, formulas, and parameters in reports/charts.
By default, ERES use UTF-8 character set for encoding when writing to XML. This includes data registry files, XML report templates, XML exports, and XML representations of global format information and font mapping. Please note that for most of users it is not necessary to change character set encoding, because UTF-8 fully supports all languages.
This encoding can be changed for other languages by adding a run-time parameter to Organizer and ERES Server. For Organizer, you can do this by modifying the ERESOrganizer.bat/sh
file, or modifying the JSP source of the applet page used to launch the Organizer.
To change the XML encoding, add the following argument to the <ERESInstallDir>\ERESOrganizer.bat
or .sh
file: -xmlEncoding:Encoding
. For example -xmlEncoding:ISO-2022-JP
would set the encoding for the Japanese character set.
If you are running Organizer through an applet, you will need to add the following parameter to the applet JSP page: <PARAM NAME="xml_encoding" VALUE="ISO-2022-JP">
.
This parameter also needs to be set for the server. For more information about server settings, please see Section 1.4.1.3.1 - Secured Parameter.
Most of the ERES export formats will be automatically generated with the UTF-8 character encoding. In order to view the exported reports/charts, the client will need to have the appropriate system fonts installed. The only exception to this is the PDF export. PDF format does not depend on client fonts for viewing. Therefore, foreign language fonts will need to be embedded into the PDF document in order for characters to display properly. To do this, you will need to use the PDF Font Mapping feature. The Font Mapping can be set in Designer and in API.
If you wish to export the report/chart to a locale different from the one that is set on the machine, you can specify a different encoding before doing the export. This is done using the following method in QbReport:
public void setExportEncoding(String encoding);
where encoding
is a character encoding supported by the Java 2 platform. For example, the character encoding for English (Windows Latin-1) is Cp1252
. Please note that you have to use the canonical name used by the java.io
and java.lang
APIs.
You can also specify the character set used in the DHTML exports using the following method in QbReport:
public void setHTMLCharSet(String charset);
where charset
is a valid character set. For example, a character set for English used in DHTML documents is UTF-8
.
By default, ERES use system encoding for any text data files. The encoding for input text data files can be set via API using the following block of code:
report.getInputData().setDataFile("sample.dat", false, "ASCII");
The above block use the following method found in quadbase.reportdesigner.util.IInputData
:
public void setDataFile(String fileName, boolean isDataSorted, String encoding);