Extra strings: Add no-translate tag

This commit is contained in:
Jonathan G Rennison
2023-07-30 19:27:29 +01:00
parent ebcf8b336c
commit eb03369a21
3 changed files with 18 additions and 10 deletions

View File

@@ -770,6 +770,7 @@ void StringReader::HandleString(char *str)
/* Allocate a new LangString */
std::unique_ptr<LangString> ls(new LangString(str, s, this->data.next_string_id, _cur_line));
if (this->data.no_translate_mode) ls->no_translate_mode = true;
this->data.next_string_id = -1;
this->data.Add(str, ls.get());
@@ -796,6 +797,11 @@ void StringReader::HandleString(char *str)
return;
}
if (ent->no_translate_mode && _translation) {
strgen_error("String name '%s' is marked as no-translate", str);
return;
}
if (ent->translated && casep == nullptr) {
if (this->data.override_mode) {
free(ent->translated);
@@ -1024,7 +1030,7 @@ void LanguageWriter::WriteLang(const StringData &data)
for (uint j = 0; j != in_use[tab]; j++) {
const LangString *ls = data.strings[(tab * TAB_SIZE) + j];
if (ls != nullptr && ls->translated == nullptr && ls->default_translation == nullptr) {
if (ls != nullptr && ls->translated == nullptr && ls->default_translation == nullptr && !ls->no_translate_mode) {
_lang.missing++;
}
}