Section 11: Internationalization (I18N)
NetCharts Server provides the ability to display fonts from non-Latin languages in graphs and popup labels. This feature utilizes the widely recognized Unicode code pages in order to support many languages. Multiple languages and fonts can be simultaneously supported within each chart.
Typically, all that needs to be done is to install the fonts on the server machine and then reference the fonts in the CDL and use the appropriate Unicode characters.
The process in which NetCharts Server will use internationalized characters includes the following steps:
- Install the desired fonts on the machine that hosts NetCharts Server. These fonts must contain the character symbols (glyphs) for the desired language. For example, a “Times Roman” font does not contain Japanese characters symbols, but the “MS Mincho” font does.
- Restart the NetCharts Server.
- Change the font name referenced in the CDL parameter to be the desired font.
- Provide the appropriate Unicode characters and enter those into the CDL file
- Render the Chart
Unicode is an international standard for mapping numeric codes to language characters. The definition given on the Unicode Consortium’s website, www.unicode.org, for Unicode is:
Unicode provides a unique number for every character, no matter what the platform, no matter what the program, no matter what the language.
Basically this means that every character of every language has a unique identifier. Unicode characters are commonly identified by a ‘\u’ followed by a hexadecimal index representation.
Fonts
A font contains a collection of glyphs, or character symbols. Each symbol in a font represents a unique graphical drawing of a character. So in a given font, there may be unique symbols for lowercase a, uppercase A, numbers 0-9, and punctuation like ‘,’. Each font character symbol has a unique numerical index. Typically, lowercase ‘a’ appears in a font as ASCII index “93”, or Unicode character \u0061. International characters are no different – they simply have an index into a font.
Finding Unicode Indexes
The website http://www.unicode.org has code maps for translating languages into Unicode indexes.
Symbol Test
After the desired fonts have been installed, developers may use the SymbolTest utility to help verify that a given Unicode index exists in the font. SymbolTest is included as part of the Java Development Kit from Sun Microsystems, and has been modified and included as part of the NetCharts Server distribution.
Applet Version
Our bundled SymbolTest utility is a convenient tool that will display the characters found at a given index. It can be run as an applet from
http://localhost:8001/projects/Examples/I18N/SymbolTest.html
Please note that the fonts that are shown are the ones available on the client machine, that is, the machine on which the applet is being shown.
Application Version
SymbolTest can also be run from the console by traversing to the NetCharts Server installation directory, and from there, to the Server/root/projects/Examples/I18N/ directory. In the I18N directory, the program can be run with the command (assumes an installed JVM):
java SymbolTest
(Be patient, it may take a few minutes for it to load all the fonts on your system).
Using Unicode Characters in CDL
The following is a sample of a chart file that uses Japanese characters. Note that both the title (Header) and bar labels contain Unicode characters. Note also that the MS Mincho font is used to define the Header and BottomTics display parameters. If a non-Japanese font is used, or MS Mincho is not installed, the glyph at the Unicode index will not be a Japanese character, and will be an error character instead.
ChartName = “Japanese Character Barchart”;
ChartType = BARCHART;
ChartWidth = 408;
ChartHeight = 256;
Background = (white,NONE,1,null,TILE,black);
BarLabels =
“\u3064\u3061\u304C\u3064″,”\u3075\u3064\u304B”,”\u307F\u3064\u304B”,”\u3088\u3
064\u304B”,”\u3044\u3064\u304B”;
BottomTics = (“ON”,black,”MS Mincho”,14,0,null);
DataSet1 = 100,125,245.78,147,67;
DataSets = (“BarSet1”,null,BAR,4,FILLED);
DwellLabel = (“”,black,”SansSerif”,12,0); GraphType = GROUP;
Header = (“\u3044\u3065\u305F\u3061″,black,”MS Mincho”,27,0);
HeaderBox = (null,NONE,5,null,TILE,black);
LeftScale = (null,null,null);
LeftTics = (“ON”,null,”SansSerif”,10,0,null);
BarWidth = 61;
Bar3DDepth = 5;
GraphLayout = VERTICAL;
StackLabel = TOTAL;
Grid = (lightgray,null,black,null,TILE);
DwellLabelBox = (yellow,RAISED,3,null,TILE,black);
GridAxis = (BOTTOM,LEFT);
GridLine = (BOTH,SOLID,1);
BarBorder = (SOLID,0,black);
AntiAlias = “ON”;
ColorTable = x6c5d94,x999966,x315394,x213321,x00566f,x690931,x515f23;
RightTitleBox = (null,NONE,2,null,TILE,black);
RightTitle = (” “,black,”Agency FB”,12,0);
When rendered, this CDL above appears as: