|
JEphem site jephem API Build classes |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tig.TigBundle
This class can be used instead of ResourceBundle
. It has been written for these reasons :
getString(String)
method
returns a empty string if a key can't be found in the bundle).myKey_country_locale_variant
(ex : myKey_en_US
).
TigBundle
only store the necessary strings (corresponding to the Locale
specified in the constructor).
myKey_en = myEnglishValue myKey_fr = myFrenchValueBut the following example is not valid, because of underscores :
my_Key_en = myEnglishValue my_Key_fr = myFrenchValue
TigBundle myBundle = new TigBundle("C:\\data\\MyBundle.properties", new Locale("en", "US")); String str = myBundle.getString("myKey");
TigBundle(String, Locale)
), a java.io.IOException
is thrown if the resource file can't be loaded. An other constructor is provided to be able to load "manually" the bundle : (TigBundle(Properties, Locale)
).
Properties p = new Properties(); p.setProperty("myKey_fr", "myFrenchValue"); p.setProperty("myKey", "myEnglishValue"); TigBundle myBundle = new TigBundle(p, new Locale("en", "US")); String str = myBundle.getString("myKey");
getString("myKey")
is called, it tries to find, in this order :
"myKey_country_locale_variant"
"myKey_country_locale"
"myKey_country"
"myKey"
OK_sp = Oke OK = OK
Field Summary |
Fields inherited from interface tig.GeneralConstants |
BLANK, FS, LS, NO_SPECIF, SPACE |
Constructor Summary | |
TigBundle(java.util.Properties p,
java.util.Locale locale)
Creates an bundle from a Propetries. |
|
TigBundle(java.lang.String pathName,
java.util.Locale locale)
Constructor to use in general. |
Method Summary | |
java.util.Properties |
getData()
Returns the Properties used to internally store the data. |
java.lang.String |
getString(java.lang.String key)
Returns the value corresponding to parameter 'key' (see details of method). |
static void |
main(java.lang.String[] args)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TigBundle(java.util.Properties p, java.util.Locale locale)
public TigBundle(java.lang.String pathName, java.util.Locale locale) throws java.io.IOException
pathName
- Absolute path of the file containing the resources.locale
- Locale of this bundle.
java.lang.RuntimeException
- If parameter 'locale' is null or if its language is not set (null or empty string).
java.io.IOException
Method Detail |
public java.lang.String getString(java.lang.String key)
theKey
' and the Locale
used to build
this bundle contains a language 'la', a country 'co' and a variant 'va', will try to find a key, the
following keys will be searched in the file :
theKey_la_co_va
theKey_la_co
theKey_la
theKey
key
- The key corresponding to the String to retrieve.public java.util.Properties getData()
Properties
used to internally store the data.
public static void main(java.lang.String[] args)
|
JEphem site jephem API Build classes |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |