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

This commit is contained in:
j2blake 2013-01-24 16:14:45 -05:00
parent 89f759fcbc
commit a3bd67097b
11 changed files with 230 additions and 7 deletions

View file

@ -305,7 +305,7 @@
Directory where the VIVO application will store Directory where the VIVO application will store
the data that it creates. This includes uploaded files (usually images) the data that it creates. This includes uploaded files (usually images)
and the Solr search index. Be sure this directory exists and is and the Solr search index. Be sure this directory exists and is
writable by the user who the Tomcat service is running as. writable by the Tomcat service.
</td> </td>
</tr> </tr>
<tr class="odd_row"> <tr class="odd_row">
@ -712,6 +712,82 @@
</td> </td>
</tr> </tr>
<tr>
<td colspan="2">
Force VIVO to use a specific language or Locale instead of those
specified by the browser.
This affects RDF data retrieved from the model, if RDFService.languageFilter is true.
This also affects the text of pages that have been modified to support multiple languages.
</td>
</tr>
<tr class="odd_row">
<td>
languages.forceLocale
</td>
<td>
en_US
</td>
</tr>
<tr>
<td colspan="2">
A list of supported languages or Locales that the user may choose to
use instead of the one specified by the browser. Selection images must
be available in the i18n/images directory of the theme.
This affects RDF data retrieved from the model, if RDFService.languageFilter is true.
This also affects the text of pages that have been modified to support multiple languages.
</td>
</tr>
<tr class="odd_row">
<td>
languages.selectableLocales
</td>
<td>
en, es, fr_FR
</td>
</tr>
<tr>
<td colspan="2">
<b>For developers only.</b>
Defeat the Freemarker template cache, so each template
is read from disk on each request. This permits developers to immediately
see the effect of changes to the template. The default is <code>false</code>, which
means that a cached copy of each template will be used for 60 seconds
before the disk is checked for a new version.
<br/><b>Setting this option to "true" slows down VIVO performance.</b>
</td>
</tr>
<tr class="odd_row">
<td>
developer.defeatFreemarkerCache
</td>
<td>
false
</td>
</tr>
<tr>
<td colspan="2">
<b>For developers only.</b>
Defeat the cache of language-specific text strings,
so the language file is read from disk on each request.
This permits developers to immediately
see the effect of changes to the text strings.
The default is <code>false</code>, which means that the language file is
read when VIVO starts up, or when a new theme is selected.
<br/><b>Setting this option to "true" slows down VIVO performance.</b>
</td>
</tr>
<tr class="odd_row">
<td>
developer.defeatI18nCache = true
</td>
<td>
false
</td>
</tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
These values are used when deploying VIVO as an OpenSocial container These values are used when deploying VIVO as an OpenSocial container
@ -720,7 +796,6 @@
a VIVO installation that does not use OpenSocial gadgets, these values are omitted. a VIVO installation that does not use OpenSocial gadgets, these values are omitted.
</td> </td>
</tr> </tr>
<tr class="odd_row"> <tr class="odd_row">
<td> <td>
OpenSocial.shindigURL<br> OpenSocial.shindigURL<br>

View file

@ -232,10 +232,16 @@
</tbody> </tbody>
</table> </table>
<br> <br>
<p>
If you prefer, you may start with <code>example.build.properties</code> If you prefer, you may start with <code>example.build.properties</code>
and <code>example.runtime.properties</code>, make copies, and <code>example.runtime.properties</code>, make copies,
and edit them to suit your installation. and edit them to suit your installation.
</p>
<p>
The properties below are new to <code>runtime.properties</code>. They are optional,
so you need not add them, unless you want a value other than the default.
</p>
<p> <p>
<!-- runtime.properties table from install.html --> <!-- runtime.properties table from install.html -->
</p> </p>
@ -249,19 +255,83 @@
Example Value Example Value
</th> </th>
</tr> </tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
BOGUS: ANY NEW PROPERTIES TO ADD? Force VIVO to use a specific language or Locale instead of those
specified by the browser.
This affects RDF data retrieved from the model, if RDFService.languageFilter is true.
This also affects the text of pages that have been modified to support multiple languages.
</td> </td>
</tr> </tr>
<tr class="odd_row blue"> <tr class="odd_row blue">
<td> <td>
BOGUS.PROPERTYNAME languages.forceLocale
</td> </td>
<td> <td>
BOGUS EXAMPLE VALUE en_US
</td> </td>
</tr> </tr>
<tr>
<td colspan="2">
A list of supported languages or Locales that the user may choose to
use instead of the one specified by the browser. Selection images must
be available in the i18n/images directory of the theme.
This affects RDF data retrieved from the model, if RDFService.languageFilter is true.
This also affects the text of pages that have been modified to support multiple languages.
</td>
</tr>
<tr class="odd_row blue">
<td>
languages.selectableLocales
</td>
<td>
en, es, fr_FR
</td>
</tr>
<tr>
<td colspan="2">
<b>For developers only.</b>
Defeat the Freemarker template cache, so each template
is read from disk on each request. This permits developers to immediately
see the effect of changes to the template. The default is <code>false</code>, which
means that a cached copy of each template will be used for 60 seconds
before the disk is checked for a new version.
<br/><b>Setting this option to "true" slows down VIVO performance.</b>
</td>
</tr>
<tr class="odd_row blue">
<td>
developer.defeatFreemarkerCache
</td>
<td>
false
</td>
</tr>
<tr>
<td colspan="2">
<b>For developers only.</b>
Defeat the cache of language-specific text strings,
so the language file is read from disk on each request.
This permits developers to immediately
see the effect of changes to the text strings.
The default is <code>false</code>, which means that the language file is
read when VIVO starts up, or when a new theme is selected.
<br/><b>Setting this option to "true" slows down VIVO performance.</b>
</td>
</tr>
<tr class="odd_row blue">
<td>
developer.defeatI18nCache = true
</td>
<td>
false
</td>
</tr>
</tbody> </tbody>
</table> </table>

