From: Roland Haeder Date: Mon, 4 Apr 2016 16:47:37 +0000 (+0200) Subject: Continued with localization support: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ea203fb4bd8a609c8c56952d8616cf0302ab4483;p=addressbook-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/addressbook/beans/localization/AddressbookLocalizationSessionBean.java b/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionBean.java index dd587438..9316575d 100644 --- a/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionBean.java @@ -45,6 +45,17 @@ public class AddressbookLocalizationSessionBean extends BaseDatabaseBean impleme */ 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/addressbook/beans/localization/AddressbookLocalizationSessionController.java b/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionController.java index 642a7f3e..81bda8f1 100644 --- a/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionController.java @@ -40,4 +40,18 @@ public interface AddressbookLocalizationSessionController 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 2e862b4c..a180370d 100644 --- a/web/WEB-INF/templates/base.tpl +++ b/web/WEB-INF/templates/base.tpl @@ -30,6 +30,7 @@