[colobot] 59/100: Make teams and scoreboard translatable

Didier Raboud odyx at moszumanska.debian.org
Thu Jun 1 18:10:19 UTC 2017


This is an automated email from the git hooks/post-receive script.

odyx pushed a commit to branch debian/master
in repository colobot.

commit cf7c19ef62b3b3ecb18bff505ed5b299ad47584d
Author: krzys-h <krzys_h at interia.pl>
Date:   Wed May 17 19:00:40 2017 +0200

    Make teams and scoreboard translatable
---
 po/colobot.pot           | 22 ++++++++++++++++++++++
 po/de.po                 | 22 ++++++++++++++++++++++
 po/fr.po                 | 22 ++++++++++++++++++++++
 po/pl.po                 | 22 ++++++++++++++++++++++
 po/ru.po                 | 22 ++++++++++++++++++++++
 src/common/error.h       |  3 +++
 src/common/restext.cpp   |  7 +++++++
 src/common/restext.h     |  4 ++++
 src/level/robotmain.cpp  | 22 +++++++++++++++++-----
 src/level/scoreboard.cpp | 11 ++++++++++-
 10 files changed, 151 insertions(+), 6 deletions(-)

diff --git a/po/colobot.pot b/po/colobot.pot
index 30a4c1c..5a04df8 100644
--- a/po/colobot.pot
+++ b/po/colobot.pot
@@ -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 ""
 
diff --git a/po/de.po b/po/de.po
index 255608e..8b1be9f 100644
--- a/po/de.po
+++ b/po/de.po
@@ -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"
 
diff --git a/po/fr.po b/po/fr.po
index 818948a..ea65fcb 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -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"
 
diff --git a/po/pl.po b/po/pl.po
index aaa50b8..699a428 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -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ą"
 
diff --git a/po/ru.po b/po/ru.po
index f479b47..531a06b 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -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 "Выражение должно возвращать логическое значение"
 
diff --git a/src/common/error.h b/src/common/error.h
index d3ae49f..7522c01 100644
--- a/src/common/error.h
+++ b/src/common/error.h
@@ -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
 };
diff --git a/src/common/restext.cpp b/src/common/restext.cpp
index 035389b..0eec9f7 100644
--- a/src/common/restext.cpp
+++ b/src/common/restext.cpp
@@ -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 >>>");
 
 
 
diff --git a/src/common/restext.h b/src/common/restext.h
index b875f1c..3c0af1a 100644
--- a/src/common/restext.h
+++ b/src/common/restext.h
@@ -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
 };
diff --git a/src/level/robotmain.cpp b/src/level/robotmain.cpp
index b723b58..6530311 100644
--- a/src/level/robotmain.cpp
+++ b/src/level/robotmain.cpp
@@ -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);
diff --git a/src/level/scoreboard.cpp b/src/level/scoreboard.cpp
index 7208dd4..bb78aae 100644
--- a/src/level/scoreboard.cpp
+++ b/src/level/scoreboard.cpp
@@ -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;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git



More information about the Pkg-games-commits mailing list