strgen: Split non-upstream translated strings into separate file

This commit is contained in:
Jonathan G Rennison
2023-02-16 00:35:44 +00:00
parent 2afd2967f2
commit 2829a6fdf7
130 changed files with 11981 additions and 9824 deletions

View File

@@ -629,7 +629,12 @@ int CDECL main(int argc, char *argv[])
const char *translation = replace_pathsep(mgo.argv[i]);
const char *file = strrchr(translation, PATHSEPCHAR);
FileStringReader translation_reader(data, translation, false, file == nullptr || strcmp(file + 1, "english.txt") != 0);
const char *translation2 = nullptr;
if (file != nullptr) {
mkpath2(pathbuf2, lastof(pathbuf2), src_dir, "extra", file + 1);
translation2 = pathbuf2;
}
FileStringReader translation_reader(data, translation, translation2, false, file == nullptr || strcmp(file + 1, "english.txt") != 0);
translation_reader.ParseFile(); // target file
if (_errors != 0) return 1;

View File

@@ -796,8 +796,13 @@ void StringReader::HandleString(char *str)
}
if (ent->translated && casep == nullptr) {
strgen_error("String name '%s' is used multiple times", str);
return;
if (this->data.override_mode) {
free(ent->translated);
ent->translated = nullptr;
} else {
strgen_error("String name '%s' is used multiple times", str);
return;
}
}
/* make sure that the commands match */