Commit cb7734cf by Juho Juopperi

i18n from java

1 parent b3f7a65c
package fi.insomnia.bortal;
import java.util.ResourceBundle;
import javax.faces.application.Application;
import javax.faces.context.FacesContext;
/***
* Access i18n localisations from Java code. Feel free to make up a better way.
* @author jkj
*
*/
public class I18n {
public static ResourceBundle GetResourceBundle()
{
FacesContext facesContext = FacesContext.getCurrentInstance();
Application app = facesContext.getApplication();
ResourceBundle bundle = app.getResourceBundle(facesContext, "i18n");
return bundle;
}
public static String Get(String key)
{
String value = GetResourceBundle().getString(key);
if(key==null) {
return "########";
}
return value;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!