Browse Source

Avoid annoying email message when creating translations

Bob Mottram 9 years ago
parent
commit
70d115a2dd

+ 2
- 0
Makefile View File

@@ -7,6 +7,8 @@ all:
7 7
 	bash -c "./translate make"
8 8
 debug:
9 9
 	bash -c "./translate make"
10
+translations:
11
+	bash -c "./translate translations"
10 12
 source:
11 13
 	tar -cvf ../${APP}_${VERSION}.orig.tar ../${APP}-${VERSION} --exclude-vcs
12 14
 	gzip -f9n ../${APP}_${VERSION}.orig.tar

+ 8
- 0
locale/de/freedombone-controlpanel.json View File

@@ -93,6 +93,14 @@
93 93
     "Change the name of this system": "",
94 94
     "New local network name": "",
95 95
     "The name of this system on your local network was changed successfully": "",
96
+    "Set the TLS date/time source": "",
97
+    "Enter a domain name to use as a TLS time source.\\n\\nFactors to consider when choosing a source are whether you wish that site to know that your system is 'alive' and also what might happen if an adversary were to try to mess with the date/time from that domain (i.e. how much blowback would there be).": "",
98
+    "Don't include the 'https'": "",
99
+    "That doesn't look like a domain name": "",
100
+    "Set a static local IP address": "",
101
+    "In order to forward incoming internet traffic to this system most internet routers need to know a static local IP address to send the data to.\\n\\n\nEnter a static local IP address for this system.\\n\\nIt will typically be 192.168.1.x": "",
102
+    "Set the IP address of your internet router/modem": "",
103
+    "Set the local IP address for your internet router or ADSL modem.\\n\\nIt will typically be 192.168.1.1, 192.168.1.254, or similar": "",
96 104
     "Backup and Restore": "",
97 105
     "Choose an operation:": "",
98 106
     "Backup data to USB drive": "",

+ 1
- 1
locale/de/freedombone-image.json View File

@@ -2,7 +2,7 @@
2 2
     "Config file $CONFIG_FILENAME not found": "",
3 3
     "Your password chould contain at least ${MINIMUM_PASSWORD_LENGTH} characters": "",
4 4
     "\nImage was created.\n\nYou will be able to log into it with:\n": "",
5
-    "    ssh $USERNAME@$DEFAULT_DOMAIN_NAME -p 2222\n\n    Password: $PASSWORD\n": "",
5
+    "    ssh $USERNAME@$DEFAULT_DOMAIN_NAME -p $SSH_PORT\n\n    Password: $PASSWORD\n": "",
6 6
     "    Username: $USERNAME\n    Password: $PASSWORD\n": "",
7 7
     "\n    Username: $USERNAME\n    Password: $PASSWORD\n": "",
8 8
     "Username: $USERNAME\nPassword: $PASSWORD": ""

+ 2
- 0
locale/de/freedombone-sec.json View File

@@ -20,6 +20,8 @@
20 20
     "An existing certificate for $renew_domain was not found": "",
21 21
     "Invalid domain name: $renew_domain": "",
22 22
     "Renew a Let's Encrypt certificate": "",
23
+    "Create a new Let's Encrypt certificate": "",
24
+    "Invalid domain name: $new_domain": "",
23 25
     "Import file $IMPORT_FILE not found": "",
24 26
     "Security settings exported to $EXPORT_FILE": ""
25 27
 }

+ 8
- 0
locale/es/freedombone-controlpanel.json View File

@@ -93,6 +93,14 @@
93 93
     "Change the name of this system": "",
94 94
     "New local network name": "",
95 95
     "The name of this system on your local network was changed successfully": "",
96
+    "Set the TLS date/time source": "",
97
+    "Enter a domain name to use as a TLS time source.\\n\\nFactors to consider when choosing a source are whether you wish that site to know that your system is 'alive' and also what might happen if an adversary were to try to mess with the date/time from that domain (i.e. how much blowback would there be).": "",
98
+    "Don't include the 'https'": "",
99
+    "That doesn't look like a domain name": "",
100
+    "Set a static local IP address": "",
101
+    "In order to forward incoming internet traffic to this system most internet routers need to know a static local IP address to send the data to.\\n\\n\nEnter a static local IP address for this system.\\n\\nIt will typically be 192.168.1.x": "",
102
+    "Set the IP address of your internet router/modem": "",
103
+    "Set the local IP address for your internet router or ADSL modem.\\n\\nIt will typically be 192.168.1.1, 192.168.1.254, or similar": "",
96 104
     "Backup and Restore": "",
