Commit 8e9df330 authored by michael.simon's avatar michael.simon
Browse files

implement own resource bundle

parent 43a1d0f8
package edu.kit.scc.webreg.res;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.ResourceBundle;
import javax.faces.context.FacesContext;
public class DbMessageBundle extends ResourceBundle {
public static final String BASE_NAME = "msg.messages";
private Map<String, String> messages;
public DbMessageBundle() {
Locale locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
ResourceBundle rb = ResourceBundle.getBundle(BASE_NAME, locale);
setParent(rb);
messages = new HashMap<String, String>();
messages.put("server_config", "Server Configuration");
}
@Override
protected Object handleGetObject(String key) {
Object o = null;
if (messages != null) {
o = messages.get(key);
}
if (o == null) {
o = parent.getObject(key);
}
return o;
}
@Override
public Enumeration<String> getKeys() {
return messages != null ? Collections.enumeration(messages.keySet()) : parent.getKeys();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<PROCESS model-entity="JSFProcess"/>
......@@ -10,9 +10,8 @@
<supported-locale>de</supported-locale>
<supported-locale>en</supported-locale>
</locale-config>
<message-bundle>msg.messages</message-bundle>
<resource-bundle>
<base-name>msg.messages</base-name>
<base-name>edu.kit.scc.webreg.res.DbMessageBundle</base-name>
<var>messages</var>
</resource-bundle>
</application>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment