diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/I18n.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/I18n.java index 5a6e72bd8..3bc2d6045 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/I18n.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/I18n.java @@ -84,7 +84,8 @@ public class I18n { /** * Get an I18nBundle by this name. The request provides the preferred - * Locale, the theme directory and the development mode flag. + * Locale, the application directory, the theme directory and the + * development mode flag. * * If the request indicates that the system is in development mode, then the * cache is cleared on each request. @@ -155,7 +156,8 @@ public class I18n { // ---------------------------------------------------------------------- /** - * Instead of looking in the classpath, look in the theme directory. + * Instead of looking in the classpath, look in the theme i18n directory and + * the application i18n directory. */ private static class ThemeBasedControl extends ResourceBundle.Control { private static final String BUNDLE_DIRECTORY = "i18n/"; @@ -177,7 +179,8 @@ public class I18n { /** * Don't look in the class path, look in the current servlet context, in - * the bundle directory under the theme directory. + * the bundle directory under the theme directory and in the bundle + * directory under the application directory. */ @Override public ResourceBundle newBundle(String baseName, Locale locale, @@ -193,7 +196,7 @@ public class I18n { if (bundleName == null) { throw new NullPointerException("bundleName may not be null."); } - + String themeI18nPath = "/" + themeDirectory + BUNDLE_DIRECTORY; String appI18nPath = "/" + BUNDLE_DIRECTORY; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/selection/LocaleSelectionFilter.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/selection/LocaleSelectionFilter.java index 377638977..233dad10a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/selection/LocaleSelectionFilter.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/selection/LocaleSelectionFilter.java @@ -72,9 +72,9 @@ public class LocaleSelectionFilter implements Filter { */ private static class LocaleSelectionRequestWrapper extends HttpServletRequestWrapper { - private final HttpServletRequest request; - private final Locale selectedLocale; + private final List locales; + @SuppressWarnings("unchecked") public LocaleSelectionRequestWrapper(HttpServletRequest request, Locale selectedLocale) { super(request); @@ -82,31 +82,32 @@ public class LocaleSelectionFilter implements Filter { if (request == null) { throw new NullPointerException("request may not be null."); } - this.request = request; - if (selectedLocale == null) { throw new NullPointerException( "selectedLocale may not be null."); } - this.selectedLocale = selectedLocale; + + Locale selectedLanguage = new Locale(selectedLocale.getLanguage()); + + locales = EnumerationUtils.toList(request.getLocales()); + locales.remove(selectedLanguage); + locales.add(0, selectedLanguage); + locales.remove(selectedLocale); + locales.add(0, selectedLocale); } @Override public Locale getLocale() { - return selectedLocale; + return locales.get(0); } /** - * Put the selected Locale on the front of the list of acceptable - * Locales. + * Get the modified list of locales. */ - @SuppressWarnings({ "unchecked", "rawtypes" }) + @SuppressWarnings("rawtypes") @Override public Enumeration getLocales() { - List list = EnumerationUtils.toList(request.getLocales()); - list.remove(selectedLocale); - list.add(0, selectedLocale); - return Collections.enumeration(list); + return Collections.enumeration(locales); } } diff --git a/webapp/test/stubs/com/hp/hpl/jena/rdf/model/LiteralStub.java b/webapp/test/stubs/com/hp/hpl/jena/rdf/model/LiteralStub.java index 5bcbd71c3..ff7cf9c4e 100644 --- a/webapp/test/stubs/com/hp/hpl/jena/rdf/model/LiteralStub.java +++ b/webapp/test/stubs/com/hp/hpl/jena/rdf/model/LiteralStub.java @@ -1,3 +1,5 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + package stubs.com.hp.hpl.jena.rdf.model; import com.hp.hpl.jena.datatypes.RDFDatatype;