aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2021-06-23 16:35:50 +0000
committerGitHub <noreply@github.com>2021-06-23 17:35:50 +0100
commit51bf4a6e26f9eca461ae88181b06b517afc4d656 (patch)
treee5a7f440789ffc2acac48d475fe3d2d1148d297e
parentc60a146e2291f7a55a3e5fd0447bd393b063ab1c (diff)
downloadminetest-51bf4a6e26f9eca461ae88181b06b517afc4d656.tar.gz
minetest-51bf4a6e26f9eca461ae88181b06b517afc4d656.tar.bz2
minetest-51bf4a6e26f9eca461ae88181b06b517afc4d656.zip
Perform some quality assurance for translation strings (#11375)
-rw-r--r--src/client/clientlauncher.cpp4
-rw-r--r--src/gui/guiVolumeChange.cpp15
2 files changed, 11 insertions, 8 deletions
diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp
index 13e7aefcf..6ab610670 100644
--- a/src/client/clientlauncher.cpp
+++ b/src/client/clientlauncher.cpp
@@ -512,8 +512,8 @@ bool ClientLauncher::launch_game(std::string &error_message,
// Load gamespec for required game
start_data.game_spec = findWorldSubgame(worldspec.path);
if (!start_data.game_spec.isValid()) {
- error_message = gettext("Could not find or load game \"")
- + worldspec.gameid + "\"";
+ error_message = gettext("Could not find or load game: ")
+ + worldspec.gameid;
errorstream << error_message << std::endl;
return false;
}
diff --git a/src/gui/guiVolumeChange.cpp b/src/gui/guiVolumeChange.cpp
index f17cfa986..61ab758a1 100644
--- a/src/gui/guiVolumeChange.cpp
+++ b/src/gui/guiVolumeChange.cpp
@@ -93,11 +93,12 @@ void GUIVolumeChange::regenerateGui(v2u32 screensize)
core::rect<s32> rect(0, 0, 160 * s, 20 * s);
rect = rect + v2s32(size.X / 2 - 80 * s, size.Y / 2 - 70 * s);
- const wchar_t *text = wgettext("Sound Volume: ");
+ wchar_t text[100];
+ const wchar_t *str = wgettext("Sound Volume: %d%%");
+ swprintf(text, sizeof(text) / sizeof(wchar_t), str, volume);
+ delete[] str;
core::stringw volume_text = text;
- delete [] text;
- volume_text += core::stringw(volume) + core::stringw("%");
Environment->addStaticText(volume_text.c_str(), rect, false,
true, this, ID_soundText);
}
@@ -183,11 +184,13 @@ bool GUIVolumeChange::OnEvent(const SEvent& event)
g_settings->setFloat("sound_volume", (float) pos / 100);
gui::IGUIElement *e = getElementFromId(ID_soundText);
- const wchar_t *text = wgettext("Sound Volume: ");
+ wchar_t text[100];
+ const wchar_t *str = wgettext("Sound Volume: %d%%");
+ swprintf(text, sizeof(text) / sizeof(wchar_t), str, pos);
+ delete[] str;
+
core::stringw volume_text = text;
- delete [] text;
- volume_text += core::stringw(pos) + core::stringw("%");
e->setText(volume_text.c_str());
return true;
}