Make teams and scoreboard translatable

master
krzys-h 2017-05-17 19:00:40 +02:00
parent 880f31a7c6
commit cf7c19ef62
10 changed files with 151 additions and 6 deletions

View File

@ -260,6 +260,16 @@ msgstr ""
msgid "Generating"
msgstr ""
msgid "Results"
msgstr ""
msgid "The battle has ended"
msgstr ""
#, c-format
msgid "%s: %d pts"
msgstr ""
msgid "Cancel"
msgstr ""
@ -1601,6 +1611,18 @@ msgstr ""
msgid "Press \\key help; to read instructions on your SatCom"
msgstr ""
#, c-format
msgid "<<< Team %s finished! >>>"
msgstr ""
#, c-format
msgid "<<< Team %s lost! >>>"
msgstr ""
#, c-format
msgid "<<< Team %s recieved %d points >>>"
msgstr ""
msgid "Opening bracket missing"
msgstr ""

View File

@ -29,6 +29,10 @@ msgstr "Es fehlt eine offene eckige Klammer \" [ \""
msgid "\" ] \" missing"
msgstr "Es fehlt eine geschlossene eckige Klammer \" ] \""
#, c-format
msgid "%s: %d pts"
msgstr ""
msgid "..behind"
msgstr "..hinten"
@ -50,6 +54,18 @@ msgstr "<< Zurück \\Zurück zum Hauptmenü"
msgid "<<< Sorry; mission failed >>>"
msgstr "<<< Mission gescheitert >>>"
#, c-format
msgid "<<< Team %s finished! >>>"
msgstr ""
#, c-format
msgid "<<< Team %s lost! >>>"
msgstr ""
#, c-format
msgid "<<< Team %s recieved %d points >>>"
msgstr ""
msgid "<<< Well done; mission accomplished >>>"
msgstr "<<< Bravo, Mission vollendet >>>"
@ -1258,6 +1274,9 @@ msgstr ""
msgid "Restoring saved objects"
msgstr ""
msgid "Results"
msgstr ""
msgid "Return to start"
msgstr "Alles zurücksetzen"
@ -1486,6 +1505,9 @@ msgstr ""
msgid "Textures"
msgstr ""
msgid "The battle has ended"
msgstr ""
msgid "The expression must return a boolean value"
msgstr "Der Ausdruck muss einen boolschen Wert ergeben"

View File

@ -25,6 +25,10 @@ msgstr "\" [ \" attendu"
msgid "\" ] \" missing"
msgstr "\" ] \" attendu"
#, c-format
msgid "%s: %d pts"
msgstr ""
msgid "..behind"
msgstr "..derrière"
@ -46,6 +50,18 @@ msgstr "<< Retour \\Retour au niveau précédent"
msgid "<<< Sorry; mission failed >>>"
msgstr "<<< Désolé; mission échouée >>>"
#, c-format
msgid "<<< Team %s finished! >>>"
msgstr ""
#, c-format
msgid "<<< Team %s lost! >>>"
msgstr ""
#, c-format
msgid "<<< Team %s recieved %d points >>>"
msgstr ""
msgid "<<< Well done; mission accomplished >>>"
msgstr "<<< Bravo; mission terminée >>>"
@ -1236,6 +1252,9 @@ msgstr "Restaurer l'état d'exécution CBOT"
msgid "Restoring saved objects"
msgstr "Restaurer des objets sauvés"
msgid "Results"
msgstr ""
msgid "Return to start"
msgstr "Remet au départ"
@ -1458,6 +1477,9 @@ msgstr "Filtrage de textures\\Filtrage de textures"
msgid "Textures"
msgstr "Textures"
msgid "The battle has ended"
msgstr ""
msgid "The expression must return a boolean value"
msgstr "L'expression doit ętre un boolean"

View File

