aboutsummaryrefslogtreecommitdiff
path: root/contrib/extract.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/extract.sh')
-rwxr-xr-xcontrib/extract.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/extract.sh b/contrib/extract.sh
new file mode 100755
index 0000000..e879e74
--- /dev/null
+++ b/contrib/extract.sh
@@ -0,0 +1,23 @@
1#!/bin/sh
2# This file is in the public domain.
3# It extracts translateable strings from the JSON file(s).
4#
5# The resulting 'extracted.h' file is only used by
6# gettext, and not in the actual code. We still make
7# sure it is legal C code.
8
9for n in redux.??.json
10do
11 jq '.required_attributes[].label' < $n | awk '{print "_(" $0 "),"}' >> prep.h
12done
13
14jq '.countries[].continent' < redux.countries.json | awk '{print "_(" $0 "),"}' >> prep.h
15
16jq '.countries[].name' < redux.countries.json | awk '{print "_(" $0 "),"}' >> prep.h
17
18echo "// This is a generated file, see extract.sh" > extracted.h
19echo "const char * i18n[] = {" >> extracted.h
20sort prep.h | uniq >> extracted.h
21echo "};" >> extracted.h
22
23rm -f prep.h