[open-ils-commits] r11443 - trunk/Open-ILS/examples/apache

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Dec 8 01:32:25 EST 2008


Author: dbs
Date: 2008-12-08 01:32:22 -0500 (Mon, 08 Dec 2008)
New Revision: 11443

Modified:
   trunk/Open-ILS/examples/apache/eg_vhost.conf
Log:
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)


Modified: trunk/Open-ILS/examples/apache/eg_vhost.conf
===================================================================
--- trunk/Open-ILS/examples/apache/eg_vhost.conf	2008-12-07 20:34:23 UTC (rev 11442)
+++ trunk/Open-ILS/examples/apache/eg_vhost.conf	2008-12-08 06:32:22 UTC (rev 11443)
@@ -37,11 +37,22 @@
 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
 # ----------------------------------------------------------------------------------
 <LocationMatch /opac/>
@@ -60,10 +71,6 @@
     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,12 +104,22 @@
 # ----------------------------------------------------------------------------------
 # Run server-side XUL and XHTML through xmlent to load the correct XML entities
 # ----------------------------------------------------------------------------------
-<LocationMatch /xul>
-    SetEnvIfNoCase Accept-Language "en" locale=en-US
-    SetEnvIfNoCase Accept-Language "fr-CA" locale=fr-CA
-    SetEnvIfNoCase Accept-Language "hy-AM" locale=hy-AM
-</LocationMatch>
+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]
+
 <LocationMatch /xul/.*\.xhtml$>
     Options +Includes
     XMLEntEscapeScript "no"
@@ -271,9 +288,6 @@
 # ----------------------------------------------------------------------------------
 <LocationMatch /reports>
     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
 </LocationMatch>
 <LocationMatch /reports/fm_IDL.xml>
@@ -299,7 +313,7 @@
 # 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]
 <Location /conify>
     XMLEntStripPI "yes"
     XMLEntEscapeScript "no"
@@ -320,13 +334,12 @@
 # ----------------------------------------------------------------------------------
 # 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]
+
 <LocationMatch /vandelay.*xml>
-    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 @@
     allow from all
 </Location>
 
-
-
 # OpenURL 0.1 searching based on OpenSearch
 RewriteEngine on
 RewriteMap openurl prg:/openils/bin/openurl_map.pl



More information about the open-ils-commits mailing list