VIVO-12 NIHVIVO-4011 Provide config and GUI for selecting Locale

This commit is contained in:
j2blake 2013-01-24 16:21:36 -05:00
parent 1ba6204815
commit bb6b2fa970
19 changed files with 1346 additions and 10 deletions

View file

@ -55,6 +55,9 @@ edu.cornell.mannlib.vitro.webapp.services.shortview.ShortViewServiceSetup
edu.ucsf.vitro.opensocial.OpenSocialSmokeTests
# For multiple language support
edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionSetup
# The Solr index uses a "public" permission, so the PropertyRestrictionPolicyHelper
# and the PermissionRegistry must already be set up.
edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup

View file

@ -78,6 +78,16 @@
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<description>Override the Locale in the HttpRequest, if appropriate.</description>
<filter-name>Locale selection filter</filter-name>
<filter-class>edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Locale selection filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>JSession Strip Filter</filter-name>
<filter-class>edu.cornell.mannlib.vitro.webapp.filters.JSessionStripFilter</filter-class>
@ -1338,6 +1348,16 @@
<url-pattern>/orng/*</url-pattern>
</servlet-mapping>
<servlet>
<description>Multiple-language support. Allows user to select his preferred langauge</description>
<servlet-name>LocaleSelectionController</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LocaleSelectionController</servlet-name>
<url-pattern>/selectLocale</url-pattern>
</servlet-mapping>
<!-- ==================== tag libraries ============================== -->
<jsp-config>

View file

@ -8,6 +8,7 @@
<nav role="navigation">
<ul id="header-nav" role="list">
<#include "languageSelector.ftl">
<#if user.loggedIn>
<li role="listitem">${user.loginName}</li>
<li role="listitem"><a href="${urls.logout}" title="End your session">Log out</a></li>

View file

@ -0,0 +1,31 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--
How can this done with images instead of buttons containing images?
Why don't the "alt" values show as tooltips?"
What was the right way to do this?
-->
<#-- This is included by identity.ftl -->
<#if selectLocale??>
<li>
<form method="get" action="${selectLocale.selectLocaleUrl}" >
<#list selectLocale.locales as locale>
<button type="submit" name="selection" value="${locale.code}">
<img src="${locale.imageUrl}" height="15" align="middle" alt="${locale.label}"/>
</button>
<#if locale_has_next>|</#if>
</#list>
</form>
</li>
</#if>
<#--
* selectLocale
* -- selectLocaleUrl
* -- locales [list of maps]
* -- [map]
* -- code
* -- label (tooltip relative to the current Locale)
* -- imageUrl
-->