summaryrefslogtreecommitdiffhomepage
path: root/build
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-06-25 23:09:56 +0200
committerThomas Voss <mail@thomasvoss.com> 2023-06-25 23:09:56 +0200
commitb99614b0e9b431414e8bc4e74142fb17d69b627a (patch)
tree313426b5d5a07a2b36e0077677254c78b1f728e0 /build
parentdedcab5598c465024f7cd0091474a708f4201437 (diff)
More translations
Diffstat (limited to 'build')
-rwxr-xr-xbuild45
1 files changed, 45 insertions, 0 deletions
diff --git a/build b/build
index d83c8ad..7b52aa1 100755
--- a/build
+++ b/build
@@ -98,6 +98,51 @@ compile_for_lang() {
| last-of-design.sed \
| xfsub '<!-- TABLE-BODY -->' - $nod/index.html
+ grep -Eo '^[A-Z]{2}' data/coins \
+ | uniq \
+ | gawk -v lang=$1 '
+ function bilingual_sort(i1, v1, i2, v2, f)
+ {
+ print v1 ":" v2 |& CMD
+ CMD |& getline f
+
+ return f == v1 ? -1 : +1
+ }
+
+ BEGIN {
+ while (getline < ("data/country-info." lang)) {
+ split($0, a, "\t")
+ map[a[1]] = a[3]
+ }
+ }
+
+ { countries[$0] = map[$0] }
+
+ END {
+ locale = lang == "pt" \
+ ? "pt_BR.UTF-8" \
+ : lang "_" toupper(lang) ".UTF-8"
+
+ CMD = "LC_ALL=" locale " ./bilingual_sort"
+ PROCINFO["sorted_in"] = "bilingual_sort"
+
+ print "<table class=country-table><tbody>"
+ for (code in countries) {
+ i++
+ if (i % 4 == 1)
+ printf "<tr>"
+ printf "<td><a href=%s>%s</a></td>", tolower(code),
+ countries[code]
+ if (i % 4 == 0)
+ print "</tr>"
+ }
+ print "</tbody></table>"
+
+ close(CMD)
+ }
+ ' \
+ | xfsub '<!-- COUNTRY-TABLE -->' - $od/euro/index.html
+
for CC in `grep -Eo '^[A-Z]{2}' data/coins | uniq`; do
cc=`echo $CC | tr A-Z a-z`
nod=$od/euro/$cc