1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Perform some quality assurance for translation strings (#11375)

This commit is contained in:
Wuzzy 2021-06-23 16:35:50 +00:00 committed by GitHub
parent c60a146e22
commit 51bf4a6e26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 9 deletions

View file

@ -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: ");
core::stringw volume_text = text;
delete [] text;
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;
volume_text += core::stringw(pos) + core::stringw("%");
e->setText(volume_text.c_str());
return true;
}