-
Notifications
You must be signed in to change notification settings - Fork 1
/
babel.sh
executable file
·63 lines (58 loc) · 2.21 KB
/
babel.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/bash
# Copyright (C) 2012-2014 Mag. Christian Tanzer All rights reserved
# Glasauergasse 32, A--1130 Wien, Austria. [email protected]
# ****************************************************************************
# This script is part of the CNDB package.
#
# This module is licensed under the terms of the BSD 3-Clause License
# <http://www.c-tanzer.at/license/bsd_3c.html>.
# ****************************************************************************
#
#++
# Name
# babel.sh
#
# Purpose
# Extract and compile translations from Python modules and Jinja templates
#
# Revision Dates
# 27-Mar-2012 (CT) Creation
# 11-May-2012 (CT) Factor `compile` to python library's babel.sh
# ««revision-date»»···
#--
cmd=${1:?"Specify a command: extract | language | compile"}; shift
default_langs="en,de"
default_dirs="_CNDB _CNDB/_OMP _CNDB/_GTW _CNDB/_JNJ ."
lib=$(dirname $(python -c 'from _TFL import sos; print (sos.path.dirname (sos.__file__))'))
export PYTHONPATH=./:$PYTHONPATH
case "$cmd" in
"extract" )
dirs=${1:-${default_dirs}}; shift
( cd ${lib}; ./babel.sh extract )
python ${lib}/_TFL/Babel.py extract \
-bugs_address "[email protected],[email protected]" \
-charset utf-8 \
-copyright_holder "Mag. Christian Tanzer, Ralf Schlatterbeck" \
-global_config ${lib}/_MOM/base_babel.cfg \
-project "CNDB" \
-sort \
$dirs
;;
"language" )
langs=${1:-${default_langs}}; shift
dirs=${1:-${default_dirs}}; shift
( cd ${lib}; ./babel.sh language "${langs}" )
python ${lib}/_TFL/Babel.py language -languages "${langs}" -sort $dirs
;;
"compile" )
langs=${1:-${default_langs}}; shift
${lib}/babel.sh compile ./Command.py "${langs}"
;;
* )
echo "Unknown command $cmd; use one of"
echo " extract"
echo " language"
echo " compile"
;;
esac
### __END__ babel.sh