mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r22806) -Codechange: store the number of untranslated strings in the language file
This commit is contained in:
parent
f6b0561cd8
commit
525e2c9e73
|
@ -38,6 +38,7 @@ struct LanguagePackHeader {
|
||||||
char digit_group_separator_currency[8];
|
char digit_group_separator_currency[8];
|
||||||
/** Decimal separator */
|
/** Decimal separator */
|
||||||
char digit_decimal_separator[8];
|
char digit_decimal_separator[8];
|
||||||
|
uint16 missing; ///< number of missing strings.
|
||||||
byte plural_form; ///< plural form index
|
byte plural_form; ///< plural form index
|
||||||
byte text_dir; ///< default direction of the text
|
byte text_dir; ///< default direction of the text
|
||||||
/**
|
/**
|
||||||
|
@ -52,7 +53,7 @@ struct LanguagePackHeader {
|
||||||
uint8 newgrflangid; ///< newgrf language id
|
uint8 newgrflangid; ///< newgrf language id
|
||||||
uint8 num_genders; ///< the number of genders of this language
|
uint8 num_genders; ///< the number of genders of this language
|
||||||
uint8 num_cases; ///< the number of cases 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 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
|
char cases[MAX_NUM_CASES][CASE_GENDER_LEN]; ///< the cases used by this translation
|
||||||
|
|
|
@ -1061,10 +1061,16 @@ static void WriteLangfile(const char *filename)
|
||||||
|
|
||||||
in_use[i] = n;
|
in_use[i] = n;
|
||||||
_lang.offsets[i] = TO_LE16(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.ident = TO_LE32(LanguagePackHeader::IDENT);
|
||||||
_lang.version = TO_LE32(_hash);
|
_lang.version = TO_LE32(_hash);
|
||||||
|
_lang.missing = TO_LE16(_lang.missing);
|
||||||
_lang.winlangid = TO_LE16(_lang.winlangid);
|
_lang.winlangid = TO_LE16(_lang.winlangid);
|
||||||
|
|
||||||
fwrite(&_lang, sizeof(_lang), 1, _output_file);
|
fwrite(&_lang, sizeof(_lang), 1, _output_file);
|
||||||
|
|
|
@ -1657,7 +1657,10 @@ static bool GetLanguageFileHeader(const char *file, LanguagePackHeader *hdr)
|
||||||
bool ret = read == 1 && hdr->IsValid();
|
bool ret = read == 1 && hdr->IsValid();
|
||||||
|
|
||||||
/* Convert endianness for the windows language ID */
|
/* 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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue