diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/language.h | 3 | ||||
-rw-r--r-- | src/strgen/strgen.cpp | 6 | ||||
-rw-r--r-- | src/strings.cpp | 5 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/language.h b/src/language.h index 6ba731ebf..a6797ed2f 100644 --- a/src/language.h +++ b/src/language.h @@ -38,6 +38,7 @@ struct LanguagePackHeader { char digit_group_separator_currency[8]; /** Decimal separator */ char digit_decimal_separator[8]; + uint16 missing; ///< number of missing strings. byte plural_form; ///< plural form index byte text_dir; ///< default direction of the text /** @@ -52,7 +53,7 @@ struct LanguagePackHeader { uint8 newgrflangid; ///< newgrf language id uint8 num_genders; ///< the number of genders of this language uint8 num_cases; ///< the number of cases of this language - byte pad[1]; ///< pad header to be a multiple of 4 + byte pad[3]; ///< pad header to be a multiple of 4 char genders[MAX_NUM_GENDERS][CASE_GENDER_LEN]; ///< the genders used by this translation char cases[MAX_NUM_CASES][CASE_GENDER_LEN]; ///< the cases used by this translation diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index d3b86c4ec..9dd5b6fb6 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -1061,10 +1061,16 @@ static void WriteLangfile(const char *filename) in_use[i] = n; _lang.offsets[i] = TO_LE16(n); + + for (uint j = 0; j != in_use[i]; j++) { + const LangString *ls = _strings[(i << 11) + j]; + if (ls != NULL && ls->translated == NULL) _lang.missing++; + } } _lang.ident = TO_LE32(LanguagePackHeader::IDENT); _lang.version = TO_LE32(_hash); + _lang.missing = TO_LE16(_lang.missing); _lang.winlangid = TO_LE16(_lang.winlangid); fwrite(&_lang, sizeof(_lang), 1, _output_file); diff --git a/src/strings.cpp b/src/strings.cpp index 09f2243c7..cf2f60348 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -1657,7 +1657,10 @@ static bool GetLanguageFileHeader(const char *file, LanguagePackHeader *hdr) bool ret = read == 1 && hdr->IsValid(); /* Convert endianness for the windows language ID */ - if (ret) hdr->winlangid = FROM_LE16(hdr->winlangid); + if (ret) { + hdr->missing = FROM_LE16(hdr->missing); + hdr->winlangid = FROM_LE16(hdr->winlangid); + } return ret; } |