01: package com.xoetrope.util;
02:
03: import java.util.Vector;
04: import java.util.ResourceBundle;
05:
06: import net.xoetrope.xui.build.BuildProperties;
07: import net.xoetrope.debug.DebugLogger;
08: import net.xoetrope.xui.XProject;
09: import net.xoetrope.xui.XProjectManager;
10:
11: import net.xoetrope.xui.helper.XDefaultTranslator;
12:
13: /**
14: * @todo this class needs to
15: * 1 delegate to the translation mechanism in the core
16: * 2 should not use singletons
17: * 3 the locale/font support needs to be integrated into the core
18: * 4 Font substitution needs to be on a face by face basis
19: */
20: /**
21: * A class to do some translation
22: *
23: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
24: * the GNU Public License (GPL), please see license.txt for more details. If
25: * you make commercial use of this software you must purchase a commercial
26: * license from Xoetrope.</p>
27: * <p> $Revision: 1.10 $</p>
28: */
29: public class Translator extends XDefaultTranslator {
30: private Vector chinesefonts;
31: private boolean UTF_Encoding = false;
32: private String defaultFont = "NSimSun";
33:
34: protected Translator(XProject project) {
35: super (project);
36: languageResourceBundle = currentProject
37: .getResourceBundle(currentProject
38: .getStartupParam("Language"));
39: }
40:
41: public void reset() {
42: reset(false);
43: }
44:
45: public void setUseUTF(boolean use) {
46: UTF_Encoding = use;
47: }
48:
49: public void reset(boolean useUTF) {
50: setUseUTF(useUTF);
51: UTF_Encoding = useUTF;
52: // if ( UTF_Encoding )
53: // addEasternFonts();
54: }
55:
56: public boolean useUTF() {
57: return UTF_Encoding;
58: }
59:
60: public String getDefaultFont() {
61: return defaultFont;
62: }
63:
64: private void addEasternFonts() {
65: // // Determine which fonts support Chinese here ...
66: // chinesefonts = new Vector();
67: // Font[] allfonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
68: // int fontcount = 0;
69: // String chinesesample = "\u4e00";
70: // for (int j = 0; j < allfonts.length; j++) {
71: // if ( allfonts[j].canDisplayUpTo( chinesesample ) == -1 ) {
72: // chinesefonts.add( allfonts[j].getFontName() );
73: // System.out.println( allfonts[j].getFontName() );
74: // }
75: // fontcount++;
76: // }
77: }
78: }
|