public class I18N extends Object
This class assumes one property file per package, as needed. The convention
used here is to store the property files in a subdirectory of the package
named i18n
. The base name is gui
, so the default
property file is i18n/gui.properties
. The German version would then
be i18n/gui_de.properties
and the French version would be
i18n/gui_fr.properties
. The property files need to be installed
in the same relative directory in the classes dir or jar file before use.
Modifier and Type | Method and Description |
---|---|
static I18N |
getInstance(Class c)
Return an instance of I18N, initialized to use i18n/gui_
|
String |
getString(String key)
Return the string for the specified key in the current locale.
|
String |
getString(String key,
Object p1)
Return the string for the specified key in the current locale after substituting
the given parameter using the MessageFormat class.
|
String |
getString(String key,
Object[] params)
Return the string for the specified key in the current locale after substituting
the given parameters using the MessageFormat class.
|
String |
getString(String key,
Object p1,
Object p2)
Return the string for the specified key in the current locale after substituting
the given parameters (p1 and p2) using the MessageFormat class.
|
String |
getString(String key,
Object p1,
Object p2,
Object p3)
Return the string for the specified key in the current locale after substituting
the given parameters (p1 and p2) using the MessageFormat class.
|
static void |
main(String[] args)
test main
|
void |
setLocale(Locale locale)
Set the current locale.
|
public static I18N getInstance(Class c)
public void setLocale(Locale locale)
public String getString(String key)
public String getString(String key, Object[] params)
MessageFormat
public String getString(String key, Object p1)
MessageFormat
public String getString(String key, Object p1, Object p2)
MessageFormat
public String getString(String key, Object p1, Object p2, Object p3)
MessageFormat
public static void main(String[] args)
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.