Tutorial
Using mdTypes [EN]
von MOD | Seite 7 von 12 |
Resources:
- md/util/mdResourceBundle
mdResourceBundle is class you can use for many purposes. Mostly you will load config files or language files with it.
To create a bundle, use this line:
Dim As mdResourceBundle bundle = mdResourceBundle.getBundle("Important", "optional")
This line will create a new bundle and load the file "Important_optional.properties". If "optional" is empty, it will load "Important.properties". The first parameter can also contain a complete path.
Usually, you will use something like this:
- mdResourceBundle.getBundle("Language", "en") - to load Language_en.properties
- mdResourceBundle.getBundle("settings") - to load settings.properties
The format of the loaded file is "key=value". "key" is any String, but it is not allowed to contain a "=" sign. "value" is any String until end of line. The value can also contain parameters like "{0}" which are replaced with a given parameter with this index. Some examples:
Print bundle.containsKey("key") 'TRUE or FALSE
Print bundle.getString("key") 'Will print the value of this key
Print bundle.getString("key", "parameter") 'Will print the value with all appearances of {0} replaced by "parameter"
Print bundle.getString("key", array()) 'Will print the value with all parameters replaced with the value of the given index in the array
Print bundle.getString("key", "p0 p1 p2") 'Will print the value with all parameters replaced, which are seperated with space
Zusätzliche Informationen und Funktionen |
- Das Tutorial wurde am 17.04.2014 von MOD angelegt.
- Die aktuellste Version wurde am 31.07.2019 von MOD gespeichert.
|
|