From: Roland Haeder Date: Mon, 4 Apr 2016 16:47:31 +0000 (+0200) Subject: Continued with localization support: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a1ecc54e818410bf5a16446fbbed3a6244bb177c;p=pizzaservice-war.git Continued with localization support: - added form template for localization support (still static, maybe can be output over bean's method?) - added missing methods (not classical getter/setter) --- diff --git a/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionBean.java b/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionBean.java index b8fb5cde..1e98b41e 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionBean.java @@ -45,6 +45,17 @@ public class PizzaLocalizationSessionBean extends BaseDatabaseBean implements Pi */ private Locale locale; + @Override + public String getLanguage () { + return this.getLocale().getLanguage(); + } + + @Override + public void setLanguage (final String language) { + this.setLocale(new Locale(language)); + FacesContext.getCurrentInstance().getViewRoot().setLocale(this.getLocale()); + } + @Override public Locale getLocale () { return this.locale; diff --git a/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionController.java b/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionController.java index e4c98139..430923d0 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionController.java +++ b/src/java/org/mxchange/pizzaapplication/beans/localization/PizzaLocalizationSessionController.java @@ -40,4 +40,18 @@ public interface PizzaLocalizationSessionController extends Serializable { */ void setLocale (final Locale locale); + /** + * Getter for language code + *

+ * @return Language code + */ + String getLanguage (); + + /** + * Setter for language code + *

+ * @param language Language code + */ + void setLanguage (final String language); + } diff --git a/web/WEB-INF/templates/base.tpl b/web/WEB-INF/templates/base.tpl index 5c7d9cbe..f1dae8a4 100644 --- a/web/WEB-INF/templates/base.tpl +++ b/web/WEB-INF/templates/base.tpl @@ -37,6 +37,7 @@