]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Language alias linker/installer/upgrade scripts
authorAmos Jeffries <squid3@treenet.co.nz>
Sat, 20 Jun 2009 14:36:50 +0000 (02:36 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Sat, 20 Jun 2009 14:36:50 +0000 (02:36 +1200)
alias-link.sh
  This is a script set designed to be called via make/Makefile and setup
  language codes for those languages which it would be impractical to
  bundle duplicate translated files for.
  Relies on local environment tools to be detected by automake.

make install
  - now also calls generation of aliases after existing install.
    Provided in file aliases.

make upgrade
  - cleans out legacy files from pre-3.1 and replaces with symlinks
    to the new upgraded language codes.
    Provided in file alias-upgrade.
  NP: this is a destructive process and must be manually run.

Bundle aliasing scripts and Makefile to use them with the langpack.

errors/Makefile.am
errors/alias-link.sh [new file with mode: 0755]
errors/alias-upgrade [new file with mode: 0644]
errors/aliases [new file with mode: 0644]

index 98c013871c506034dc471b1559453e4a32edaf2e..e93bbb9acefaaf172a11ac473b6cccfc6a3e4df5 100644 (file)
@@ -30,7 +30,8 @@ install-data-local:
        else \
                echo "$(INSTALL_DATA) $(srcdir)/errorpage.css $(DESTDIR)$(DEFAULT_STYLESHEET)"; \
                $(INSTALL_DATA) $(srcdir)/errorpage.css $(DESTDIR)$(DEFAULT_STYLESHEET); \
-       fi
+       fi \
+       $(SHELL) $(srcdir)/alias-link.sh "$(LN)" "$(RM)" "$(DESTDIR)$(DEFAULT_ERROR_DIR)" "$(srcdir)/aliases" || exit 1
 
 
 uninstall-local:
@@ -46,6 +47,10 @@ uninstall-local:
        @$(SHELL) $(top_srcdir)/scripts/remove-cfg.sh "$(RM)" $(DESTDIR)$(DEFAULT_STYLESHEET)
        rm -f $(DESTDIR)$(DEFAULT_STYLESHEET).default
 
+## Upgrade requires the new files to be pre-installed
+upgrade: install
+       $(SHELL) $(srcdir)/alias-link.sh "$(LN)" "$(RM)" "$(DESTDIR)$(DEFAULT_ERROR_DIR)" "$(srcdir)/alias-upgrade" || exit 1
+
 # undocumented hack.  You can use this target to create multi-lingual
 # error pages.  For example:
 #
@@ -81,7 +86,9 @@ dist-hook: translate
                  || exit 1; \
          fi; \
        done; \
-       cp -p $(srcdir)/errorpage.css  $(distdir)/errorpage.css
+       for f in aliases alias-link.sh alias-upgrade errorpage.css; do \
+               cp -p $(srcdir)/$$f $(distdir)/`basename $$f`; \
+       done;
 
 translate:
        @if ! test -f $(top_srcdir)/errors/en.po; then \
diff --git a/errors/alias-link.sh b/errors/alias-link.sh
new file mode 100755 (executable)
index 0000000..043623c
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Generate Symlinks for a set of aliases.
+# Our base content is the bundled .po translation output
+#
+# This file creates the authoritative ISO aliases.
+#
+# INPUT:   "$(LN)" "$(RM)" "$(DESTDIR)$(DEFAULT_ERROR_DIR)" "$(srcdir)/$@"
+
+LN="${1}"
+RM="${2}"
+DIR="${3}"
+ALIASFILE="${4}"
+
+if ! test -f ${ALIASFILE} ; then
+       echo "FATAL: Alias file ${ALIASFILE} does not exist!"
+       exit 1
+fi
+
+# Parse the alias file
+cat ${ALIASFILE} |
+while read base aliases; do
+       # file may be commented or have empty lines
+       if test "${base}" = "#" || test "${base}" = ""; then
+               continue;
+       fi
+       # split aliases based on whitespace and create a symlink for each
+       # Remove and replace any pre-existing content/link
+       for alia in ${aliases}; do
+               ${RM} -f -r ${DIR}/${alia} || exit 1
+               ${LN} -s ${DIR}/${base} ${DIR}/${alia} || exit 1
+       done
+done
diff --git a/errors/alias-upgrade b/errors/alias-upgrade
new file mode 100644 (file)
index 0000000..a314d15
--- /dev/null
@@ -0,0 +1,33 @@
+# 3.0 Still published with the old language namings.
+# we leave these alone in case any are configured...
+az     Azerbaijani
+bg     Bulgarian
+ca     Catalan
+cz     Czech
+da     Danish
+de     German
+el     Greek
+en     English
+es     Spanish
+et     Estonian
+fi     Finnish
+fr     French
+he     Hebrew
+hu     Hungarian
+hy     Armenian
+it     Italian
+ja     Japanese
+ko     Korean
+lt     Lithuanian
+nl     Dutch
+po     Polish
+pt     Portuguese
+ro     Romanian
+ru     Russian-1251 Russian-koi8-r
+sk     Slovak
+sr     Serbian
+sv     Swedish
+tr     Turkish
+uk     Ukrainian-1251 Ukrainian-koi8-u Ukrainian-utf8
+zh-cn  Simplify_Chinese
+zh-tw  Traditional_Chinese
diff --git a/errors/aliases b/errors/aliases
new file mode 100644 (file)
index 0000000..49bf486
--- /dev/null
@@ -0,0 +1,2 @@
+en     en-nz en-au en-gb en-uk en-ca
+ru     ru-ru