Makes tinygettext handle missing plural forms more sanely.
Print an error to the console and return the original (untranslated) string instead of triggering an assertion in debug builds or a crash and memory corruption in release builds. Works around a crash on the history screen. Why the plural form is missing is another topic and will have to be solved separately. This was SVN commit r15493.
This commit is contained in:
parent
5571f7a7f9
commit
de6823d23f
@ -69,8 +69,12 @@ Dictionary::translate_plural(const Entries& dict, const std::string& msgid, cons
|
||||
{
|
||||
unsigned int n = 0;
|
||||
n = plural_forms.get_plural(count);
|
||||
assert(/*n >= 0 &&*/ n < msgstrs.size());
|
||||
|
||||
if(n >= msgstrs.size())
|
||||
{
|
||||
log_error << "Plural translation not available (and not set to empty): '" << msgid << "'" << std::endl;
|
||||
log_error << "Missing plural form: " << n << std::endl;
|
||||
return msgid;
|
||||
}
|
||||
if (!msgstrs[n].empty())
|
||||
return msgstrs[n];
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user