Skip to content

Commit

Permalink
Strings in the addon manager can now be translated (see bug 997)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi authored and LMH0013 committed Aug 12, 2013
1 parent 3f9a77c commit 6ac921f
Showing 1 changed file with 38 additions and 5 deletions.
43 changes: 38 additions & 5 deletions src/supertux/menu/addon_menu.cpp
Expand Up @@ -18,6 +18,7 @@

#include <config.h>
#include <algorithm>
#include <boost/format.hpp>

#include "addon/addon.hpp"
#include "addon/addon_manager.hpp"
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 6ac921f

Please sign in to comment.