You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ja...@apache.org on 2025/09/28 10:46:56 UTC
svn commit: r1928807 - httpd/dev-tools/doc
Author: jailletc36
Date: Sun Sep 28 10:46:56 2025
New Revision: 1928807
Log:
Scripts from Takashi Sato that generate translation status from all languages.
These are the original versions of the files collected from people.a.o before it went off-line a few years ago.
Added:
httpd/dev-tools/doc/
httpd/dev-tools/doc/translation-status-cron.sh (contents, props changed)
httpd/dev-tools/doc/translation-status.sh (contents, props changed)
Added: httpd/dev-tools/doc/translation-status-cron.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ httpd/dev-tools/doc/translation-status-cron.sh Sun Sep 28 10:46:56 2025 (r1928807)
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# Copyright 2014 Takashi Sato
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+export PATH=$PATH:/bin:/usr/bin:/usr/local/bin
+HOME=/home/takashi
+SCRIPTDIR=${HOME}/translation-status
+OUTDIR=${HOME}/public_html/translation-status
+SVNWORKDIR=${HOME}/docs-svn
+
+for v in trunk 2.4 2.2 2.0; do
+ (
+ cd ${SVNWORKDIR}/${v} &&
+ svn up -q &&
+ cd manual &&
+ ( ${SCRIPTDIR}/translation-status.sh > ${OUTDIR}/${v}-new.json ) &&
+ ( cd ${OUTDIR} && mv ${v}-new.json ${v}.json )
+ )
+done
Added: httpd/dev-tools/doc/translation-status.sh
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ httpd/dev-tools/doc/translation-status.sh Sun Sep 28 10:46:56 2025 (r1928807)
@@ -0,0 +1,128 @@
+#!/bin/sh
+
+# Copyright 2014 Takashi Sato
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+english(){
+ local rev=`egrep "^<\!-- .LastChangedRevision: [0-9]+ . -->" $1 | awk '{printf $3;}'`
+ if [ -n "$rev" ];then
+ echo -n $rev
+ else
+ echo -n "\"error\""
+ fi
+}
+
+otherlang(){
+ if [ -f $1 ];then
+ #正規表現はmetafile.plから取った
+ local rev=`perl -e 'while(<>){ $rev = $1, last if /<!--\s*English\s+Revision\s*:\s*(\d+)(?::(\S+)\s+\(outdated\))?\s+-->/xi;}; print $rev;' < $1`
+
+ if [ -n "$rev" ];then
+ echo -n $rev
+ else
+ echo -n "\"error\""
+ fi
+ fi
+}
+
+is_manualpage(){
+ test `grep "common.dtd" $1 | wc -l` -gt 0 ||
+ test `grep "faq.dtd" $1 | wc -l` -gt 0 ||
+ test `grep "manualpage.dtd" $1 | wc -l` -gt 0 ||
+ test `grep "modulesynopsis.dtd" $1 | wc -l` -gt 0 ||
+ test `grep "sitemap.dtd" $1 | wc -l` -gt 0
+}
+
+find_xml(){
+ find $1 -type d -mindepth 1 -maxdepth 1 | sort | while read line; do
+ find_xml $line
+ done
+ find $1 -type f -mindepth 1 -maxdepth 1 -name "*.xml" | while read line; do
+ is_manualpage $line && echo $line
+ done | sort
+}
+
+#1個目の引数で、マニュアルディレクトリを指定する。
+#引数無しの場合、カレントディレクトリとする。
+if [ $# -ge 1 ];then
+ cd "$1" || exit 1
+fi
+
+
+langs=`ls style/lang | egrep -v "^en.xml$" | awk -F . '{printf $1 " ";}'`
+
+#1行目 言語一覧
+#2行目以降
+# error: ファイルは存在するが、リビジョン不明
+# 値無し: ファイルが存在しない
+
+
+echo -n "{\"langs\":["
+first=1
+for lang in $langs; do
+ if [ $first -eq 1 ];then
+ first=0
+ else
+ echo -n ","
+ fi
+ echo -n "\"$lang\""
+done
+echo "],"
+echo "\"files\":{"
+
+
+(
+ cd style/lang && (
+ echo -n "\"style/lang/\":{"
+ echo -n "\"rev\":"
+ english en.xml
+ echo -n ",\"translations\":{"
+ first=1
+ for lang in $langs; do
+ foo=$(otherlang "${lang}.xml")
+ if [ $first -eq 1 ];then
+ first=0
+ else
+ echo -n ","
+ fi
+ if [ "$foo" != "" ];then
+ echo -n "\"${lang}\":${foo}"
+ fi
+ done
+ echo -n "}}"
+ )
+)
+
+find_xml . | while read file; do
+ echo ","
+ echo -n "\"${file#./}\":{"
+ echo -n "\"rev\":"
+ english $file
+ echo -n ",\"translations\":{"
+ first=1
+ for lang in $langs; do
+ foo=$(otherlang ${file}.$lang)
+ if [ "$foo" != "" ];then
+ if [ $first -eq 1 ];then
+ first=0
+ else
+ echo -n ","
+ fi
+ echo -n "\"${lang}\":${foo}"
+ fi
+ done
+ echo -n "}}"
+done
+echo ""
+echo "}}"