devisor2.grid.options
Class Locale_de_DE
java.lang.Object
java.util.ResourceBundle
java.util.ListResourceBundle
devisor2.grid.options.Locale_de_DE
- public class Locale_de_DE
- extends java.util.ListResourceBundle
This class provides the localization information for english language
and US country scheme (e.g. keyboard layout).
All text messages for the whole Application are stored in this class's
rather giant key-value Object[][] attribute with the key being the first
argument (a constant String) and the value the second argument.
As the locale is dynamically linked to the application, a
MissingRessourceException is thrown during startup if you use a key
not specified in this class. So please NEVER modify the keys!
If you want to create your own localized version of the application, just
create a copy of this class in the same directory and change the en to
your target language (a pair of lowercase letters that conform to
ISO-639), and the US to your target country scheme (two uppercase letters
that conform to ISO-3166) in both filename and classname.
After that, just try not to get bored while translating all the
right-hand String values assigned to the keys. Again: DO NOT TRANSLATE
THE KEYS!
By convention, the first part of each key consists of the full qualified
package name, followed by an underscore (_), the class name, underscore,
method- or attribute name, underscore and then your identifier.
Some general keys like the captions of buttons used everywhere throughout
the application etc. are stored with the prefix general_.
This class is also made globally accessible in the ControlCenter class.
Throughout the application, the contents of this class are accessible
via the getObject(key) method. Note that an Object is returned which
normally has to be casted to a String. On the other hand, also
menu mnemonics are saved in here, so no specific casting takes
place in this class.
Example:
Let's say you want to extract the caption for an APPLY-button.
For this application, it is stored under the key "general_Apply"
Via the ControlCenter instance set up during program startup (suppose you
have a reference in your class called cc), you have access to the
ResourceBundle for your locale (in fact, you are just reading the class
info of the ResourceBundle for english language...), named rb in the
ControlCenter class and declared as public there.
You want to extract a String, but as said before, an Object is returned,
so you might have to cast to avoid an error during compilation.
So all you have to do is:
(1) get the object stored under the specified key you are looking for:
Object obj = cc.op.getObject ("general_apply"): <\code>
(2) cast it to a String:
String myCaption = (String)obj; <\code>
(3) use it whichever way you want:
JButton myApplyButton = new JButton (myCaption);<\code>
(4) or, to save time writing code, you can do this all in one step:
JButton myApplyButton = new JButton ((String)cc.op.get ("general_apply"));<\code>
Analogously, the Mnemonics are stored as objects of class Integer, so
you have to cast to an Integer then and get the int value by invoking
the Integer.intValue() method.
- See Also:
devisor2.GUI.base.dialog.OptionDialog
,
Locale
,
java.util.ListRessourceBundle
Fields inherited from class java.util.ResourceBundle |
parent |
Method Summary |
java.lang.Object[][] |
getContents()
returns the whole two-dimensional object array |
Methods inherited from class java.util.ListResourceBundle |
getKeys, handleGetObject |
Methods inherited from class java.util.ResourceBundle |
getBundle, getBundle, getBundle, getLocale, getObject, getString, getStringArray, setParent |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Locale_de_DE
public Locale_de_DE()
getContents
public java.lang.Object[][] getContents()
- returns the whole two-dimensional object array
- Returns:
- the complete locales stored in this class