summaryrefslogtreecommitdiff
path: root/media/baseset/translations.awk
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2019-04-07 11:51:19 +0200
committerglx22 <glx22@users.noreply.github.com>2020-06-05 19:36:05 +0200
commit85315e2e3132dd7aff9ee96c1ba8d282350d9d5e (patch)
tree9c582e49a1d054e10e5d1b6e21e27d6c3ff747e7 /media/baseset/translations.awk
parent203a77c1dc722df677302e84c6d5c0d4cb06d8ee (diff)
downloadopenttd-85315e2e3132dd7aff9ee96c1ba8d282350d9d5e.tar.xz
Codechange: rework how grf and ob[msg] are generated
For grfs, it now uses CMake scripts to do its job, and both grf files are split into their own folder to make more clear what is going on. Additionally, it no longer builds in-source (although the resulting grf is copied back in the source folder). For ob[msg] it now uses CMake scripts to generate the translation files; the result is no longer stored in-source (but in the build folder). Although all files are available to create the GRFs and basesets, it won't really work till CMake is introduced (which will happen in a few commits from here)
Diffstat (limited to 'media/baseset/translations.awk')
-rw-r--r--media/baseset/translations.awk67
1 files changed, 0 insertions, 67 deletions
diff --git a/media/baseset/translations.awk b/media/baseset/translations.awk
deleted file mode 100644
index af5f2b4a8..000000000
--- a/media/baseset/translations.awk
+++ /dev/null
@@ -1,67 +0,0 @@
-# This file is part of OpenTTD.
-# OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
-# OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
-
-#
-# Awk script to extract translations for baseset descriptions
-# from lang files for insertion into .obg/obs/obm files.
-# If there is no translation, there is no output.
-#
-# The input file is scanned for the pattern
-# !! <ini-key> <STR_id>
-#
-# The lang files (passed as variable 'langfiles') are scanned for <STR_id> and
-# the translations are added to the output file:
-# <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;
-
- file = langfiles
- while ((getline < file) > 0) {
- if (match($0, "##isocode") > 0) {
- lang = $2;
- } else if (match($0, "^" str_id " *:") > 0) {
- sub("^[^:]*:", "", $0)
- i++;
- if (lang == "en_GB") {
- texts[i] = ini_key " = "$0;
- } else {
- texts[i] = ini_key "." lang " = "$0;
- }
- }
- }
- close(file);
-
- count = isort(texts);
- for (i = 1; i <= count; i++) {
- print texts[i]
- }
-
- next
-}
-
-{ print }