multilinugual infrastructure for documentation added

This commit is contained in:
lars 2005-09-06 18:16:07 +00:00
parent 9c3dce9321
commit 36c46b8ece
12 changed files with 18 additions and 5 deletions

View file

@ -1,5 +1,5 @@
<div id="doc">
<?cs include:DocDir + '/' + Data.Doc.Page + '.html' ?>
<?cs include:DocDir + '/' + DocLang + '/' + Data.Doc.Page + '.html' ?>
</div>

View file

@ -21,6 +21,7 @@ my $config = ConfigFile::read_config_file('/etc/cryptobox/cryptobox.conf');
$CB_SCRIPT = $config->{CB_SCRIPT};
$LOG_FILE = $config->{LOG_FILE};
$LANGUAGE_DIR = $config->{LANGUAGE_DIR};
# language setting may be later overriden by "weblang"
$LANGUAGE = $config->{LANGUAGE};
$TEMPLATE_DIR = $config->{TEMPLATE_DIR};
$DOC_DIR = $config->{DOC_DIR};
@ -246,13 +247,21 @@ $pagedata = load_hdf();
if ($query->param('weblang')) {
my $weblang = $query->param('weblang');
if (&validate_language($weblang)) {
&log_msg("lang: $weblang");
# load the data
&load_language_data($pagedata, "$weblang");
&log_msg("loaded: $weblang");
# add the setting to every link
$pagedata->setValue('Data.PostData.weblang', "$weblang");
&log_msg("set: $weblang");
# select documentation
if (-e "$DOC_DIR/$weblang") {
# selected web interface language
$pagedata->setValue('Data.DocLang', "$weblang");
} elseif (-e "$DOC_DIR/$LANGUAGE") {
# default CryptoBox language
$pagedata->setValue('Data.DocLang', "$LANGUAGE");
} else {
# default hardcoded language (english)
$pagedata->setValue('Data.DocLang', "en");
}
} else {
$pagedata->setValue('Data.Warning', 'InvalidLanguage');
}

View file

@ -1,4 +1,8 @@
#!/bin/sh
#
# TODO: only for english - change this!
#
set -u
# root directory of the cryptobox development environment
@ -14,7 +18,7 @@ WIKI_URL=/toolforge/
CBOX_CGI="/cryptobox?action=doc\&page="
DEST_DIR="$ROOT_DIR/cbox-tree.d/usr/share/doc/cryptobox/html"
DEST_DIR="$ROOT_DIR/cbox-tree.d/usr/share/doc/cryptobox/html/en"
IMAGE_DIR="$ROOT_DIR/cbox-tree.d/var/www/cryptobox-img"
TMP_DIR=/tmp/$(basename $0)-$$.d