Skip to content

Commit 6db02ec

Browse files
author
Semphris
committed
Replaced translation concatenation with boost::format
1 parent c9e26f3 commit 6db02ec

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/supertux/menu/cheat_apply_menu.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#include "supertux/menu/cheat_apply_menu.hpp"
1818

19+
#include "boost/format.hpp"
20+
1921
#include "gui/menu_item.hpp"
2022
#include "gui/menu_manager.hpp"
2123
#include "object/player.hpp"
@@ -34,8 +36,8 @@ CheatApplyMenu::CheatApplyMenu(std::function<void(Player&)> callback) :
3436
add_entry(-1, _("All Players"));
3537
for (const auto player : Sector::get().get_players())
3638
{
37-
add_entry(player->get_id(), _("Player") + " " +
38-
std::to_string(player->get_id() + 1));
39+
add_entry(player->get_id(), (boost::format(_("Player %d"))
40+
% (player->get_id() + 1)).str());
3941
}
4042

4143
add_hl();
@@ -55,8 +57,8 @@ CheatApplyMenu::CheatApplyMenu(std::function<void(Player&, int)> callback) :
5557
add_entry(-1, _("All Players"));
5658
for (const auto player : Sector::get().get_players())
5759
{
58-
add_entry(player->get_id(), _("Player") + " " +
59-
std::to_string(player->get_id() + 1));
60+
add_entry(player->get_id(), (boost::format(_("Player %d"))
61+
% (player->get_id() + 1)).str());
6062
}
6163

6264
add_hl();

src/supertux/menu/multiplayer_player_menu.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "supertux/menu/multiplayer_player_menu.hpp"
1818

19+
#include "boost/format.hpp"
1920
#include "SDL.h"
2021

2122
#include "control/game_controller_manager.hpp"
@@ -33,7 +34,7 @@
3334

3435
MultiplayerPlayerMenu::MultiplayerPlayerMenu(int player_id)
3536
{
36-
add_label(_("Player") + " " + std::to_string(player_id + 1));
37+
add_label((boost::format(_("Player %d")) % (player_id + 1)).str());
3738
add_hl();
3839

3940
add_toggle(-1, _("Play with the keyboard"), &InputManager::current()->m_uses_keyboard[player_id]);

src/supertux/menu/worldmap_cheat_apply_menu.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#include "supertux/menu/worldmap_cheat_apply_menu.hpp"
1818

19+
#include "boost/format.hpp"
20+
1921
#include "gui/menu_item.hpp"
2022
#include "gui/menu_manager.hpp"
2123
#include "object/player.hpp"
@@ -34,7 +36,7 @@ WorldmapCheatApplyMenu::WorldmapCheatApplyMenu(int num_players,
3436
add_hl();
3537

3638
for (int i = 0; i < m_num_players; i++)
37-
add_entry(i, _("Player") + " " + std::to_string(i + 1));
39+
add_entry(i, (boost::format(_("Player %d")) % (i + 1)).str());
3840

3941
add_hl();
4042
add_back(_("Back"));
@@ -55,7 +57,7 @@ WorldmapCheatApplyMenu::WorldmapCheatApplyMenu(int num_players,
5557
add_entry(-1, _("All Players"));
5658

5759
for (int i = 0; i < m_num_players; i++)
58-
add_entry(i, _("Player") + " " + std::to_string(i + 1));
60+
add_entry(i, (boost::format(_("Player %d")) % (i + 1)).str());
5961

6062
add_hl();
6163
add_back(_("Back"));

0 commit comments

Comments
 (0)