|
@@ -0,0 +1,80 @@
|
|
1
|
+#!/bin/bash
|
|
2
|
+#
|
|
3
|
+# .---. . .
|
|
4
|
+# | | |
|
|
5
|
+# |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
|
|
6
|
+# | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
|
|
7
|
+# ' ' --' --' -' - -' ' ' -' -' -' ' - --'
|
|
8
|
+#
|
|
9
|
+# Freedom in the Cloud
|
|
10
|
+#
|
|
11
|
+# A script for creating self-signed certificates on Debian
|
|
12
|
+
|
|
13
|
+# License
|
|
14
|
+# =======
|
|
15
|
+#
|
|
16
|
+# Copyright (C) 2015 Bob Mottram <bob@robotics.uk.to>
|
|
17
|
+#
|
|
18
|
+# This program is free software: you can redistribute it and/or modify
|
|
19
|
+# it under the terms of the GNU General Public License as published by
|
|
20
|
+# the Free Software Foundation, either version 3 of the License, or
|
|
21
|
+# (at your option) any later version.
|
|
22
|
+#
|
|
23
|
+# This program is distributed in the hope that it will be useful,
|
|
24
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
25
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
26
|
+# GNU General Public License for more details.
|
|
27
|
+#
|
|
28
|
+# You should have received a copy of the GNU General Public License
|
|
29
|
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
30
|
+
|
|
31
|
+PROJECT_NAME='freedombone'
|
|
32
|
+
|
|
33
|
+# languages to translate into
|
|
34
|
+language=( fr de )
|
|
35
|
+
|
|
36
|
+COMMAND_FILES=src/${PROJECT_NAME}*
|
|
37
|
+
|
|
38
|
+function create_translation_files {
|
|
39
|
+ for f in $COMMAND_FILES
|
|
40
|
+ do
|
|
41
|
+ COMMAND_NAME=$(echo $f | awk -F '/' '{print $2}')
|
|
42
|
+ bash --dump-po-strings src/${COMMAND_NAME} | xgettext -L PO -o /tmp/${PROJECT_NAME}_${COMMAND_NAME}.pot -
|
|
43
|
+ for lang in "${language[@]}"
|
|
44
|
+ do
|
|
45
|
+ if [ ! -d locale/${lang} ]; then
|
|
46
|
+ mkdir -p locale/${lang}
|
|
47
|
+ fi
|
|
48
|
+ if [ ! -f locale/${lang}/${COMMAND_NAME}.po ]; then
|
|
49
|
+ echo "Creating ${lang} Translation file for ${COMMAND_NAME}..."
|
|
50
|
+ msginit -l ${lang} -i /tmp/${PROJECT_NAME}_${COMMAND_NAME}.pot -o locale/${lang}/${COMMAND_NAME}.po
|
|
51
|
+ fi
|
|
52
|
+ done
|
|
53
|
+ rm /tmp/${PROJECT_NAME}_${COMMAND_NAME}.pot
|
|
54
|
+ done
|
|
55
|
+}
|
|
56
|
+
|
|
57
|
+function install_translations {
|
|
58
|
+ for f in $COMMAND_FILES
|
|
59
|
+ do
|
|
60
|
+ COMMAND_NAME=$(echo $f | awk -F '/' '{print $2}')
|
|
61
|
+ for lang in "${language[@]}"
|
|
62
|
+ do
|
|
63
|
+ if [ ! -f locale/${lang}/${COMMAND_NAME}.mo ]; then
|
|
64
|
+ cp locale/${lang}/${COMMAND_NAME}.mo /usr/share/locale/${lang}/${COMMAND_NAME}.mo
|
|
65
|
+ fi
|
|
66
|
+ done
|
|
67
|
+ done
|
|
68
|
+}
|
|
69
|
+
|
|
70
|
+if [[ $1 == "make" ]]; then
|
|
71
|
+ create_translation_files
|
|
72
|
+ exit 0
|
|
73
|
+fi
|
|
74
|
+
|
|
75
|
+if [[ $1 == "install" ]]; then
|
|
76
|
+ install_translations
|
|
77
|
+ exit 0
|
|
78
|
+fi
|
|
79
|
+
|
|
80
|
+exit 1
|