1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Add support for translating content titles and descriptions (#12208)

This commit is contained in:
rubenwardy 2024-02-24 19:13:07 +00:00 committed by GitHub
parent 57de599a29
commit b4be483d3e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 252 additions and 47 deletions

View file

@ -54,6 +54,7 @@ const std::wstring &Translations::getTranslation(
void Translations::loadTranslation(const std::string &data)
{
std::istringstream is(data);
std::string textdomain_narrow;
std::wstring textdomain;
std::string line;
@ -70,7 +71,8 @@ void Translations::loadTranslation(const std::string &data)
<< "\"" << std::endl;
continue;
}
textdomain = utf8_to_wide(trim(parts[1]));
textdomain_narrow = trim(parts[1]);
textdomain = utf8_to_wide(textdomain_narrow);
}
if (line.empty() || line[0] == '#')
continue;
@ -116,7 +118,7 @@ void Translations::loadTranslation(const std::string &data)
if (i == wline.length()) {
errorstream << "Malformed translation line \"" << line << "\""
<< std::endl;
<< " in text domain " << textdomain_narrow << std::endl;
continue;
}
i++;