From: dbs Date: Mon, 8 Dec 2008 06:32:22 +0000 (+0000) Subject: Rework locale rules so that we don't have to list each installed locale X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=c5f3f643ec9c048decdca5f21c8a1989ee3ae91f;p=Evergreen.git Rework locale rules so that we don't have to list each installed locale Relying on Accept-Language as the staff client now specifies one and only one locale (sorry about your browser) git-svn-id: svn://svn.open-ils.org/ILS/trunk@11443 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/examples/apache/eg_vhost.conf b/Open-ILS/examples/apache/eg_vhost.conf index 3d96a8befb..672fb61e93 100644 --- a/Open-ILS/examples/apache/eg_vhost.conf +++ b/Open-ILS/examples/apache/eg_vhost.conf @@ -37,10 +37,21 @@ RewriteEngine ON RewriteRule ^/opac/extras/ac/jacket/(small|medium|large)/$ \ /opac/images/blank.png [P,L] +# ---------------------------------------------------------------------------------- +# Add the row ID (RID) and date so we can make unAPI happy +# ---------------------------------------------------------------------------------- RewriteEngine ON RewriteCond %{QUERY_STRING} (^r|&r)=(\d+) RewriteRule - - [E=OILS_OPAC_RID:%2] -RewriteRule - - [E=OILS_TIME_YEAR:%{TIME_YEAR}] +RewriteRule - - [E=OILS_TIME_YEAR:%{TIME_YEAR}] [L] + +# ---------------------------------------------------------------------------------- +# Pull the locale from the URL +# ---------------------------------------------------------------------------------- +RewriteEngine ON +RewriteCond %{REQUEST_URI} ^/opac/(.*?)/ +RewriteRule - - [E=locale:%1] [L] + # ---------------------------------------------------------------------------------- # Configure the OPAC # ---------------------------------------------------------------------------------- @@ -60,10 +71,6 @@ RewriteRule - - [E=OILS_TIME_YEAR:%{TIME_YEAR}] AddOutputFilter INCLUDES .xsl AddOutputFilter INCLUDES;XMLENT .xml - # add languages as necessary - SetEnvIf Request_URI "/en-US/" locale=en-US - SetEnvIf Request_URI "/fr-CA/" locale=fr-CA - SetEnvIf Request_URI "/hy-AM/" locale=hy-AM SetEnvIf Request_URI ".*" OILS_OPAC_BASE=/opac/ # This gives you the option to configure a different host to serve OPAC images from @@ -97,11 +104,21 @@ RewriteRule ^/opac/[^/]+/extras/slimpac/(.*)$ /opac/%1/extras/slimpac/$1? [redir # ---------------------------------------------------------------------------------- # Run server-side XUL and XHTML through xmlent to load the correct XML entities # ---------------------------------------------------------------------------------- - - SetEnvIfNoCase Accept-Language "en" locale=en-US - SetEnvIfNoCase Accept-Language "fr-CA" locale=fr-CA - SetEnvIfNoCase Accept-Language "hy-AM" locale=hy-AM - +RewriteEngine ON +RewriteCond %{HTTP:Accept-Language} ([a-z]{2}-[A-Z]{2}) +RewriteRule ^/xul/ - [E=locale:%1] +RewriteRule ^/reports/ - [E=locale:%1] [L] + +RewriteEngine ON +RewriteCond %{HTTP:Accept-Language} !([a-z]{2}-[A-Z]{2}) +RewriteRule ^/xul/ - [E=locale:en-US] +RewriteRule ^/reports/ - [E=locale:en-US] [L] + +# Default to en-US if we are just given en +RewriteEngine ON +RewriteCond %{ENV:locale} ^$ [OR] +RewriteCond %{ENV:locale} ^en$ +RewriteRule - - [E=locale:en-US] [L] Options +Includes @@ -271,9 +288,6 @@ RewriteRule ^/opac/[^/]+/extras/slimpac/(.*)$ /opac/%1/extras/slimpac/$1? [redir # ---------------------------------------------------------------------------------- Options +Includes - SetEnvIfNoCase Accept-Language "en" locale=en-US - SetEnvIfNoCase Accept-Language "fr-CA" locale=fr-CA - SetEnvIfNoCase Accept-Language "hy-AM" locale=hy-AM AddOutputFilter INCLUDES;XMLENT .xhtml @@ -299,7 +313,7 @@ RewriteRule ^/opac/[^/]+/extras/slimpac/(.*)$ /opac/%1/extras/slimpac/$1? [redir # Conify - next-generation Evergreen administration interface # ---------------------------------------------------------------------------------- RewriteEngine on -RewriteRule ^/conify/(.*)/global/(.*)$ /conify/global/$2 [E=locale:$1] +RewriteRule ^/conify/(.*)/global/(.*)$ /conify/global/$2 [E=locale:$1,L] XMLEntStripPI "yes" XMLEntEscapeScript "no" @@ -320,13 +334,12 @@ RewriteRule ^/conify/(.*)/global/(.*)$ /conify/global/$2 [E=locale:$1] # ---------------------------------------------------------------------------------- # Vandelay importers / exporters (your Web interface to bibliographic travel) # ---------------------------------------------------------------------------------- -# capture the locale from the URL -AliasMatch ^/vandelay/.*/vandelay.xml(.*) /openils/var/web/vandelay/vandelay.xml$1 +RedirectMatch 301 ^/vandelay/vandelay.xml(.*)$ /vandelay/en-US/vandelay.xml$1 + +RewriteEngine on +RewriteRule ^/vandelay/([a-z]{2}-[A-Z]{2})/(.*)$ /vandelay/$2 [E=locale:$1] + - RewriteEngine on - SetEnv locale en-US - SetEnvIf Request_URI "/en-US/" locale=en-US - SetEnvIf Request_URI "/fr-CA/" locale=fr-CA XMLEntStripPI "yes" XMLEntEscapeScript "no" XMLEntStripComments "yes" @@ -349,8 +362,6 @@ AliasMatch ^/vandelay/.*/vandelay.xml(.*) /openils/var/web/vandelay/vandelay.xml allow from all - - # OpenURL 0.1 searching based on OpenSearch RewriteEngine on RewriteMap openurl prg:/openils/bin/openurl_map.pl