1
2
3
4 package net.sf.madmap;
5
6 import java.util.*;
7 import java.io.*;
8
9
10
11
12
13 public class Resources implements IResources {
14
15 private ResourceBundle _propBundle = null;
16 private String _resPropFileBaseName = null;
17 private Locale _locale = null;
18 private String _country = null;
19 private String _language = null;
20
21 public void setCountry( String co ) {
22 _country = co;
23 }
24
25 public void setLanguage( String lang ) {
26 _language = lang;
27 }
28
29 public void setResPropFileBaseName( String name ) {
30 _resPropFileBaseName = name;
31 }
32
33 public void beanInit() {
34 if ( _language != null ) {
35 if ( _country != null ) {
36 _locale = new Locale( _language, _country );
37 } else {
38 _locale = new Locale( _language );
39 }
40 } else {
41 _locale = Locale.getDefault();
42 }
43
44 _propBundle = ResourceBundle.getBundle( _resPropFileBaseName, _locale );
45 if ( _propBundle == null ) {
46 System.err.println( "beanInit: Problem creating resource bundle!");
47 }
48 }
49
50 public Resources() {}
51 public String getString( String in ) {
52 if ( _propBundle != null ) {
53 return _propBundle.getString( in );
54 }
55 return in;
56 }
57 }