aboutsummaryrefslogtreecommitdiff
path: root/builtin/game
ModeNameSize
-rw-r--r--auth.lua5922logplain
-rw-r--r--chatcommands.lua26881logplain
-rw-r--r--constants.lua293logplain
-rw-r--r--deprecated.lua1473logplain
-rw-r--r--detached_inventory.lua575logplain
-rw-r--r--falling.lua5483logplain
-rw-r--r--features.lua670logplain
-rw-r--r--forceloading.lua2141logplain
-rw-r--r--init.lua825logplain
-rw-r--r--item.lua17351logplain
-rw-r--r--item_entity.lua6129logplain
-rw-r--r--misc.lua4621logplain
-rw-r--r--mod_profiling.lua10780logplain
-rw-r--r--privileges.lua1720logplain
-rw-r--r--register.lua15280logplain
-rw-r--r--statbars.lua3727logplain
-rw-r--r--static_spawn.lua879logplain
-rw-r--r--voxelarea.lua2450logplain
<< wide_to_utf8(textdomain) << "\"" << std::endl; // Silence that warning in the future m_translations[key] = s; return s; } } void Translations::loadTranslation(const std::string &data) { std::istringstream is(data); std::wstring textdomain; std::string line; 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])); } if (line.empty() || line[0] == '#') continue; std::wstring wline = utf8_to_wide(line); if (wline.empty()) continue; // Read line // '=' marks the key-value pair, but may be escaped by an '@'. // '\n' may also be escaped by '@'. // All other escapes are preserved. size_t i = 0; std::wostringstream word1, word2; while (i < wline.length() && wline[i] != L'=') { if (wline[i] == L'@') { if (i + 1 < wline.length()) { if (wline[i + 1] == L'=') { word1.put(L'='); } else if (wline[i + 1] == L'n') { word1.put(L'\n'); } else { word1.put(L'@'); word1.put(wline[i + 1]); } i += 2; } else { // End of line, go to the next one. word1.put(L'\n'); if (!is.good()) { break; } i = 0; std::getline(is, line); wline = utf8_to_wide(line); } } else { word1.put(wline[i]); i++; } } if (i == wline.length()) { errorstream << "Malformed translation line \"" << line << "\"" << std::endl; continue; } i++; while (i < wline.length()) { if (wline[i] == L'@') { if (i + 1 < wline.length()) { if (wline[i + 1] == L'=') { word2.put(L'='); } else if (wline[i + 1] == L'n') { word2.put(L'\n'); } else { word2.put(L'@'); word2.put(wline[i + 1]); } i += 2; } else { // End of line, go to the next one. word2.put(L'\n'); if (!is.good()) { break; } i = 0; std::getline(is, line); wline = utf8_to_wide(line); } } else { word2.put(wline[i]); i++; } } std::wstring oword1 = word1.str(), oword2 = word2.str(); if (oword2.empty()) { oword2 = oword1;