+ @Override
+ public String getLanguage () {
+ //this.getLoggerBeanLocal().logTrace(MessageFormat.format("AddressbookLocalizationSessionBean::getLanguage(): locale.language={0} - EXIT!", this.getLocale().getLanguage())); //NOI18N
+ return this.getLocale().getLanguage().toLowerCase();
+ }
+
+ @Override
+ public void setLanguage (final String language) {
+ // Log trace message
+ //this.getLoggerBeanLocal().logTrace(MessageFormat.format("AddressbookLocalizationSessionBean::setLanguage: language={0} - CALLED!", language)); //NOI18N
+
+ // Is the language null?
+ if (null == language) {
+ // This may sometimes happen, so abort here
+ return;
+ }
+
+ // Language splits
+ String[] splits = language.split("_"); //NOI18N
+ if (null == splits[1]) {
+ splits[1] = ""; //NOI18N
+ }
+
+ // Get new locale with upper-case country code
+ Locale loc = new Locale(splits[0], splits[1]);
+
+ // Log debug message
+ //this.getLoggerBeanLocal().logDebug(MessageFormat.format("AddressbookLocalizationSessionBean::setLanguage: loc={0}", loc)); //NOI18N
+
+ // Set it here and in the JSF context
+ this.setLocale(loc);
+ FacesContext.getCurrentInstance().getViewRoot().setLocale(loc);
+
+ // Log trace message
+ //this.getLoggerBeanLocal().logTrace("AddressbookLocalizationSessionBean::setLanguage: EXIT!"); //NOI18N
+ }
+