(20);
+ if (includeAllLanguages)
+ {
+ ResourceBundle msg = Application.getBundle(FacesContext.getCurrentInstance());
+ String allLanguagesStr = msg.getString(MSG_CONTENTALLLANGUAGES);
+ items.add(new SelectItem(MSG_CONTENTALLLANGUAGES, allLanguagesStr));
+ }
+ for (String locale : languages)
+ {
+ // get label associated to the locale
+ String label = langConfig.getLabelForLanguage(locale);
+ items.add(new SelectItem(locale, label));
+ }
+
+ SelectItem[] result = new SelectItem[items.size()];
+ return items.toArray(result);
+ }
+
+ /**
+ * @return the available languages
+ */
+ public SelectItem[] getLanguages()
+ {
+ // Get the item selection list
+ SelectItem[] items = getLanguageItems(false);
+ // Change the current language
+ if (this.language == null)
+ {
+ // first try to get the language that the current user is using
+ Locale lastLocale = Application.getLanguage(FacesContext.getCurrentInstance());
+ if (lastLocale != null)
+ {
+ this.language = lastLocale.toString();
+ }
+ // else we default to the first item in the list
+ else if (items.length > 0)
+ {
+ this.language = (String) items[0].getValue();
+ }
+ else
+ {
+ throw new AlfrescoRuntimeException("The language list is empty");
+ }
+ }
+ return items;
+ }
+
+ /**
+ * @return Returns the language selection.
+ */
+ public String getLanguage()
+ {
+ return this.language;
+ }
+
+ /**
+ * @param language The language selection to set.
+ */
+ public void setLanguage(String language)
+ {
+ this.language = language;
+ Application.setLanguage(FacesContext.getCurrentInstance(), this.language);
+ }
+
+ public String getContentFilterLanguage()
+ {
+ if (this.contentFilterLanguage == null)
+ {
+ Locale locale = (Locale) PreferencesService.getPreferences().getValue(PREF_CONTENTFILTERLANGUAGE);
+ // Null means All Languages
+ if (locale == null)
+ {
+ this.contentFilterLanguage = MSG_CONTENTALLLANGUAGES;
+ }
+ else
+ {
+ this.contentFilterLanguage = locale.toString();
+ }
+ }
+ return contentFilterLanguage;
+ }
+
+ /**
+ * @param languageStr A valid locale string or {@link #MSG_CONTENTALLLANGUAGES}
+ */
+ public void setContentFilterLanguage(String languageStr)
+ {
+ this.contentFilterLanguage = languageStr;
+ Locale language = null;
+ if (languageStr.equals(MSG_CONTENTALLLANGUAGES))
+ {
+ // The generic "All Languages" was selected - persist this as a null
+ }
+ else
+ {
+ // It should be a proper locale string
+ language = I18NUtil.parseLocale(languageStr);
+ }
+ PreferencesService.getPreferences().setValue(PREF_CONTENTFILTERLANGUAGE, language);
+ }
+
+ public SelectItem[] getContentFilterLanguages()
+ {
+ // Get the item selection list
+ SelectItem[] items = getLanguageItems(true);
+
+ return items;
+ }
+
public String getStartLocation()
{
diff --git a/source/web/jsp/login.jsp b/source/web/jsp/login.jsp
index c7f4e1209a..460cb57462 100644
--- a/source/web/jsp/login.jsp
+++ b/source/web/jsp/login.jsp
@@ -112,8 +112,8 @@
<%-- language selection drop-down --%>
-
-
+
+
|
diff --git a/source/web/jsp/users/user-console.jsp b/source/web/jsp/users/user-console.jsp
index 6457bc0636..58cafb743b 100644
--- a/source/web/jsp/users/user-console.jsp
+++ b/source/web/jsp/users/user-console.jsp
@@ -153,6 +153,28 @@
+
+
+ :
+ |
+
+ <%-- Interface Language drop-down selector --%>
+
+
+
+ |
+
+
+
+ :
+ |
+
+ <%-- Content Language Filter drop-down selector --%>
+
+
+
+ |
+