Mercurial > trustbridge
annotate packaging/getxt-gen-l10n-array.sh @ 1031:1f23803e1f83
Fix linux build. Has_high_integrity is only implemented for windows.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 04 Sep 2014 11:59:01 +0200 |
parents | 6e300f749a6d |
children | 069f5e5344f6 |
rev | line source |
---|---|
795
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
1 # ------------------------------------------------------------------- |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
2 # Copyright (C) 2014 by Intevation GmbH |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
3 # Author(s): |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
4 # Sascha Wilde <wilde@intevation.de> |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
5 |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
6 # This program is free software under the GNU GPL (>=v2) |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
7 # Read the file COPYING coming with the software for details. |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
8 # ------------------------------------------------------------------- |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
9 |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
10 # Extract getxt strings from source and generate an array for usage in |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
11 # the script using our getxt function. |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
12 |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
13 # USAGE: getxt-gen-l10n-array.sh SRC ARRAYNAME ARRAYFILE |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
14 # |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
15 # Where SRC is the shell script using getxt and ARRAYFILE is |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
16 # the file to which the generated array is to be saved. |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
17 # |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
18 # ARRAYNAME is the name of the associative bash array to generate. |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
19 # |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
20 # If ARRAYFILE exists, values already defined will be preserved, |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
21 # if the MSGID still exists. |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
22 |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
23 # FIXME: we can't handle quoted quotes: "\"" -- don't use them for |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
24 # now... |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
25 |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
26 declare -a MSGIDS |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
27 declare -A L10N |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
28 |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
29 get_msgids() |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
30 { |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
31 while read -r id ; do |
821
6e300f749a6d
Ignore MSGID "$1", which is an artifact by the "fatal" function.
Sascha Wilde <wilde@intevation.de>
parents:
795
diff
changeset
|
32 if [ "$id" != '"$1"' ] ; then |
6e300f749a6d
Ignore MSGID "$1", which is an artifact by the "fatal" function.
Sascha Wilde <wilde@intevation.de>
parents:
795
diff
changeset
|
33 MSGIDS+=("$id") |
6e300f749a6d
Ignore MSGID "$1", which is an artifact by the "fatal" function.
Sascha Wilde <wilde@intevation.de>
parents:
795
diff
changeset
|
34 fi |
795
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
35 done < <( sed -n 's/.*\(getxt\|fatal\) [^"]*\("[^"]*"\).*/\2/p' "$1" | sort | uniq ) |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
36 } |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
37 |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
38 merge_l10n() |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
39 { |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
40 for msgid in "${MSGIDS[@]}" ; do |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
41 msg=`grep -F "[${msgid}]" "$1" | sed -n 's/.*="\(.*\)"/\1/p'` |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
42 if [ "$msg" ] ; then |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
43 L10N["$msgid"]="$msg" |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
44 fi |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
45 done |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
46 } |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
47 |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
48 write_l10n_array() |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
49 { |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
50 echo "$1=(" |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
51 for msgid in "${MSGIDS[@]}" ; do |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
52 echo " [${msgid}]=\"${L10N[$msgid]}\"" |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
53 done |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
54 echo ")" |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
55 } |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
56 |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
57 get_msgids "$1" |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
58 merge_l10n "$3" |
3a9b0c75f5a6
Added i18n code and german l10n to linux installer.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
59 write_l10n_array "$2" >"$3" |