@ -27,6 +27,10 @@ msgstr "Oczekiwane \" [ \""
msgid "\" ] \" missing"
msgstr "Brak \" ] \""
#, c-format
msgid "%s: %d pts"
msgstr "%s: %d pkt"
msgid "..behind"
msgstr "..za"
@ -48,6 +52,18 @@ msgstr "<< Wstecz \\Wraca do poprzedniego ekranu"
msgid "<<< Sorry; mission failed >>>"
msgstr "<<< Niestety, misja nie powiodła się >>>"
#, c-format
msgid "<<< Team %s finished! >>>"
msgstr "<<< Drużyna %s zakończyła rozgrywkę! >>>"
#, c-format
msgid "<<< Team %s lost! >>>"
msgstr "<<< Drużyna %s odpadła! >>>"
#, c-format
msgid "<<< Team %s recieved %d points >>>"
msgstr "<<< Drużyna %s zdobyła %d punktów >>>"
msgid "<<< Well done; mission accomplished >>>"
msgstr "<<< Dobra robota, misja wypełniona >>>"
@ -1238,6 +1254,9 @@ msgstr "Przywracanie stanu CBot"
msgid "Restoring saved objects"
msgstr "Przywracanie obiektów"
msgid "Results"
msgstr "Wyniki"
msgid "Return to start"
msgstr "Powrót do początku"
@ -1460,6 +1479,9 @@ msgstr "Filtrowanie tekstur\\Filtrowanie tekstur"
msgid "Textures"
msgstr "Tekstury"
msgid "The battle has ended"
msgstr "Bitwa zakończyła się"
msgid "The expression must return a boolean value"
msgstr "Wyrażenie musi zwrócić wartość logiczną"

View File

@ -27,6 +27,10 @@ msgstr "Ожидалось \" [ \""
msgid "\" ] \" missing"
msgstr "Отсутствует \"]\" "
#, c-format
msgid "%s: %d pts"
msgstr ""
msgid "..behind"
msgstr "Сзади"
@ -48,6 +52,18 @@ msgstr "<< Назад \\Вернуться на предыдущую стран
msgid "<<< Sorry; mission failed >>>"
msgstr "<<< Миссия провалена >>>"
#, c-format
msgid "<<< Team %s finished! >>>"
msgstr ""
#, c-format
msgid "<<< Team %s lost! >>>"
msgstr ""
#, c-format
msgid "<<< Team %s recieved %d points >>>"
msgstr ""
msgid "<<< Well done; mission accomplished >>>"
msgstr "<<< Отлично, миссия выполнена >>>"
@ -1250,6 +1266,9 @@ msgstr "Восстановление состояния CBot"
msgid "Restoring saved objects"
msgstr "Восстановить сохранённые объекты"
msgid "Results"
msgstr ""
msgid "Return to start"
msgstr "Вернуться в начало"
@ -1474,6 +1493,9 @@ msgstr "Фильтрация текстур\\Фильтрация текстур
msgid "Textures"
msgstr "Текстуры"
msgid "The battle has ended"
msgstr ""
msgid "The expression must return a boolean value"
msgstr "Выражение должно возвращать логическое значение"

View File

@ -147,6 +147,9 @@ enum Error
INFO_DELETEWORM = 10103, //! < insect killed
INFO_DELETESPIDER = 10104, //! < insect killed
INFO_BEGINSATCOM = 10105, //! < use your SatCom
INFO_TEAM_FINISH = 10110,
INFO_TEAM_DEAD = 10111,
INFO_TEAM_SCORE = 10112,
ERR_MAX //! < number of values
};

View File

@ -143,6 +143,10 @@ void InitializeRestext()
stringsText[RT_LOADING_TERRAIN_TEX] = TR("Textures");
stringsText[RT_LOADING_TERRAIN_GEN] = TR("Generating");
stringsText[RT_SCOREBOARD_RESULTS] = TR("Results");
stringsText[RT_SCOREBOARD_RESULTS_TEXT]= TR("The battle has ended");
stringsText[RT_SCOREBOARD_RESULTS_LINE]= TR("%s: %d pts");
stringsEvent[EVENT_BUTTON_OK] = TR("OK");
@ -671,6 +675,9 @@ void InitializeRestext()
stringsErr[INFO_DELETEWORM] = TR("Worm fatally wounded");
stringsErr[INFO_DELETESPIDER] = TR("Spider fatally wounded");
stringsErr[INFO_BEGINSATCOM] = TR("Press \\key help; to read instructions on your SatCom");
stringsErr[INFO_TEAM_FINISH] = TR("<<< Team %s finished! >>>");
stringsErr[INFO_TEAM_DEAD] = TR("<<< Team %s lost! >>>");
stringsErr[INFO_TEAM_SCORE] = TR("<<< Team %s recieved %d points >>>");

View File

