(svn r14480) -Add: warning when trying to use a right-to-left language without support for it in OpenTTD.
This commit is contained in:
@@ -61,7 +61,8 @@ struct LanguagePack {
|
||||
char isocode[16]; // the ISO code for the language (not country code)
|
||||
uint16 offsets[32]; // the offsets
|
||||
byte plural_form; // how to compute plural forms
|
||||
byte pad[3]; // pad header to be a multiple of 4
|
||||
byte text_dir; // default direction of the text
|
||||
byte pad[2]; // pad header to be a multiple of 4
|
||||
char data[VARARRAY_SIZE]; // list of strings
|
||||
};
|
||||
|
||||
@@ -1273,6 +1274,7 @@ bool ReadLanguagePack(int lang_index)
|
||||
ttd_strlcpy(_dynlang.curr_file, c_file, lengthof(_dynlang.curr_file));
|
||||
|
||||
_dynlang.curr = lang_index;
|
||||
_dynlang.text_dir = (TextDirection)lang_pack->text_dir;
|
||||
SetCurrentGrfLangID(_langpack->isocode);
|
||||
SortNetworkLanguages();
|
||||
return true;
|
||||
@@ -1511,6 +1513,29 @@ void CheckForMissingGlyphsInLoadedLanguagePack()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(WITH_ICU)
|
||||
/*
|
||||
* For right-to-left languages we need the ICU library. If
|
||||
* we do not have support for that library we warn the user
|
||||
* about it with a message. As we do not want the string to
|
||||
* be translated by the translators, we 'force' it into the
|
||||
* binary and 'load' it via a BindCString. To do this
|
||||
* properly we have to set the color of the string,
|
||||
* otherwise we end up with a lot of artefacts. The color
|
||||
* 'character' might change in the future, so for safety
|
||||
* we just Utf8 Encode it into the string, which takes
|
||||
* exactly three characters, so it replaces the "XXX" with
|
||||
* the color marker.
|
||||
*/
|
||||
if (_dynlang.text_dir != TD_LTR) {
|
||||
static char *err_str = strdup("XXXThis version of OpenTTD does not support right-to-left languages. Recompile with icu enabled.");
|
||||
Utf8Encode(err_str, SCC_YELLOW);
|
||||
SetDParamStr(0, err_str);
|
||||
ShowErrorMessage(INVALID_STRING_ID, STR_JUST_RAW_STRING, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user