97 105
     "Choose an operation:": "",
98 106
     "Backup data to USB drive": "",

+ 1
- 1
locale/es/freedombone-image.json View File

@@ -2,7 +2,7 @@
2 2
     "Config file $CONFIG_FILENAME not found": "",
3 3
     "Your password chould contain at least ${MINIMUM_PASSWORD_LENGTH} characters": "",
4 4
     "\nImage was created.\n\nYou will be able to log into it with:\n": "",
5
-    "    ssh $USERNAME@$DEFAULT_DOMAIN_NAME -p 2222\n\n    Password: $PASSWORD\n": "",
5
+    "    ssh $USERNAME@$DEFAULT_DOMAIN_NAME -p $SSH_PORT\n\n    Password: $PASSWORD\n": "",
6 6
     "    Username: $USERNAME\n    Password: $PASSWORD\n": "",
7 7
     "\n    Username: $USERNAME\n    Password: $PASSWORD\n": "",
8 8
     "Username: $USERNAME\nPassword: $PASSWORD": ""

+ 2
- 0
locale/es/freedombone-sec.json View File

@@ -20,6 +20,8 @@
20 20
     "An existing certificate for $renew_domain was not found": "",
21 21
     "Invalid domain name: $renew_domain": "",
22 22
     "Renew a Let's Encrypt certificate": "",
23
+    "Create a new Let's Encrypt certificate": "",
24
+    "Invalid domain name: $new_domain": "",
23 25
     "Import file $IMPORT_FILE not found": "",
24 26
     "Security settings exported to $EXPORT_FILE": ""
25 27
 }

+ 8
- 0
locale/fr/freedombone-controlpanel.json View File

@@ -93,6 +93,14 @@
93 93
     "Change the name of this system": "",
94 94
     "New local network name": "",
95 95
     "The name of this system on your local network was changed successfully": "",
96
+    "Set the TLS date/time source": "",
97
+    "Enter a domain name to use as a TLS time source.\\n\\nFactors to consider when choosing a source are whether you wish that site to know that your system is 'alive' and also what might happen if an adversary were to try to mess with the date/time from that domain (i.e. how much blowback would there be).": "",
98
+    "Don't include the 'https'": "",
99
+    "That doesn't look like a domain name": "",
100
+    "Set a static local IP address": "",
101
+    "In order to forward incoming internet traffic to this system most internet routers need to know a static local IP address to send the data to.\\n\\n\nEnter a static local IP address for this system.\\n\\nIt will typically be 192.168.1.x": "",
102
+    "Set the IP address of your internet router/modem": "",
103
+    "Set the local IP address for your internet router or ADSL modem.\\n\\nIt will typically be 192.168.1.1, 192.168.1.254, or similar": "",
96 104
     "Backup and Restore": "",
97 105
     "Choose an operation:": "",
98 106
     "Backup data to USB drive": "",

+ 1
- 1
locale/fr/freedombone-image.json View File

@@ -2,7 +2,7 @@
2 2
     "Config file $CONFIG_FILENAME not found": "",
3 3
     "Your password chould contain at least ${MINIMUM_PASSWORD_LENGTH} characters": "",
4 4
     "\nImage was created.\n\nYou will be able to log into it with:\n": "",
5
-    "    ssh $USERNAME@$DEFAULT_DOMAIN_NAME -p 2222\n\n    Password: $PASSWORD\n": "",
5
+    "    ssh $USERNAME@$DEFAULT_DOMAIN_NAME -p $SSH_PORT\n\n    Password: $PASSWORD\n": "",
6 6
     "    Username: $USERNAME\n    Password: $PASSWORD\n": "",
7 7
     "\n    Username: $USERNAME\n    Password: $PASSWORD\n": "",
8 8
     "Username: $USERNAME\nPassword: $PASSWORD": ""

