|
From: Yoda-JM <yo...@us...> - 2009-12-06 12:01:08
|
Module: performous
Branch: master
Commit: 3198bf3c843ee9c67205c8ca14e4cd9e98dafa45
Author: Vincent Le Ligeour <yo...@us...>
Date: Sun Dec 6 13:00:49 2009 +0100
Added some i18n stuffs (work in progress)
---
game/i18n.hh | 4 ++++
game/screen_hiscore.cc | 3 ++-
game/screen_intro.cc | 15 ++++++++-------
game/screen_players.cc | 9 +++++----
game/screen_sing.cc | 2 ++
game/screen_songs.cc | 8 ++++----
6 files changed, 25 insertions(+), 16 deletions(-)
diff --git a/game/i18n.hh b/game/i18n.hh
new file mode 100644
index 0000000..24b87b9
--- /dev/null
+++ b/game/i18n.hh
@@ -0,0 +1,4 @@
+/* Internationalization Dependances */
+#include <libintl.h>
+#include <locale.h>
+#define _(x) gettext(x)
diff --git a/game/screen_hiscore.cc b/game/screen_hiscore.cc
index 9984c47..a369edf 100644
--- a/game/screen_hiscore.cc
+++ b/game/screen_hiscore.cc
@@ -5,6 +5,7 @@
#include "fs.hh"
#include "util.hh"
#include "database.hh"
+#include "i18n.hh"
#include <iostream>
#include <sstream>
@@ -100,7 +101,7 @@ void ScreenHiscore::draw() {
std::ostringstream oss_song, oss_order;
// Format the player information text
- oss_song << "Hiscore for " << m_song->title << "\n";
+ oss_song << _("Hiscore for ") << m_song->title << "\n";
m_database.queryPerSongHiscore(oss_order, m_song);
diff --git a/game/screen_intro.cc b/game/screen_intro.cc
index 27b70f5..2e5aec9 100755
--- a/game/screen_intro.cc
+++ b/game/screen_intro.cc
@@ -3,21 +3,22 @@
#include "fs.hh"
#include "audio.hh"
#include "record.hh"
+#include "i18n.hh"
ScreenIntro::ScreenIntro(std::string const& name, Audio& audio, Capture& capture): Screen(name), m_audio(audio), m_capture(capture), selected() {
- m_menuOptions.push_back(new MenuOption("Perform", "Songs", "intro_sing.svg", "Start performing!"));
- m_menuOptions.push_back(new MenuOption("Practice", "Practice", "intro_practice.svg", "Check your skills or test the microphones"));
- m_menuOptions.push_back(new MenuOption("Configure", "Configuration", "intro_configure.svg", "Configure game options"));
- m_menuOptions.push_back(new MenuOption("Quit", "", "intro_quit.svg", "Leave the game"));
+ m_menuOptions.push_back(new MenuOption(_("Perform"), "Songs", "intro_sing.svg", _("Start performing!")));
+ m_menuOptions.push_back(new MenuOption(_("Practice"), "Practice", "intro_practice.svg", _("Check your skills or test the microphones")));
+ m_menuOptions.push_back(new MenuOption(_("Configure"), "Configuration", "intro_configure.svg", _("Configure game options")));
+ m_menuOptions.push_back(new MenuOption(_("Quit"), "", "intro_quit.svg", _("Leave the game")));
}
void ScreenIntro::enter() {
m_audio.playMusic(getThemePath("menu.ogg"), true);
theme.reset(new ThemeIntro());
std::string msg;
- if (!m_audio.isOpen()) msg = "No playback devices could be used.\n";
- if (m_capture.analyzers().empty()) msg += "No microphones found.\n";
- if (!msg.empty()) m_dialog.reset(new Dialog(msg + "\nPlease configure some before playing."));
+ if (!m_audio.isOpen()) msg = _("No playback devices could be used.\n");
+ if (m_capture.analyzers().empty()) msg += _("No microphones found.\n");
+ if (!msg.empty()) m_dialog.reset(new Dialog(msg + _("\nPlease configure some before playing.")));
}
void ScreenIntro::exit() {
diff --git a/game/screen_players.cc b/game/screen_players.cc
index ec4cd2c..ee0130e 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -8,6 +8,7 @@
#include "layout_singer.hh"
#include "theme.hh"
#include "video.hh"
+#include "i18n.hh"
#include <iostream>
#include <sstream>
@@ -106,16 +107,16 @@ void ScreenPlayers::draw() {
if (m_players.empty()) {
// Format the song information text
if (m_search.text.empty()) {
- oss_song << "No players found!";
- // oss_order << "Check " << m_players.file() << "\n" << "directory for players\n";
- oss_order << "Enter a name to create a new player.";
+ oss_song << _("No players found!");
+ oss_order << _("Enter a name to create a new player.");
} else {
- oss_song << "Press enter to create player!";
+ oss_song << _("Press enter to create player!");
oss_order << m_search.text << '\n';
}
} else {
// Format the player information text
oss_song << m_database.scores.front().track << "\n";
+ // TODO: use boost::format
oss_song << "You reached " << m_database.scores.front().score << " points!";
oss_order << "Please enter your Name!\n"
<< "Name: " << m_players.current().name << '\n';
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index b221df1..8aa867d 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -9,6 +9,7 @@
#include "video.hh"
#include "guitargraph.hh"
#include "glutil.hh"
+#include "i18n.hh"
#include <boost/format.hpp>
#include <boost/lexical_cast.hpp>
@@ -96,6 +97,7 @@ void ScreenSing::enter() {
void ScreenSing::instrumentLayout(double time) {
for (Instruments::iterator it = m_instruments.begin(); it != m_instruments.end();) {
if (it->dead(time)) {
+ // TODO: use boost::format
std::cout << it->getTrack() << " was thrown out after " << time << " inactive" << std::endl;
it = m_instruments.erase(it);
} else ++it;
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index 22bb819..e5a55a6 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -6,6 +6,7 @@
#include "util.hh"
#include "songs.hh"
#include "audio.hh"
+#include "i18n.hh"
#include <iostream>
#include <sstream>
@@ -205,11 +206,10 @@ void ScreenSongs::draw() {
if (m_songs.empty()) {
// Format the song information text
if (m_search.text.empty()) {
- oss_song << "No songs found!";
- oss_order << "Visit performous.org\n";
- oss_order << "for free songs";
+ oss_song << _("No songs found!");
+ oss_order << _("Visit performous.org\nfor free songs");
} else {
- oss_song << "no songs match search";
+ oss_song << _("no songs match search");
oss_order << m_search.text << '\n';
}
} else {
|