Improve transtable.{xml,xsl}, including:

- The structure of transtable.xml is revised.  <word> should be
   bracketed with <group>.

 - A sorting order of the FreeBSD mirror sites rendered using
   mirrors.xml has been determined by sort(1).

 - A template "transtable-lookup" has been added for localization on
   word-by-word basis.

 - Replace English month names in news.xml, press.xml, and
   advisories.xml with numbers that correspond to the names.
   The number->name translation is performed on the fly.

 - Since information in mirrors.xml is used in www/ tree, it depends on
   doc/ tree now.  When WITHOUT_DOC is defined it can be built without
   doc/ tree, but some information becomes unavailable.  For example,
   a list of the mirror sites generated in index.html becomes a dummy
   one, and calling "transtable-lookup" with a word returns the word
   itself.

Neither www/ nor doc/ build should be broken due to this commit, but
until the necessary changes are applied in the localized directories,
the transtable does not work; it simply generates non-localized contents
even if transtable.xsl is used.
This commit is contained in:
Hiroki Sato 2004-01-12 21:27:01 +00:00
parent f4273f2cd9
commit 2e2010fbb7
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=19617
11 changed files with 487 additions and 268 deletions

View file

@ -5,6 +5,9 @@
# documents commonly used in doc/ and www/ tree.
#
AWK?= /usr/bin/awk
GREP?= /usr/bin/grep
.if defined(DOC_PREFIX) && !empty(DOC_PREFIX)
WEB_PREFIX?= ${DOC_PREFIX}/../www
.elif defined(WEB_PREFIX) && !empty(WEB_PREFIX)
@ -98,13 +101,6 @@ _WWW_LANGCODE:= ${_WWW2_LANGCODE}
.endif
WWW_LANGCODE?= ${_WWW_LANGCODE}
# ------------------------------------------------------------------------
#
# advisories.xml dependency.
#
XML_ADVISORIES= ${WEB_PREFIX}/share/sgml/advisories.xml
# ------------------------------------------------------------------------
#
# mirrors.xml dependency.
@ -122,6 +118,7 @@ XSL_MIRRORS= ${DOC_PREFIX}/share/sgml/mirrors-local.xsl
.endif
XSL_TRANSTABLE_MASTER= ${DOC_PREFIX}/share/sgml/transtable-master.xsl
XSL_TRANSTABLE_COMMON= ${DOC_PREFIX}/share/sgml/transtable-common.xsl
.if exists(${DOC_PREFIX}/${LANGCODE}/share/sgml/transtable-local.xsl)
XSL_TRANSTABLE= ${DOC_PREFIX}/${LANGCODE}/share/sgml/transtable-local.xsl
@ -135,13 +132,29 @@ XML_TRANSTABLE= ${DOC_PREFIX}/${LANGCODE}/share/sgml/transtable.xml
XML_TRANSTABLE= ${DOC_PREFIX}/share/sgml/transtable.xml
.endif
${XSL_MIRRORS}: ${XSL_MIRRORS_MASTER}
${XSL_MIRRORS}: ${XSL_MIRRORS_MASTER} ${XSL_TRANSTABLE_COMMON}
${XML_MIRRORS}: ${XML_MIRRORS_MASTER} ${XSL_TRANSTABLE} ${XSL_TRANSTABLE_MASTER}
${XML_MIRRORS}: ${XML_MIRRORS_MASTER} ${XSL_TRANSTABLE} ${XSL_TRANSTABLE_MASTER} ${XSL_TRANSTABLE_COMMON}
${MKDIR} -p ${@:H}
${XSLTPROC} ${XSLTPROCOPTS} \
--param 'transtable.xml' "'${XML_TRANSTABLE}'" \
--param 'transtable-target-element' "'country'" \
--param 'transtable-word-group' "'country'" \
--param 'transtable-mode' "'sortkey'" \
${XSL_TRANSTABLE} ${XML_MIRRORS_MASTER} \
| env -i LANG="${LANGCODE}" ${SORT} -f > $@.sort.tmp
env -i ${GREP} "^<?xml" < $@.sort.tmp > $@.sort
${ECHO} "<sortkeys>" >> $@.sort
env -i ${AWK} '/^ / {sub(/@sortkey@/, ++line); print;}' < $@.sort.tmp >> $@.sort
${ECHO} '</sortkeys>' >> $@.sort
${XSLTPROC} ${XSLTPROCOPTS} -o $@ \
--param 'transtable.xml' "'${XML_TRANSTABLE}'" \
--param 'transtable-conv-element' "'country'" \
--param 'transtable-target-element' "'country'" \
--param 'transtable-word-group' "'country'" \
--param 'transtable-sortkey.xml' "'$@.sort'" \
${XSL_TRANSTABLE} ${XML_MIRRORS_MASTER}
${RM} -f $@.sort $@.sort.tmp
CLEANFILES+= ${XML_MIRRORS}
CLEANFILES+= ${XML_MIRRORS}.sort
CLEANFILES+= ${XML_MIRRORS}.sort.tmp