import javax.swing.Icon;
import java.util.Locale;
import java.util.MissingResourceException;
/**The interface provides access to a resourcebundle that
can be defined in XML or as an java-object.
Example Usage:
*/
public interface I18nBundle {
String ROLE = I18nBundle.class.getName();
/** same as format(key,new Object[] {obj1});
@see #format(String,Object[])
*/
String format(String key,Object obj1) throws MissingResourceException;
/** same as format(key,new Object[] {obj1, obj2});
@see #format(String,Object[])
*/
String format(String key,Object obj1,Object obj2) throws MissingResourceException;
/** same as
(new MessageFormat(getString(key))).format(obj);
@see java.text.MessageFormat
*/
String format(String key,Object[] obj) throws MissingResourceException;
/** returns the specified icon from the image-resource-file.
@throws MissingResourceException if not found or can't be loaded.
*/
Icon getIcon(String key) throws MissingResourceException;
/** returns the specified string from the selected resource-file.
@throws MissingResourceException if not found or can't be loaded.
*/
String getString(String key) throws MissingResourceException;
/** @return the selected language. */
String getLang();
/** @return the selected Locale. */
Locale getLocale();
}
import java.util.Locale;
import java.util.MissingResourceException;
/**The interface provides access to a resourcebundle that
can be defined in XML or as an java-object.
Example Usage:
Code:
I18nBundle i18n = (I18nBundle)serviceManager.lookup(I18nBundle.ROLE);
i18n.getString("yes"); // will get the translation for yes.
public interface I18nBundle {
String ROLE = I18nBundle.class.getName();
/** same as format(key,new Object[] {obj1});
@see #format(String,Object[])
*/
String format(String key,Object obj1) throws MissingResourceException;
/** same as format(key,new Object[] {obj1, obj2});
@see #format(String,Object[])
*/
String format(String key,Object obj1,Object obj2) throws MissingResourceException;
/** same as
(new MessageFormat(getString(key))).format(obj);
@see java.text.MessageFormat
*/
String format(String key,Object[] obj) throws MissingResourceException;
/** returns the specified icon from the image-resource-file.
@throws MissingResourceException if not found or can't be loaded.
*/
Icon getIcon(String key) throws MissingResourceException;
/** returns the specified string from the selected resource-file.
@throws MissingResourceException if not found or can't be loaded.
*/
String getString(String key) throws MissingResourceException;
/** @return the selected language. */
String getLang();
/** @return the selected Locale. */
Locale getLocale();
}