summaryrefslogtreecommitdiff
path: root/media
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-05-04 19:30:37 +0000
committerrubidium <rubidium@openttd.org>2013-05-04 19:30:37 +0000
commit8d10337bf0d61049ee0f3b0a7f4d87153b18db96 (patch)
tree4027c5a401832805f9fd8ea0bfb05ab3e34d5d1a /media
parentff3baa1914b1543cc9b8a3b41e4d846c8c2b8080 (diff)
downloadopenttd-8d10337bf0d61049ee0f3b0a7f4d87153b18db96.tar.xz
(svn r25218) -Fix: the baseset description translation script did not work with any awk other than gawk
Diffstat (limited to 'media')
-rw-r--r--media/baseset/translations.awk27
1 files changed, 24 insertions, 3 deletions
diff --git a/media/baseset/translations.awk b/media/baseset/translations.awk
index 3269d40b7..f15cb43ff 100644
--- a/media/baseset/translations.awk
+++ b/media/baseset/translations.awk
@@ -18,6 +18,26 @@
# <ini-key>.<iso-code> = <translation>
#
+# Simple insertion sort since not all AWKs have a sort implementation
+function isort(A) {
+ n = 0
+ for (val in A) {
+ n++;
+ }
+
+ for (i = 2; i <= n; i++) {
+ j = i;
+ hold = A[j]
+ while (A[j - 1] > hold) {
+ j--;
+ A[j + 1] = A[j]
+ }
+ A[j] = hold
+ }
+
+ return n
+}
+
/^!!/ {
ini_key = $2;
str_id = $3;
@@ -28,16 +48,17 @@
lang = $2;
} else if (match($0, "^" str_id " *:") > 0) {
sub("^[^:]*:", "", $0)
+ i++;
if (lang == "en_GB") {
- texts[""] = ini_key " = "$0;
+ texts[i] = ini_key " = "$0;
} else {
- texts[lang] = ini_key "." lang " = "$0;
+ texts[i] = ini_key "." lang " = "$0;
}
}
}
close(file);
- count = asort(texts);
+ count = isort(texts);
for (i = 1; i <= count; i++) {
print texts[i]
}