Jskad/source/org/thdl/util/ThdlI18n.java
dchandler 7198f23361 I really hesitate to commit this because I'm not sure what it brings to the
table exactly and I fear that it makes the ACIP->Tibetan converter code
a lot uglier.  The TODO(DLC)[EWTS->Tibetan] comments littered throughout
are part of the ugliness; they point to the ugliness.  If each were addressed,
cleanliness could perhaps be achieved.

I've largely forgotten exactly what this change does, but it attempts to
improve EWTS->Tibetan conversion.  The lexer is probably really, really
primitive.  I concentrate here on converting a single tsheg bar rather than
a whole document.

Eclipse was used during part of my journey here and some imports were
reorganized merely because I could.  :)

(Eclipse was needed when the usual ant build failed to run a new test
EWTSTest.  And I wanted its debugger.)

Next steps: end-to-end EWTS tests should bring many problems to light.  Fix
those.  Triage all the TODO comments.

I don't know that I'll ever really trust the implementation.  The tests are
valuable, though.  A clean implementation of EWTS->Tibetan in Jython
might hold enough interest for me; I'd like to learn Python.
2005-06-20 06:18:00 +00:00

33 lines
No EOL
773 B
Java

package org.thdl.util;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.swing.JComponent;
public class ThdlI18n {
private static Locale locale = null;
private static ResourceBundle resources = null;
private ThdlI18n() {}
public static ResourceBundle getResourceBundle() {
if (resources == null)
resources = ResourceBundle.getBundle("MessageBundle", getLocale());
return resources;
}
public static void setLocale(Locale l) {
Locale[] locales = Locale.getAvailableLocales();
for (int k=0; k<locales.length; k++)
if (locales[k].equals(locale)) {
JComponent.setDefaultLocale(l);
locale = l;
break;
}
}
public static Locale getLocale() {
if (locale == null)
locale = Locale.getDefault();
return locale;
}
}