TPAC: Standardize i18n file installation
authorDan Scott <dscott@laurentian.ca>
Mon, 20 Aug 2012 18:11:50 +0000 (14:11 -0400)
committerBill Erickson <berick@esilibrary.com>
Tue, 21 Aug 2012 14:00:42 +0000 (10:00 -0400)
Make TPAC i18n files act like any other i18n file. In short:

1. When in build/i18n, a 'make LOCALE=fr-CA install' will copy
   the i18n file into the Open-ILS/src/data/locale directory.
2. In the build root, a 'make install' will copy all files from
   Open-ILS/src/data/locale into (by default) the
   /openils/var/data/locale directory.

This also means that when tarballs are created, all of the locales will
get packaged appropriately.

This commit also updates eg_vhost.conf to provide working out-of-the-box
examples for any installed locales, by using the names of the actual
PO files, and adds some contextual comments to explain how the
configuration directives work.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Bill Erickson <berick@esilibrary.com>

Open-ILS/examples/apache/eg_vhost.conf
Open-ILS/src/Makefile.am
build/i18n/Makefile

index 0265d66..c2b4cd2 100644 (file)
@@ -574,13 +574,22 @@ RewriteRule ^/openurl$ ${openurl:%1} [NE,PT]
     #PerlSetVar OILSWebMediaPrefix "static.example.com/media"
     #PerlSetVar OILSWebMediaPrefix "http://static.example.com/media"
 
-    # Locale messages files
+    # Locale messages files:
+    #
+    # These appear in pairs; the first represents the user agent
+    # Accept-Language header locale, and the second represents
+    # the fully-qualified path for the corresponding PO file that
+    # contains the messages.
+    #
+    # If you enable two or more locales, then users will be able to
+    # select their preferred locale from a locale picker in the TPAC.
+    #
     #PerlAddVar OILSWebLocale "en"
     #PerlAddVar OILSWebLocale "/openils/var/data/locale/messages.en.po"
     #PerlAddVar OILSWebLocale "en_ca"
-    #PerlAddVar OILSWebLocale "/openils/var/data/locale/messages.en_ca.po"
+    #PerlAddVar OILSWebLocale "/openils/var/data/locale/en-CA.po"
     #PerlAddVar OILSWebLocale "fr_ca"
-    #PerlAddVar OILSWebLocale "/openils/var/data/locale/messages.fr_ca.po"
+    #PerlAddVar OILSWebLocale "/openils/var/data/locale/fr-CA.po"
 
     # Templates will be loaded from the following paths in reverse order.
     PerlAddVar OILSWebTemplatePath "/openils/var/templates"
index 8fe8302..42497a1 100644 (file)
@@ -153,6 +153,7 @@ data_DATA = $(core_data) $(reporter_data)
 SUBDIRS = $(OILSCORE_DIRS) $(OILSWEB_DIR) $(OILSPYTHON_DIR) $(OILSJAVA_DIR)
 
 EXTRA_DIST = @srcdir@/perlmods \
+       @srcdir@/data \
        @srcdir@/templates \
        @top_srcdir@/Open-ILS/xsl \
        @srcdir@/cgi-bin \
@@ -218,6 +219,9 @@ ilscore-install:
        $(MKDIR_P) $(DESTDIR)$(TEMPLATEDIR)
        @echo "Installing templates to $(DESTDIR)$(TEMPLATEDIR)"
        cp -r @srcdir@/templates/* $(DESTDIR)$(TEMPLATEDIR)
+       $(MKDIR_P) $(DESTDIR)$(datadir)/locale/
+       @echo "Installing template data files to $(datadir)/locale/"
+       cp @srcdir@/data/locale/* $(datadir)/locale/
        $(MKDIR_P) $(DESTDIR)$(datadir)/overdue/
        sed -i 's|LOCALSTATEDIR|@localstatedir@|g' '$(DESTDIR)@sysconfdir@/oils_sip.xml.example'
        sed -i 's|SYSCONFDIR|@sysconfdir@|g' '$(DESTDIR)@sysconfdir@/oils_sip.xml.example'
index 534f2df..343909a 100644 (file)
@@ -6,6 +6,7 @@ POTLIST=$(shell ls -d po/*)
 DTDDIR=../../Open-ILS/web/opac/locale
 CHROME_PROPSDIR=../../Open-ILS/xul/staff_client/chrome/locale
 SERVER_PROPSDIR=../../Open-ILS/xul/staff_client/server/locale
+TT2_DATA_DIR=../../Open-ILS/src/data/locale
 DOJO_LOCALE := $(shell echo ${LOCALE} | tr '[:upper:]' '[:lower:]')
 DOJO_ACQ_SRC=../../Open-ILS/web/js/dojo/openils/acq/nls
 DOJO_ACTOR_SRC=../../Open-ILS/web/js/dojo/openils/actor/nls
@@ -317,6 +318,8 @@ install: updatepo project fmidl2fmidlent fmidlpo2entity-en
        cp $(PROJECT)/$(LOCALE)/Searcher.js $(DOJO_WIDGET_SRC)/$(DOJO_LOCALE)/Searcher.js
        cp $(PROJECT)/$(LOCALE)/TranslatorPopup.js $(DOJO_WIDGET_SRC)/$(DOJO_LOCALE)/TranslatorPopup.js
        cp $(PROJECT)/$(LOCALE)/XULTermLoader.js $(DOJO_WIDGET_SRC)/$(DOJO_LOCALE)/XULTermLoader.js
+       mkdir -p $(TT2_DATA_DIR)
+       cp $(PO)/tpac/$(LOCALE).po $(TT2_DATA_DIR)/.
 
 install_all_locales: newpot
        for i in `ls po/*/*po|grep -v en-US | cut -f3 -d'/' | cut -f1 -d. | sort | uniq`; \