01: package com.xoetrope.carousel.langed;
02:
03: import java.io.BufferedReader;
04: import java.io.IOException;
05: import java.util.Hashtable;
06: import java.util.StringTokenizer;
07:
08: /**
09: * Language
10: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
11: * the GNU Public License (GPL), please see license.txt for more details. If
12: * you make commercial use of this software you must purchase a commercial
13: * license from Xoetrope.</p>
14: * <p> $Revision: 1.3 $</p>
15: */
16: class Language {
17: public Language() {
18: }
19:
20: /*
21: * Returns the number of strings in this language.
22: */
23: public int getSize() {
24: return langStrings.size();
25: }
26:
27: /*
28: * Looks up and returns a string.
29: */
30: public String getString(int id) {
31: int numStrings = langStrings.size();
32:
33: LangItem liKey = new LangItem();
34: liKey.id = id;
35: Object obj = langStrings.get(new LangItem(id));
36: if (obj != null)
37: return ((LangItem) obj).langStr;
38: return "";
39: }
40:
41: /*
42: * Looks up and returns a string.
43: */
44: public int findString(String key) {
45: LangItem liKey = new LangItem(true);
46: liKey.langStr = key;
47: Object obj = langStrings.get(liKey);
48: if (obj != null)
49: return ((LangItem) obj).id;
50: return -1;
51: }
52:
53: /*
54: * Looks up and returns the number of strings in the language
55: */
56: public int getNumStrings() {
57: return langStrings.size();
58: }
59:
60: protected Hashtable langStrings;
61: }
|