From a3bd67097bd019f8e116aa329ee71aa764a2e5d2 Mon Sep 17 00:00:00 2001 From: j2blake Date: Thu, 24 Jan 2013 16:14:45 -0500 Subject: [PATCH] VIVO-12 NIHVIVO-4011 Provide config and GUI for selecting Locale --- doc/install.html | 79 +++++++++++++++++- doc/upgrade-1.6.html | 78 ++++++++++++++++- example.runtime.properties | 42 ++++++++++ .../app/loadedAtStartup/localeSelectionGUI.n3 | 12 +++ .../WEB-INF/resources/startup_listeners.txt | 3 + productMods/WEB-INF/web.xml | 20 +++++ themes/wilma/i18n/images/select_locale_en.GIF | Bin 0 -> 1490 bytes themes/wilma/i18n/images/select_locale_es.GIF | Bin 0 -> 1186 bytes themes/wilma/i18n/images/select_locale_fr.GIF | Bin 0 -> 1169 bytes themes/wilma/templates/identity.ftl | 1 + themes/wilma/templates/menu.ftl | 2 +- 11 files changed, 230 insertions(+), 7 deletions(-) create mode 100644 productMods/WEB-INF/ontologies/app/loadedAtStartup/localeSelectionGUI.n3 create mode 100644 themes/wilma/i18n/images/select_locale_en.GIF create mode 100644 themes/wilma/i18n/images/select_locale_es.GIF create mode 100644 themes/wilma/i18n/images/select_locale_fr.GIF diff --git a/doc/install.html b/doc/install.html index fa84c616..5c886d7b 100644 --- a/doc/install.html +++ b/doc/install.html @@ -305,7 +305,7 @@ Directory where the VIVO application will store the data that it creates. This includes uploaded files (usually images) 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. @@ -712,6 +712,82 @@ + + + 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. + + + + + languages.selectableLocales + + + en, es, fr_FR + + + + + + For developers only. + 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 false, which + means that a cached copy of each template will be used for 60 seconds + before the disk is checked for a new version. +
Setting this option to "true" slows down VIVO performance. + + + + + developer.defeatFreemarkerCache + + + false + + + + + + For developers only. + 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 false, which means that the language file is + read when VIVO starts up, or when a new theme is selected. +
Setting this option to "true" slows down VIVO performance. + + + + + developer.defeatI18nCache = true + + + false + + + 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. - OpenSocial.shindigURL
diff --git a/doc/upgrade-1.6.html b/doc/upgrade-1.6.html index 8a8874b0..99ff010e 100644 --- a/doc/upgrade-1.6.html +++ b/doc/upgrade-1.6.html @@ -232,10 +232,16 @@
+

If you prefer, you may start with example.build.properties and example.runtime.properties, make copies, and edit them to suit your installation. - +

+ +

+ The properties below are new to runtime.properties. They are optional, + so you need not add them, unless you want a value other than the default. +

