From: Tobias Markus Date: Mon, 12 Aug 2013 20:08:57 +0000 (-1000) Subject: Strings in the addon manager can now be translated (see bug 997) X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=6ac921f137dd30601c42b60b179af7924a7f88e5;p=supertux.git Strings in the addon manager can now be translated (see bug 997) --- 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); }