From 6ac921f137dd30601c42b60b179af7924a7f88e5 Mon Sep 17 00:00:00 2001 From: Tobias Markus Date: Mon, 12 Aug 2013 10:08:57 -1000 Subject: [PATCH] Strings in the addon manager can now be translated (see bug 997) --- src/supertux/menu/addon_menu.cpp | 43 +++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/src/supertux/menu/addon_menu.cpp b/src/supertux/menu/addon_menu.cpp index bf4e9b527..a3cc6d5fa 100644 --- a/src/supertux/menu/addon_menu.cpp +++ b/src/supertux/menu/addon_menu.cpp @@ -18,6 +18,7 @@ #include #include +#include #include "addon/addon.hpp" #include "addon/addon_manager.hpp" @@ -71,13 +72,45 @@ AddonMenu::refresh() if (!addon.kind.empty()) { - text += addon.kind + " "; - } - text += std::string("\"") + addon.title + "\""; + std::string kind = addon.kind; + if(addon.kind == "Levelset") { + kind = _("Levelset"); + } + else if(addon.kind == "Worldmap") { + kind = _("Worldmap"); + } + else if(addon.kind == "World") { + kind = _("World"); + } + else if(addon.kind == "Level") { + kind = _("Level"); + } + - if (!addon.author.empty()) + if(!addon.author.empty()) + { + text = str(boost::format(_("%s \"%s\" by \"%s\"")) + % kind % addon.title % addon.author); + } + else + { + // Only addon type and name, no need for translation. + text = str(boost::format("%s \"%s\"") + % kind % addon.title); + } + } + else { - text += " by \"" + addon.author + "\""; + if (!addon.author.empty()) + { + text = str(boost::format(_("\"%s\" by \"%s\"")) + % addon.title % addon.author); + } + else { + // Only addon name, no need for translation. + text = str(boost::format("\"%s\"") + % addon.title); + } } add_toggle(ADDON_LIST_START_ID + i, text, addon.loaded); } -- 2.11.0