Example usage for org.apache.wicket Localizer getStringIgnoreSettings

List of usage examples for org.apache.wicket Localizer getStringIgnoreSettings

Introduction

In this page you can find the example usage for org.apache.wicket Localizer getStringIgnoreSettings.

Prototype

public String getStringIgnoreSettings(final String key, final Component component, final IModel<?> model,
        final String defaultValue) 

Source Link

Usage

From source file:com.gitblit.utils.GitBlitDiffFormatter.java

License:Apache License

/**
 * Returns a localized message string, if there is a localization; otherwise the given default value.
 *
 * @param key//from   ww w  .  ja v  a 2 s . c  om
 *            message key for the message
 * @param defaultValue
 *            to use if no localization for the message can be found
 * @return the possibly localized message
 */
private String getMsg(String key, String defaultValue) {
    if (Application.exists()) {
        Localizer localizer = Application.get().getResourceSettings().getLocalizer();
        if (localizer != null) {
            // Use getStringIgnoreSettings because we don't want exceptions here if the key is missing!
            return localizer.getStringIgnoreSettings(key, null, null, defaultValue);
        }
    }
    return defaultValue;
}