Internationalization is the process of writing a global program and ensuring that it can be
used without change by anyone in the world. Also known as "I18N", internationalization is
provided by the Java language since version 1.1.
As a Java class library compatible with JDK 1.1 and newer versions, JetChart supports
internationalization through the usage of methods to localize programs. Localization is the
mechanism used to configure a program to correctly format date, time and numbers and
display Unicode characters only used in certain countries.
The method GenericGraph.setLocale(java.util.Locale) localizes an application. This
method is implemented in the java.awt.Component class, which is located
at the top of the AWT components hierarchy.
Country-specific characters can be displayed using a Unicode sequence, provided that the underlying
operating system has the correct fonts installed, and the Java font properties file be correctly
configured. Please refer to the Java documentation for detailed information concerning internationalization
issues.
For example, to set a chart title using a Unicode sequence in the form "\unnnn", do as follows:
graph.setTitle("\u3043\u3044\u3045");
If the correct fonts are installed, the chart title displays a sequence of three Japanese
characters.
The application below is configured to display dates and values using Brazilian language code.
import java.awt.*; import java.awt.event.*; import javax.swing.*; import com.jinsight.jetchart.*; import java.util.Locale; public class Main extends JFrame { public Main() { Graph graph=new Graph(); graph.setLocale(new Locale("pt","BR")); graph.setTitle(new String[]{"The JetChart Library","Internationalization"}); graph.setStartDate("05012002"); graph.setVerticalLabelsEnabled(true); double[] values={131.45,100.23,80.50,31.00,136.75,109.00,90.50,110.50}; BarSerie bs=new BarSerie(values,"Bar series"); bs.setColor(new Color(00,99,00)); bs.setBorderEnabled(false); Grid grid=graph.getGraphSet(0).getGrid(); grid.setEnabled(true); grid.setThickness(2); graph.addSerie(bs); Container ct=getContentPane(); ct.add(graph); setSize(550,300); setVisible(true); } public static void main(String[] args) { new Main(); } }