]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
Fix files with CRLF line endings in translations (#8280)
authorNathanaƫl Courant <Ekdohibs@users.noreply.github.com>
Sat, 23 Feb 2019 19:55:54 +0000 (20:55 +0100)
committerParamat <paramat@users.noreply.github.com>
Sat, 23 Feb 2019 19:55:54 +0000 (19:55 +0000)
src/translation.cpp

index 649c3b282086c7e7fe3671f500a0db7ff530461b..7ddd95591453c06a120e6396548462d221af6fa6 100644 (file)
@@ -58,6 +58,10 @@ void Translations::loadTranslation(const std::string &data)
 
        while (is.good()) {
                std::getline(is, line);
+               // Trim last character if file was using a \r\n line ending
+               if (line.length () > 0 && line[line.length() - 1] == '\r')
+                       line.resize(line.length() - 1);
+
                if (str_starts_with(line, "# textdomain:")) {
                        textdomain = utf8_to_wide(trim(str_split(line, ':')[1]));
                }