Mercurial > hg > openttd
changeset 17997:807e4762a716 draft
(svn r22806) -Codechange: store the number of untranslated strings in the language file
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sun, 21 Aug 2011 19:21:38 +0000 |
parents | 85a9e67896da |
children | 28dfccce7aae |
files | src/language.h src/strgen/strgen.cpp src/strings.cpp |
diffstat | 3 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/language.h +++ b/src/language.h @@ -38,6 +38,7 @@ 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 @@ 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
--- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -1061,10 +1061,16 @@ 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);
--- a/src/strings.cpp +++ b/src/strings.cpp @@ -1657,7 +1657,10 @@ 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; }