+ 2
- 0
locale/fr/freedombone-sec.json View File

@@ -20,6 +20,8 @@
20 20
     "An existing certificate for $renew_domain was not found": "",
21 21
     "Invalid domain name: $renew_domain": "",
22 22
     "Renew a Let's Encrypt certificate": "",
23
+    "Create a new Let's Encrypt certificate": "",
24
+    "Invalid domain name: $new_domain": "",
23 25
     "Import file $IMPORT_FILE not found": "",
24 26
     "Security settings exported to $EXPORT_FILE": ""
25 27
 }

+ 14
- 6
translate View File

@@ -33,6 +33,8 @@ PROJECT_NAME='freedombone'
33 33
 # languages to translate into
34 34
 language=( fr de es )
35 35
 
36
+MY_EMAIL_ADDRESS='bob@robotics.uk.to'
37
+
36 38
 COMMAND_FILES=src/${PROJECT_NAME}*
37 39
 
38 40
 function install_i18next-conv {
@@ -52,6 +54,7 @@ function install_i18next-conv {
52 54
 }
53 55
 
54 56
 function create_translation_files {
57
+	create_arg=$1
55 58
     if [ ! -d /tmp/${PROJECT_NAME} ]; then
56 59
         mkdir -p /tmp/${PROJECT_NAME}
57 60
     fi
@@ -59,7 +62,7 @@ function create_translation_files {
59 62
     for f in $COMMAND_FILES
60 63
     do
61 64
         COMMAND_NAME=$(echo $f | awk -F '/' '{print $2}')
62
-        bash --dump-po-strings src/${COMMAND_NAME} | xgettext -L PO -o /tmp/${PROJECT_NAME}/${COMMAND_NAME}.pot -
65
+        bash --dump-po-strings src/${COMMAND_NAME} | xgettext --msgid-bugs-address=$MY_EMAIL_ADDRESS -L PO -o /tmp/${PROJECT_NAME}/${COMMAND_NAME}.pot -
63 66
         if [ -f /tmp/${PROJECT_NAME}/${COMMAND_NAME}.pot ]; then
64 67
             for lang in "${language[@]}"
65 68
             do
@@ -67,17 +70,16 @@ function create_translation_files {
67 70
                     mkdir -p locale/${lang}
68 71
                 fi
69 72
 
70
-                if [ ! -f locale/${lang}/${COMMAND_NAME}.json ]; then
73
+                if [[ ! -f locale/${lang}/${COMMAND_NAME}.json || "$create_arg" == "overwrite" ]]; then
71 74
                     # create po file
72 75
                     echo "Creating ${lang} Translation file for ${COMMAND_NAME}..."
73
-                    msginit -l ${lang} -i /tmp/${PROJECT_NAME}/${COMMAND_NAME}.pot -o locale/${lang}/${COMMAND_NAME}.po
76
+                    msginit --no-translator -l ${lang} -i /tmp/${PROJECT_NAME}/${COMMAND_NAME}.pot -o locale/${lang}/${COMMAND_NAME}.po
77
+					echo 'testing'
74 78
 
75 79
                     # convert po to json
76 80
                     if [ -f /usr/bin/i18next-conv ]; then
77 81
                         if [ -f locale/${lang}/${COMMAND_NAME}.po ]; then
78
-                            if [ ! -f locale/${lang}/${COMMAND_NAME}.json ]; then
79
-                                i18next-conv -l ${lang} -s locale/${lang}/${COMMAND_NAME}.po -t locale/${lang}/${COMMAND_NAME}.json
80
-                            fi
82
+                            i18next-conv -l ${lang} -s locale/${lang}/${COMMAND_NAME}.po -t locale/${lang}/${COMMAND_NAME}.json
81 83
                         fi
82 84
                     fi
83 85
 
@@ -125,6 +127,12 @@ function uninstall_translations {
125 127
     done
126 128
 }
127 129
 
130
+if [[ $1 == "translation"* ]]; then
131
+    install_i18next-conv
132
+    create_translation_files overwrite
133
+    exit 0
134
+fi
135
+
128 136
 if [[ $1 == "make" ]]; then
129 137
     install_i18next-conv
130 138
     create_translation_files