prepare new release of v0.3.4 with Japanese translation
This commit is contained in:
parent
d2e91a7f08
commit
71ea9cd469
729 changed files with 120489 additions and 0 deletions
88
v0.3.4.1/scripts/fetch_po_files.sh
Executable file
88
v0.3.4.1/scripts/fetch_po_files.sh
Executable file
|
@ -0,0 +1,88 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# this script symlinks all cbx po files to a language directory structure, as
|
||||
# it is used by the pootle translation server
|
||||
#
|
||||
# all language files are chgrp'ed to the 'pootle' group and group write
|
||||
# permissions are added
|
||||
#
|
||||
# call this script whenever you add _new_ languages to your translation server
|
||||
#
|
||||
# it is useful to be root while calling it - otherwise chgrp will fail
|
||||
#
|
||||
#
|
||||
# Copyright 2006 sense.lab e.V.
|
||||
#
|
||||
# This file is part of the CryptoBox.
|
||||
#
|
||||
# The CryptoBox is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# The CryptoBox is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with the CryptoBox; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
|
||||
set -eu
|
||||
|
||||
test $# -ne 1 && echo "Usage: $(basename $0) TARGET_DIR" && exit 1
|
||||
|
||||
test ! -d "$1" && echo "target directory does not exist: '$1'" && exit 1
|
||||
|
||||
if test "$(id -u)" == 0
|
||||
then is_root=1
|
||||
else is_root=0
|
||||
echo "$(basename $0) not running as root: the language files will not be writeable for pootle" >&2
|
||||
echo " run this script as root to change the permissions of the language files appropriately" >&2
|
||||
fi
|
||||
|
||||
DEST_GROUP=pootle
|
||||
TARGETPATH=${1%/}
|
||||
BASEPATH=$(cd $(dirname "$0")/..; pwd)
|
||||
|
||||
############# functions ###############
|
||||
|
||||
# symlink a language file and chgrp if possible
|
||||
# Paramters: LANG_FILE LANGUAGE
|
||||
process_language_file()
|
||||
{
|
||||
test ! -d "${TARGETPATH}/$2" && mkdir -p "${TARGETPATH}/$2"
|
||||
ln -sfn "$1" "${TARGETPATH}/$2/"
|
||||
if test "$is_root" == 1
|
||||
then chgrp "$DEST_GROUP" "$1" "$TARGETPATH/$2"
|
||||
chmod g+w "$1" "$TARGETPATH/$2"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
############# main #################
|
||||
|
||||
|
||||
for language in $(ls ${BASEPATH}/intl/) ; do
|
||||
test ! -d "${BASEPATH}/intl/${language}" && continue
|
||||
echo "Processing $language ..."
|
||||
[ ! -d ${TARGETPATH}/${language} ] && mkdir -p ${TARGETPATH}/${language}
|
||||
## base translation
|
||||
find "${BASEPATH}/intl/${language}" -name \*.po | while read fname
|
||||
do process_language_file "$fname" "$language"
|
||||
done
|
||||
## plugin translations
|
||||
find "${BASEPATH}/plugins/" -name \*.po | \
|
||||
grep "/intl/$language/" | while read fname
|
||||
do process_language_file "$fname" "$language"
|
||||
done
|
||||
done
|
||||
|
||||
echo "Processing template files ..."
|
||||
find ${BASEPATH}/intl ${BASEPATH}/plugins -type f -name \*.pot | while read fname
|
||||
do process_language_file "$fname" "template"
|
||||
done
|
||||
|
15
v0.3.4.1/scripts/revert_unchanged_po_files.sh
Executable file
15
v0.3.4.1/scripts/revert_unchanged_po_files.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# run this script whenever you used update_po_files.sh to remove all changes of files.
|
||||
# It reverts all po-files where just the POT-Creation-Date header line was changed (not new translations)
|
||||
#
|
||||
|
||||
BASE_DIR=$(cd $(dirname "$0")/..; pwd)
|
||||
|
||||
cd "$BASE_DIR"
|
||||
svn stat intl plugins | grep "\.po$" | cut -d " " -f 2- | while read po_file
|
||||
do test -z "$(svn diff $po_file)" && continue
|
||||
diff=$(svn diff "$po_file" | grep "^\+" | grep -v "^\+\{3\}" | grep -v "POT-Creation-Date")
|
||||
test -z "$diff" && svn revert "$po_file"
|
||||
done
|
||||
|
9
v0.3.4.1/scripts/show_TODO.sh
Executable file
9
v0.3.4.1/scripts/show_TODO.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 02005 sense.lab <senselab@systemausfall.org>
|
||||
#
|
||||
# License: This script is distributed under the terms of version 2
|
||||
# of the GNU GPL. See the LICENSE file included with the package.
|
||||
#
|
||||
|
||||
grep "TODO" $(find "$(dirname $0)/.." -type f | grep -v "\.svn" | grep -v "$(basename $0)")
|
159
v0.3.4.1/scripts/update_po_files.py
Executable file
159
v0.3.4.1/scripts/update_po_files.py
Executable file
|
@ -0,0 +1,159 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# Copyright 2006 sense.lab e.V.
|
||||
#
|
||||
# This file is part of the CryptoBox.
|
||||
#
|
||||
# All available hdf language files are parsed for creating pot (po-template) files.
|
||||
# All existing po-file are merged with these templates to remove obsolete msgids.
|
||||
# Additionally every msgstr of the english original is set to the value of the
|
||||
# respective msgid.
|
||||
# All resulting po files are chmod'ed to 0666 - this is useful if you locally use
|
||||
# services like pootle.
|
||||
#
|
||||
# The CryptoBox is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# The CryptoBox is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with the CryptoBox; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
|
||||
import os
|
||||
import sys
|
||||
try:
|
||||
import translate.storage.po, translate.convert.pot2po, translate.tools.pocompile
|
||||
except ImportError, errMsg:
|
||||
sys.stderr.write("Failed to import a python module of the 'translate' package!\n")
|
||||
sys.stderr.write("Please install the appropriate files - for debian just do 'apt-get install translate-toolkit'.\n")
|
||||
sys.stderr.write("\tOriginal error message: %s\n\n" % errMsg)
|
||||
sys.exit(1)
|
||||
try:
|
||||
import neo_cgi, neo_util
|
||||
except ImportError, errMsg:
|
||||
sys.stderr.write("Failed to import a python module of the 'clearsilver' package!\n")
|
||||
sys.stderr.write("Please install the appropriate files - for debian just do 'apt-get install python-clearsilver'.\n")
|
||||
sys.stderr.write("\tOriginal error message: %s\n\n" % errMsg)
|
||||
sys.exit(1)
|
||||
|
||||
LANGUAGE_FILE = 'language.hdf'
|
||||
## name of the main domain and prefix for all plugin domains
|
||||
GETTEXT_DOMAIN = 'cryptobox-server'
|
||||
## set the msgstrs for this language to the value of the respective msgids
|
||||
DEFAULT_LANG = 'en'
|
||||
LANG_DIR = 'intl'
|
||||
## mail adress for translation bugs
|
||||
MAIL_ADDRESS = 'info@cryptobox.org'
|
||||
## the complete list of languages wastes a lot of space - for now we use only a few
|
||||
#ALL_LANGUAGES = "af aka am ar bn ca cs da de el en es et eu fa fi fr fur gl he hi hr hu hy is it ja ka kg ko ku lt lv mr ms mt nb ne nl nn ns pa pl pt ru sl sr st sv tr uk ve vi xh".split(" ")
|
||||
ALL_LANGUAGES = "cs da de en es fi fr hu it ja nl pl pt ru sl sv ur".split(" ")
|
||||
|
||||
|
||||
# --------------=-=-=- functions -=-=-=--------------------
|
||||
|
||||
def process_language_file(hdf_file, po_dir, textDomain):
|
||||
## prepare hdf
|
||||
if not os.path.isfile(hdf_file) or not os.access(hdf_file, os.R_OK):
|
||||
sys.stderr.write("Unable to read the hdf file: %s" % hdf_file)
|
||||
return
|
||||
if not os.path.isdir(po_dir):
|
||||
os.mkdir(po_dir)
|
||||
pot_file = os.path.join(po_dir, "%s.pot" % textDomain)
|
||||
hdf = neo_util.HDF()
|
||||
hdf.readFile(hdf_file)
|
||||
## update pot
|
||||
if not os.path.isfile(pot_file):
|
||||
sys.stdout.write("Creating: %s\n" % pot_file)
|
||||
pot = translate.storage.po.pofile(encoding="utf-8")
|
||||
pot.makeheader(pot_creation_date=True)
|
||||
pot.updateheader(add=True, Project_Id_Version='CryptoBox-Server 0.3', pot_creation_date=True, language_team='sense.lab <devel@senselab.org>', Report_Msgid_Bugs_To=MAIL_ADDRESS, encoding='utf-8', Plural_Forms=['nplurals=2','plural=(n != 1)'])
|
||||
#TODO: somehow we need 'updateheaderplural'
|
||||
else:
|
||||
sys.stdout.write("Loading: %s\n" % pot_file)
|
||||
pot = translate.storage.po.pofile.parsefile(pot_file)
|
||||
## remove all msgids - we will add them later
|
||||
pot.units = []
|
||||
## add new entries
|
||||
def walk_hdf(prefix, node):
|
||||
def addPoItem(hdf_node):
|
||||
## ignore hdf values with a "LINK" attribute
|
||||
for (key,value) in hdf_node.attrs():
|
||||
if key == "LINK":
|
||||
return
|
||||
if not hdf_node.value():
|
||||
return
|
||||
item = pot.findunit(hdf_node.value())
|
||||
if not item:
|
||||
item = pot.addsourceunit(hdf_node.value())
|
||||
item.addlocation("%s%s" % (prefix, hdf_node.name()))
|
||||
while node:
|
||||
if node.name():
|
||||
new_prefix = prefix + node.name() + '.'
|
||||
else:
|
||||
new_prefix = prefix
|
||||
## as the attribute feature of clearsilver does not work yet, we
|
||||
## have to rely on magic names to prevent the translation of links
|
||||
if not (new_prefix.endswith(".Link.Rel.") \
|
||||
or new_prefix.endswith(".Link.Prot.") \
|
||||
or new_prefix.endswith(".Link.Abs.") \
|
||||
or new_prefix.endswith(".Link.Attr1.name.") \
|
||||
or new_prefix.endswith(".Link.Attr1.value.") \
|
||||
or new_prefix.endswith(".Link.Attr2.name.") \
|
||||
or new_prefix.endswith(".Link.Attr2.value.")):
|
||||
addPoItem(node)
|
||||
walk_hdf(new_prefix, node.child())
|
||||
node = node.next()
|
||||
walk_hdf("",hdf)
|
||||
pot.savefile(pot_file)
|
||||
p = translate.storage.po.pofile(pot_file)
|
||||
for ld in ALL_LANGUAGES:
|
||||
if not os.path.isdir(os.path.join(po_dir,ld)): os.mkdir(os.path.join(po_dir, ld))
|
||||
po_file = os.path.join(po_dir, ld, "%s.po" % textDomain)
|
||||
if not os.path.isfile(po_file):
|
||||
translate.convert.pot2po.convertpot(file(pot_file), file(po_file,'w'), None)
|
||||
else:
|
||||
po2_file = po_file + '.new'
|
||||
translate.convert.pot2po.convertpot(file(pot_file), file(po2_file,'w'), file(po_file))
|
||||
os.rename(po2_file, po_file)
|
||||
if ld == DEFAULT_LANG:
|
||||
## set every msgstr to the respective msgid
|
||||
po_data = translate.storage.po.pofile.parsefile(po_file)
|
||||
for po_unit in po_data.units:
|
||||
po_unit.settarget(po_unit.getsource())
|
||||
po_data.savefile(po_file)
|
||||
else:
|
||||
po_content = translate.storage.po.pofile.parsefile(po_file)
|
||||
po_content.removeduplicates()
|
||||
po_content.removeblanks()
|
||||
po_content.savefile(po_file)
|
||||
## make it writeable for pootle
|
||||
os.chmod(po_file, 0666)
|
||||
## compile po file
|
||||
mo_file = po_file[:-3] + '.mo'
|
||||
translate.tools.pocompile.convertmo(file(po_file), file(mo_file,'w'), file(pot_file))
|
||||
|
||||
|
||||
|
||||
|
||||
# ----------------=-=-=- main -=-=-=-----------------------
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
## the project directory is the parent of the directory of this script
|
||||
PROJECT_DIR = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]),os.path.pardir))
|
||||
|
||||
process_language_file(os.path.join(PROJECT_DIR,'templates',LANGUAGE_FILE), os.path.join(PROJECT_DIR,LANG_DIR), GETTEXT_DOMAIN)
|
||||
|
||||
for root,dirs,files in os.walk(os.path.join(PROJECT_DIR,'plugins')):
|
||||
if LANGUAGE_FILE in files:
|
||||
process_language_file(os.path.join(root,LANGUAGE_FILE), os.path.join(root,LANG_DIR), "%s-feature-%s" % (GETTEXT_DOMAIN,os.path.basename(root)))
|
||||
|
135
v0.3.4.1/scripts/userdocexport.sh
Executable file
135
v0.3.4.1/scripts/userdocexport.sh
Executable file
|
@ -0,0 +1,135 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 02005 sense.lab <senselab@systemausfall.org>
|
||||
#
|
||||
# License: This script is distributed under the terms of version 2
|
||||
# of the GNU GPL. See the LICENSE file included with the package.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# export wiki pages to the cryptobox development tree
|
||||
# this creates static and integrated pages
|
||||
#
|
||||
|
||||
set -ue
|
||||
|
||||
# root directory of the cryptobox development environment
|
||||
ROOT_DIR="$(dirname $0)/.."
|
||||
|
||||
# retrieve these pages from the wiki
|
||||
PAGES="CryptoBox CryptoBoxUser CryptoBoxUserGettingStarted
|
||||
CryptoBoxUserConfiguration CryptoBoxUserDailyUse CryptoBoxDev
|
||||
CryptoBoxDevPreparation CryptoBoxDevCustomBuild CryptoBoxDevWorkFlow
|
||||
CryptoBoxDevValidation CryptoBoxDevCustomConfigure CryptoBoxDevBackground
|
||||
CryptoBoxDevKnownProblems"
|
||||
#PAGES="CryptoBox"
|
||||
|
||||
# base URL
|
||||
WIKI_HOST="https://systemausfall.org"
|
||||
# the trailing slash is important
|
||||
WIKI_URL=/trac/cryptobox/wiki/
|
||||
|
||||
CBOX_CGI="/doc?page="
|
||||
|
||||
LANGUAGES="de en"
|
||||
|
||||
DEST_DIR="$ROOT_DIR/doc/html"
|
||||
OFFLINE_DIR="$ROOT_DIR/../live-cd/live-cd-tree.d/_offline/doc"
|
||||
IMAGE_DIR="$ROOT_DIR/cbox-tree.d/var/www/cryptobox-misc"
|
||||
TMP_DIR=/tmp/$(basename $0)-$$.d
|
||||
|
||||
HEADER_FILE=doc_header.inc
|
||||
FOOTER_FILE=doc_footer.inc
|
||||
|
||||
WGET_OPTS="--quiet --no-check-certificate"
|
||||
|
||||
[ ! -e "$DEST_DIR" ] && echo "$DEST_DIR does not exist" && exit 1
|
||||
|
||||
for LANG in $LANGUAGES; do
|
||||
for PAGE in $PAGES; do
|
||||
PAGE_SRC="$WIKI_HOST$WIKI_URL$PAGE/$LANG"
|
||||
echo "Importing $PAGE/$LANG:"
|
||||
|
||||
# replace sub-page-style '/' like moin does it (by '_2f')
|
||||
TMP_FILE=$TMP_DIR/${PAGE}.html
|
||||
mkdir -p "$TMP_DIR"
|
||||
|
||||
echo " downloading the page ..."
|
||||
wget $WGET_OPTS --output-document="$TMP_FILE" "$PAGE_SRC" || { echo "Downloading ($PAGE_SRC) failed!"; exit 1; }
|
||||
|
||||
# check if this page exists
|
||||
if grep -q "^describe $PAGE/$LANG here$" "$TMP_FILE"
|
||||
then rm "$TMP_FILE"
|
||||
PAGE_SRC=$(dirname $PAGE_SRC)
|
||||
echo " trying to download default language page instead"
|
||||
wget $WGET_OPTS --output-document="$TMP_FILE" "$PAGE_SRC" || { echo "Downloading ($PAGE_SRC) failed!" >&2; exit 1; }
|
||||
# check, if there is even no default page
|
||||
grep -q "^describe $PAGE/$LANG here$" "$TMP_FILE" && echo "This page ($PAGE_SRC) was not found!" >&2 && exit 1
|
||||
fi
|
||||
|
||||
echo " removing header and footer ..."
|
||||
# break lines before start of content
|
||||
sed -i 's#<div id="content" class="wiki">#_END_OF_HEADER_\n#' "$TMP_FILE"
|
||||
# the 'edit' buttons mark the end of the page
|
||||
sed -i 's#<div class="buttons">#\n_START_OF_FOOTER_#' "$TMP_FILE"
|
||||
# cut off a possible comment - section
|
||||
sed -i "s#<form action=[^>]*\#commentpreview#\n_START_OF_FOOTER_#" "$TMP_FILE"
|
||||
# remove all lines before and after "body"
|
||||
sed -i '1,/_END_OF_HEADER_/d; /_START_OF_FOOTER_/,$d' "$TMP_FILE"
|
||||
|
||||
# close open divs
|
||||
while [ "$(grep '<div' "$TMP_FILE" | wc -l)" -gt "$(grep '</div>' "$TMP_FILE" | wc -l)" ]
|
||||
do echo "</div>" >>"$TMP_FILE"
|
||||
done
|
||||
|
||||
#echo " removing link images (moin specific) ..."
|
||||
# remove inter-wiki images
|
||||
#sed -i 's#<[^<]*moin-inter.png[^>]*>##g' "$TMP_FILE"
|
||||
# remove moin-www images
|
||||
#sed -i 's#<[^<]*moin-www.png[^>]*> ##g' "$TMP_FILE"
|
||||
|
||||
# not necessary, because everything is a part of the repository
|
||||
#echo " downloading requisites ..."
|
||||
#wget --quiet --ignore-tags=a --no-clobber --page-requisites --convert-links --no-directories --base="$WIKI_HOST$WIKI_URL" --directory-prefix="$TMP_DIR" --html-extension --force-html --input-file="$TMP_FILE" || { echo "Downloading requisites for ($PAGE_SRC) failed!"; exit 1; }
|
||||
|
||||
echo " adjusting links for images ..."
|
||||
sed -i "s#='[^']*/cryptobox-misc/\([^']*\)'#='/cryptobox-misc/\1'#g" "$TMP_FILE"
|
||||
|
||||
echo " adjusting wiki links ..."
|
||||
# redirect wiki links to cryptobox cgi
|
||||
sed -i "s#=\"$WIKI_URL\([^\.]*\)\"#=\"$CBOX_CGI\1\"#g" "$TMP_FILE"
|
||||
# do it twice - somehow, the "g" flag does not work (it should replace multiple occurrences on a line)
|
||||
sed -i "s#=\"$WIKI_URL\([^\.]*\)\"#=\"$CBOX_CGI\1\"#g" "$TMP_FILE"
|
||||
# remove language specific part of moin link
|
||||
for TLANG in $LANGUAGES
|
||||
do sed -i "s#=\"$CBOX_CGI\([^\"]*\)/$TLANG#=\"$CBOX_CGI\1#g" "$TMP_FILE"
|
||||
done
|
||||
|
||||
|
||||
# build the static pages
|
||||
echo " building static doc page"
|
||||
offline_file=$OFFLINE_DIR/$LANG/$(basename $TMP_FILE)
|
||||
mkdir -p "$OFFLINE_DIR/$LANG"
|
||||
cat "$OFFLINE_DIR/$HEADER_FILE" "$OFFLINE_DIR/$LANG/$HEADER_FILE" "$TMP_FILE" "$OFFLINE_DIR/$LANG/$FOOTER_FILE" "$OFFLINE_DIR/$FOOTER_FILE" >"$offline_file"
|
||||
sed -i "s%=\"$CBOX_CGI\([^\"#]*\)%=\"\1.html%g" "$offline_file"
|
||||
# do it twice - this should not be necessary
|
||||
sed -i "s%=\"$CBOX_CGI\([^#\"]*\)%=\"\1.html%g" "$offline_file"
|
||||
sed -i "s#='/cryptobox-misc#='../../../var/www/cryptobox-misc#g" "$offline_file"
|
||||
|
||||
# split language specific part of moin link and replace it by current language
|
||||
for TLANG in $LANGUAGES
|
||||
do sed -i "s#=\"\([^/]*\)/${TLANG}.html\"#=\"\1.html\"#g" "$offline_file"
|
||||
done
|
||||
|
||||
# some last changes to the dynamic pages (must be done _after_ the static pages)
|
||||
# add weblang for current language to query string
|
||||
sed -i "s;=\"$CBOX_CGI\([^#\"]*\)\([#\"]\);=\"$CBOX_CGI\1\&weblang=$LANG\2;g" "$TMP_FILE"
|
||||
# move cgi-doc
|
||||
mv "$TMP_FILE" "$DEST_DIR/$LANG"
|
||||
|
||||
echo " finished!"
|
||||
done
|
||||
done
|
||||
|
||||
[ -n "$(find "$TMP_DIR" -type f)" ] && mv "$TMP_DIR"/* "$IMAGE_DIR"
|
||||
rmdir "$TMP_DIR"
|
Loading…
Add table
Add a link
Reference in a new issue