01: /*
02: * Created on 02.08.2005 for PIROL
03: *
04: * SVN header information:
05: * $Author: javamap $
06: * $Rev: 856 $
07: * $Date: 2007-06-18 21:15:27 -0700 (Mon, 18 Jun 2007) $
08: * $Id: PirolPlugInMessages.java 856 2007-06-19 04:15:27Z javamap $
09: */
10: package de.fho.jump.pirol.utilities.i18n;
11:
12: import java.util.MissingResourceException;
13:
14: import de.fho.jump.pirol.utilities.apiTools.HandlerToMakeYourLifeEasier;
15: import de.fho.jump.pirol.utilities.debugOutput.DebugUserIds;
16: import de.fho.jump.pirol.utilities.debugOutput.PersonalLogger;
17:
18: /**
19: * Handles i18n stuff for PIROL plugIns.<br>
20: * Class that Eclipse generates, if the "Externalize Strings" command is used. Was renamed (from <code>Messages.java</code>) and modified to use the openJump i18n plug - the interface stayed the same!<br>
21: * Wrapper for the i18N to make work with PIROL labels easier.
22: *
23: * @author Ole Rahn
24: * <br>
25: * <br>FH Osnabrück - University of Applied Sciences Osnabrück,
26: * <br>Project: PIROL (2005),
27: * <br>Subproject: Daten- und Wissensmanagement
28: *
29: * @version $Rev: 856 $
30: *
31: */
32: public class PirolPlugInMessages implements HandlerToMakeYourLifeEasier {
33: private static final String BUNDLE_NAME = "de.fhOsnabrueck.jump.pirol.resources.PirolPlugIns";
34:
35: private static boolean inited = false;
36:
37: protected static PersonalLogger logger = new PersonalLogger(
38: DebugUserIds.ALL);
39:
40: /**
41: * We don't need instances of the class!
42: */
43: private PirolPlugInMessages() {
44: }
45:
46: /**
47: * Get a translated PIROL text from the i18N system.
48: *@param key the key (name) for the the text
49: *@return the translated text
50: */
51: public static String getString(String key) {
52: if (!PirolPlugInMessages.inited) {
53: I18NPlug.setPlugInRessource("de.fhOsnabrueck.jump.pirol",
54: PirolPlugInMessages.BUNDLE_NAME);
55: PirolPlugInMessages.inited = true;
56: }
57:
58: try {
59: return I18NPlug.get("de.fhOsnabrueck.jump.pirol", key);
60: } catch (MissingResourceException e) {
61: logger.printMinorError("i18n key not found for: \"" + key
62: + "\"");
63: return "!" + key + "!";
64: }
65: }
66:
67: public static boolean isInited() {
68: return inited;
69: }
70:
71: }
|