View file

@ -159,6 +159,48 @@ proxy.eligibleTypeList = http://xmlns.com/foaf/0.1/Person, http://xmlns.com/foaf
# #
RDFService.languageFilter = true RDFService.languageFilter = true
#
# Force VIVO to use a specific language or Locale instead of those
# specified by the browser. This affects RDF data retrieved from the model,
# if RDFService.languageFilter is true. This also affects the text of pages
# that have been modified to support multiple languages.
#
# languages.forceLocale = en_US
#
# A list of supported languages or Locales that the user may choose to
# use instead of the one specified by the browser. Selection images must
# be available in the i18n/images directory of the theme. This affects
# RDF data retrieved from the model, if RDFService.languageFilter is true.
# This also affects the text of pages that have been modified to support
# multiple languages.
#
# This should not be used with languages.forceLocale, which will override it.
#
# languages.selectableLocales = en, es, fr
#
# For developers only: Setting this option to "true" slows down VIVO performance.
#
# Defeat the Freemarker template cache, so each template is read from disk
# on each request. This permits developers to immediately see the effect of
# changes to the template. The default is <code>false</code>, which means
# that a cached copy of each template will be used for 60 seconds before
# the disk is checked for a new version.
#
# developer.defeatFreemarkerCache = true
#
# For developers only: Setting this option to "true" slows down VIVO performance.
#
# Defeat the cache of language-specific text strings, so the language file
# is read from disk on each request. This permits developers to immediately
# see the effect of changes to the text strings. The default is
# <code>false</code>, which means that the language file is read when
# VIVO starts up, or when a new theme is selected.
#
# developer.defeatI18nCache = true
# #
# For OpenSocial integration # For OpenSocial integration
# The base URL of the ORNG Shindig server. Usually, this is the same host and port # The base URL of the ORNG Shindig server. Usually, this is the same host and port

View file

@ -0,0 +1,12 @@
# $This file is distributed under the terms of the license in /doc/license.txt$
#
# Associate the LocaleSelectionDataGetter with the languageSelector.ftl Freemarker template.
#
@prefix display: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#> .
<freemarker:languageSelector.ftl> display:hasDataGetter display:localeSelectorDataGetter .
display:localeSelectorDataGetter
a <java:edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionDataGetter> .

View file

@ -59,6 +59,9 @@ edu.cornell.mannlib.vitro.webapp.services.shortview.ShortViewServiceSetup
edu.ucsf.vitro.opensocial.OpenSocialSmokeTests edu.ucsf.vitro.opensocial.OpenSocialSmokeTests
# For multiple language support
edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionSetup
# Add VIVO specific DocumentModifers, this must come before SolrSetup # Add VIVO specific DocumentModifers, this must come before SolrSetup
edu.cornell.mannlib.vitro.webapp.search.solr.VivoDocumentModifiers edu.cornell.mannlib.vitro.webapp.search.solr.VivoDocumentModifiers

View file

@ -81,6 +81,16 @@
<url-pattern>/*</url-pattern> <url-pattern>/*</url-pattern>
</filter-mapping> </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>
<filter-name>JSession Strip Filter</filter-name> <filter-name>JSession Strip Filter</filter-name>
<filter-class>edu.cornell.mannlib.vitro.webapp.filters.JSessionStripFilter</filter-class> <filter-class>edu.cornell.mannlib.vitro.webapp.filters.JSessionStripFilter</filter-class>
@ -1401,6 +1411,16 @@
<url-pattern>/orng/*</url-pattern> <url-pattern>/orng/*</url-pattern>
</servlet-mapping> </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>
<!-- ============================== servlet-mappings ======================== --> <!-- ============================== servlet-mappings ======================== -->
<servlet-mapping> <servlet-mapping>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -9,6 +9,7 @@
<nav role="navigation"> <nav role="navigation">
<ul id="header-nav" role="list"> <ul id="header-nav" role="list">
<#include "languageSelector.ftl">
<li role="listitem"><a href="${urls.index}" title="index">Index</a></li> <li role="listitem"><a href="${urls.index}" title="index">Index</a></li>
<#if user.loggedIn> <#if user.loggedIn>
<#-- COMMENTING OUT THE EDIT PAGE LINK FOR RELEASE 1.5. WE NEED TO IMPLEMENT THIS IN A MORE <#-- COMMENTING OUT THE EDIT PAGE LINK FOR RELEASE 1.5. WE NEED TO IMPLEMENT THIS IN A MORE

View file

@ -3,7 +3,7 @@
<nav role="navigation"> <nav role="navigation">
<ul id="main-nav" role="list"> <ul id="main-nav" role="list">
<#list menu.items as item> <#list menu.items as item>
<li role="listitem"><a href="${item.url}" title="menu item" <#if item.active> class="selected" </#if>>${item.linkText}</a></li> <li role="listitem"><a href="${item.url}" title="${item.linkText} menu item" <#if item.active> class="selected" </#if>>${item.linkText}</a></li>
</#list> </#list>
</ul> </ul>
</nav> </nav>