@@ -249,19 +255,83 @@ Example Value + - 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. - BOGUS.PROPERTYNAME + languages.forceLocale - BOGUS EXAMPLE VALUE + 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. + + + + + languages.selectableLocales + + + en, es, fr_FR + + + + + + For developers only. + 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 false, which + means that a cached copy of each template will be used for 60 seconds + before the disk is checked for a new version. +
Setting this option to "true" slows down VIVO performance. + + + + + developer.defeatFreemarkerCache + + + false + + + + + + For developers only. + 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 false, which means that the language file is + read when VIVO starts up, or when a new theme is selected. +
Setting this option to "true" slows down VIVO performance. + + + + + developer.defeatI18nCache = true + + + false + + + diff --git a/example.runtime.properties b/example.runtime.properties index ce7c74ba..8155b2c8 100644 --- a/example.runtime.properties +++ b/example.runtime.properties @@ -159,6 +159,48 @@ proxy.eligibleTypeList = http://xmlns.com/foaf/0.1/Person, http://xmlns.com/foaf # 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 false, 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 +# false, 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 # The base URL of the ORNG Shindig server. Usually, this is the same host and port diff --git a/productMods/WEB-INF/ontologies/app/loadedAtStartup/localeSelectionGUI.n3 b/productMods/WEB-INF/ontologies/app/loadedAtStartup/localeSelectionGUI.n3 new file mode 100644 index 00000000..8a81aa25 --- /dev/null +++ b/productMods/WEB-INF/ontologies/app/loadedAtStartup/localeSelectionGUI.n3 @@ -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: . + + display:hasDataGetter display:localeSelectorDataGetter . + +display:localeSelectorDataGetter + a . diff --git a/productMods/WEB-INF/resources/startup_listeners.txt b/productMods/WEB-INF/resources/startup_listeners.txt index 300f7020..f097b3bd 100644 --- a/productMods/WEB-INF/resources/startup_listeners.txt +++ b/productMods/WEB-INF/resources/startup_listeners.txt @@ -59,6 +59,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 + # Add VIVO specific DocumentModifers, this must come before SolrSetup edu.cornell.mannlib.vitro.webapp.search.solr.VivoDocumentModifiers diff --git a/productMods/WEB-INF/web.xml b/productMods/WEB-INF/web.xml index 68c2e25a..ff022163 100644 --- a/productMods/WEB-INF/web.xml +++ b/productMods/WEB-INF/web.xml @@ -81,6 +81,16 @@ /* + + Override the Locale in the HttpRequest, if appropriate. + Locale selection filter + edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionFilter + + + Locale selection filter + /* + + JSession Strip Filter edu.cornell.mannlib.vitro.webapp.filters.JSessionStripFilter @@ -1401,6 +1411,16 @@ /orng/* + + Multiple-language support. Allows user to select his preferred langauge + LocaleSelectionController + edu.cornell.mannlib.vitro.webapp.i18n.selection.LocaleSelectionController + + + LocaleSelectionController + /selectLocale + + diff --git a/themes/wilma/i18n/images/select_locale_en.GIF b/themes/wilma/i18n/images/select_locale_en.GIF new file mode 100644 index 0000000000000000000000000000000000000000..b42e9a41dad89883cf3b575241a745266334cdf3 GIT binary patch literal 1490 zcmeIx|4$Ql7zglM1w8{}tq9gdCk4!CsbOWXSU`ay0w*rz{KjsAlcQ{KfQ&AKt!!Ch zr3ek9p`jq42G_z0HI;9L4YoRJA)>{_aO%J!1NteYc%W>Z%eLZO5rquLU9Vg07U^hb^xq4fD-`40X-CVJ#sM(LPTKA2 zHak~n=ga5t1+w%MQLgjQKCXQ%Ek~xjUY-yAVoMh!o(05MIb~ZQi?=!p^zpM2;~9+ zO~&QQI2@Xk&887dwv@>vV3>wO5DkO=&wuCw{Fl4D`~?X1LSMkU(v4Sdo`(Z@G1-f? zV+v*%G9vO(+^S>0T{PSLbG140Oiv9fuzXPy8D=WZ7)I{|MWJ~UZ5e&KyREVBSN+AX z9BJ8?WKrMP)~{>~4XcachHb71;)Zr0?Z|+BTEFLL@QcubNtNp4549ivn!m_W<*DK9 z$w9-6scf#`?`KPJPSjDfDG2v9G&ZF{@Ee&!#`&@8ir?3UwF+^EsC7H{*kSImPI1IX z_B+FUVCr&T>DCvLx*d^cMk-%fPSt7}^|vxxlD{8Zof(qO)vE^lr=k+;uw=|J!P2Gn zh^x!z8NT4&m9#6@TjDmH@rp{;f@ESMGJU+(d!W};bIRhpzsKg1Kh^YV=g%eYF5k$G zDq3*OMLpPZJ34m*nhj2bmkwoFa~wXBtkX+R&YzH&bBn0QsdH7IyeGiYb2C|ETi>jT z$g2r!f;%pTep$)zkN?fmUXgPFSSpuF)_r{Z_~x(b6QYd^UmtM5iw%hf8-g;D{GE@* z^RX%o`@^i@=FgAoG}FZDx78T2qqJ-O(<2cfj^_NPLPtvh&)STq1nu1^X^NFxP=t_$ zpuN)ZS?9Y4`%PyHD@q=|o}**Ad;|A}>zy6ScU%$I!r}h0fVktxvNrC6OUpXVb+Nhg zYBkT*^-VpmVbcknUax1|c7-Z2<|z=Bdlfl5SRvdu@!F#$UH=KQ+5HOck8gChcZF zSsxEk@SjbDYl?fv8IRVSxA`V_`8Cy_Whs6!4~n1P-4A-6+Y;`N+?z_;GAd4j;{OHm CUjG>Y literal 0 HcmV?d00001 diff --git a/themes/wilma/i18n/images/select_locale_es.GIF b/themes/wilma/i18n/images/select_locale_es.GIF new file mode 100644 index 0000000000000000000000000000000000000000..65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F#R$0pBjoPdC_1ygW z{?4wOc2ED_sEEHYCAeC4=N-c*&krmvmi3#xA^*(@+xKPL-qjSBUAetn{QJtCI_XE} zuWsL$SGVrll2=dn>%RY2^X2C2kM38i8;)MTQNtAWbbihq)*o{#AJ%TW*ZkMjLas@K zZ^wdySH3sqwTWq!Kd6(`%8;-65$o}&ovUp{BRgZB!+~rLmjw
    + <#include "languageSelector.ftl">
  • Index
  • <#if user.loggedIn> <#-- COMMENTING OUT THE EDIT PAGE LINK FOR RELEASE 1.5. WE NEED TO IMPLEMENT THIS IN A MORE diff --git a/themes/wilma/templates/menu.ftl b/themes/wilma/templates/menu.ftl index 52dd0850..d3f43dbd 100644 --- a/themes/wilma/templates/menu.ftl +++ b/themes/wilma/templates/menu.ftl @@ -3,7 +3,7 @@