Changeset 5108
- Timestamp:
- 2003-08-07T16:24:39+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/util/Dictionary.java
r3577 r5108 8 8 9 9 /** The locale of this dictionary. */ 10 protected Locale locale _= null;10 protected Locale locale = null; 11 11 12 12 /** The resource that has been loaded */ 13 protected String resource _= null;13 protected String resource = null; 14 14 15 15 /** The ResourceBundle which contains the raw key-value mappings. Loaded from a file named "resource_locale.properties*/ 16 private ResourceBundle raw _= null;16 private ResourceBundle raw = null; 17 17 18 18 /** Constructs the Dictionary class by first checking if a Locale has been set. If not the default locale is used, and a ResourceBundle is created. Finally a single important String, Language, is made available outside the class so a more read-able version of the Locale of this Dictionary is present. … … 22 22 // Initialize. 23 23 24 locale_= new Locale(lang);25 resource_= resource;26 if ( locale_== null) {27 locale_= Locale.getDefault();24 this.locale = new Locale(lang); 25 this.resource = resource; 26 if (this.locale == null) { 27 this.locale = Locale.getDefault(); 28 28 } 29 29 try { 30 raw_ = ResourceBundle.getBundle(resource_, locale_);30 this.raw = ResourceBundle.getBundle(this.resource, this.locale); 31 31 } catch (Exception e) { 32 System.err.println("Dictionary: couldn't locate a resource bundle . Error message: "+e.getMessage());32 System.err.println("Dictionary: couldn't locate a resource bundle for "+resource); 33 33 } 34 34 } 35 35 36 36 public Enumeration getKeys() { 37 if ( raw_!= null) {38 return raw_.getKeys();37 if (this.raw != null) { 38 return this.raw.getKeys(); 39 39 } 40 40 return null; … … 55 55 */ 56 56 public String get(String key, String args[]) { 57 if ( raw_== null) {57 if (this.raw == null) { 58 58 return null; 59 59 } 60 60 try { 61 String initial = raw_.getString(key);61 String initial = this.raw.getString(key); 62 62 // If the string contains arguments we have to insert them. 63 63 String complete = ""; … … 85 85 } 86 86 catch (Exception e) { 87 System.err.println("Exception: " + e.toString()); 88 e.printStackTrace(); 87 System.err.println("Dictionary Error: couldn't find string for key:" + key +" in resource "+this.resource); 89 88 return null; 90 89 }
Note:
See TracChangeset
for help on using the changeset viewer.