summaryrefslogtreecommitdiff
path: root/src/translation.cpp
diff options
context:
space:
mode:
authorNathanaƫl Courant <Ekdohibs@users.noreply.github.com>2019-02-23 20:55:54 +0100
committerParamat <paramat@users.noreply.github.com>2019-02-23 19:55:54 +0000
commiteeb67627ec75f9c42e089b5e90686017b7eb62c8 (patch)
tree51b5e65ec24b9fd088ad38d8c3876063235295bc /src/translation.cpp
parent1942660955bc3684a60d527e2fafa0ec3e02dd54 (diff)
downloadminetest-eeb67627ec75f9c42e089b5e90686017b7eb62c8.tar.gz
minetest-eeb67627ec75f9c42e089b5e90686017b7eb62c8.tar.bz2
minetest-eeb67627ec75f9c42e089b5e90686017b7eb62c8.zip
Fix files with CRLF line endings in translations (#8280)
Diffstat (limited to 'src/translation.cpp')
-rw-r--r--src/translation.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/translation.cpp b/src/translation.cpp
index 649c3b282..7ddd95591 100644
--- a/src/translation.cpp
+++ b/src/translation.cpp
@@ -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]));
}