@ -140,6 +140,10 @@ enum ResTextType
RT_LOADING_TERRAIN_TEX = 222,
RT_LOADING_TERRAIN_GEN = 223,
RT_SCOREBOARD_RESULTS = 230,
RT_SCOREBOARD_RESULTS_TEXT= 231,
RT_SCOREBOARD_RESULTS_LINE= 232,
RT_MAX //! < number of values
};

View File

@ -4958,16 +4958,22 @@ Error CRobotMain::ProcessEndMissionTake()
GetLogger()->Info("All teams died, mission ended\n");
if (m_scoreboard)
{
std::string title, text, details_line;
GetResource(RES_TEXT, RT_SCOREBOARD_RESULTS, title);
GetResource(RES_TEXT, RT_SCOREBOARD_RESULTS_TEXT, text);
GetResource(RES_TEXT, RT_SCOREBOARD_RESULTS_LINE, details_line);
std::string details = "";
for (auto it : teams)
{
int team = it.first;
if (team == 0) continue;
details += "Team "+boost::lexical_cast<std::string>(team)+": "+boost::lexical_cast<std::string>(m_scoreboard->GetScore(team))+" points\n";
if (!details.empty())
details += ", ";
details += StrUtils::Format(details_line.c_str(), GetTeamName(team).c_str(), m_scoreboard->GetScore(team));
}
m_ui->GetDialog()->StartInformation(
"Results",
"The battle has ended",
title,
text,
details,
false, true,
[&]() {
@ -4994,7 +5000,10 @@ Error CRobotMain::ProcessEndMissionTake()
if (result == INFO_LOST || result == INFO_LOSTq)
{
GetLogger()->Info("Team %d lost\n", team);
m_displayText->DisplayText(("<<< Team "+boost::lexical_cast<std::string>(team)+" lost! >>>").c_str(), Math::Vector(0.0f,0.0f,0.0f), 15.0f, 60.0f, 10.0f, Ui::TT_ERROR);
std::string text;
GetResource(RES_ERR, INFO_TEAM_DEAD, text);
text = StrUtils::Format(text.c_str(), GetTeamName(team).c_str());
m_displayText->DisplayText(text.c_str(), Math::Vector(0.0f,0.0f,0.0f), 15.0f, 60.0f, 10.0f, Ui::TT_ERROR);
m_displayText->SetEnable(false); // To prevent "bot destroyed" messages
m_objMan->DestroyTeam(team);
@ -5022,7 +5031,10 @@ Error CRobotMain::ProcessEndMissionTake()
m_missionResult = ERR_OK;
return ERR_OK;*/
GetLogger()->Info("Team %d finished\n", team);
m_displayText->DisplayText(("<<< Team "+boost::lexical_cast<std::string>(team)+" finished >>>").c_str(), Math::Vector(0.0f,0.0f,0.0f));
std::string text;
GetResource(RES_ERR, INFO_TEAM_FINISH, text);
text = StrUtils::Format(text.c_str(), GetTeamName(team).c_str());
m_displayText->DisplayText(text.c_str(), Math::Vector(0.0f,0.0f,0.0f));
if (m_scoreboard)
m_scoreboard->ProcessEndTake(team);
m_objMan->DestroyTeam(team, DestructionType::Win);

View File

@ -19,6 +19,9 @@
#include "level/scoreboard.h"
#include "common/restext.h"
#include "common/stringutils.h"
#include "level/parser/parserline.h"
#include "level/robotmain.h"
@ -84,7 +87,13 @@ void CScoreboard::ProcessEndTake(int team)
void CScoreboard::AddPoints(int team, int points)
{
GetLogger()->Info("Team %d earned %d points\n", team, points);
CRobotMain::GetInstancePointer()->GetDisplayText()->DisplayText(("<<< Team "+boost::lexical_cast<std::string>(team)+" recieved "+boost::lexical_cast<std::string>(points)+" points! >>>").c_str(), Math::Vector(0.0f,0.0f,0.0f), 15.0f, 60.0f, 10.0f, Ui::TT_WARNING);
CRobotMain* main = CRobotMain::GetInstancePointer();
std::string text;
GetResource(RES_ERR, INFO_TEAM_SCORE, text);
text = StrUtils::Format(text.c_str(), main->GetTeamName(team).c_str(), points);
main->GetDisplayText()->DisplayText(text.c_str(), Math::Vector(0.0f,0.0f,0.0f), 15.0f, 60.0f, 10.0f, Ui::TT_WARNING);
m_score[team] += points;
}