i18n: Skip and warn about textdomain names with a slash (bug #23839)
boost::locale::generator::add_messages_domain() interprets the slash specially, interpreting everything after it as an encoding name. It's not clear to me why providing a textdomain with an erroneous name like this causes Boost.Locale to throw a boost::locale::conv exception (invalid_charset_error, apparently) when handling t_strings bound to completely different textdomain, but if we can avoid the issue altogether then that's good enough. Made the legacy implementation skip and warn about these names too even if bindtextdomain(3) says nothing about slashes having a meaning.
This commit is contained in:
parent
1bd91e75f5
commit
85cf364ea0
4 changed files with 24 additions and 0 deletions
|
@ -21,6 +21,8 @@ Version 1.13.1+dev:
|
|||
* New generic portraits for the Troll and Troll Whelp
|
||||
* Language and i18n:
|
||||
* Updated translations: French, Galician, Japanese, Latvian
|
||||
* Fixed crashes during start-up on Windows resulting from add-ons containing
|
||||
erroneous textdomain declarations (bug #23839).
|
||||
* Lua API:
|
||||
* Added support for unit.level field (read only)
|
||||
* Added wesnoth.set_dialog_focus function
|
||||
|
|
|
@ -16,6 +16,8 @@ Version 1.13.1+dev:
|
|||
|
||||
* Language and i18n:
|
||||
* Updated translations: French, Galician, Japanese, Latvian.
|
||||
* Fixed crashes during start-up on Windows resulting from add-ons containing
|
||||
erroneous textdomain declarations (bug #23839).
|
||||
|
||||
* Music and sound effects:
|
||||
* New dwarf hit and die sounds.
|
||||
|
|
|
@ -104,6 +104,14 @@ std::string dsngettext (const char * domainname, const char *singular, const cha
|
|||
|
||||
void bind_textdomain(const char* domain, const char* directory, const char* encoding)
|
||||
{
|
||||
if(domain != NULL && strchr(domain, '/') != NULL) {
|
||||
// For compatibility with Boost.Locale implementation, which interprets
|
||||
// slashes in domain names in a special fashion.
|
||||
ERR_G << "illegal textdomain name '" << domain
|
||||
<< "', skipping textdomain\n";
|
||||
return;
|
||||
}
|
||||
|
||||
if(directory != NULL)
|
||||
bindtextdomain(domain, directory);
|
||||
if(encoding != NULL)
|
||||
|
|
|
@ -96,6 +96,18 @@ namespace
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(domain.find('/') != std::string::npos)
|
||||
{
|
||||
// Forward slash has a specific meaning in Boost.Locale domain
|
||||
// names, specifying the encoding. We use UTF-8 for everything
|
||||
// so we can't possibly support that, and odds are it's a user
|
||||
// mistake (as in bug #23839).
|
||||
ERR_G << "illegal textdomain name '" << domain
|
||||
<< "', skipping textdomain\n";
|
||||
return;
|
||||
}
|
||||
|
||||
generator_.add_messages_domain(domain);
|
||||
loaded_domains_.insert(domain);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue