|
From: Tapio V. <aa...@us...> - 2009-12-11 12:45:42
|
Module: performous
Branch: dance
Commit: a56ee745f09378c6ac2218701c59f270a511dcb9
Author: Xaldyz <xa...@us...>
Date: Wed Dec 9 16:19:52 2009 +0100
Fixed founding gettext under Windows
Fixed searching playback device into schema.xml
Update getting config dir under Windows
Add Italian support (and documentation to how create a language)
---
cmake/Modules/FindGettext.cmake | 14 +++---
data/schema.xml | 1 +
game/CMakeLists.txt | 2 +-
game/fs.cc | 39 +++++++++++++--
game/main.cc | 6 ++
lang/README | 21 ++++++++
lang/it/LC_MESSAGES/performous.mo | Bin 0 -> 1703 bytes
lang/it/LC_MESSAGES/performous.po | 96 +++++++++++++++++++++++++++++++++++++
8 files changed, 166 insertions(+), 13 deletions(-)
diff --git a/cmake/Modules/FindGettext.cmake b/cmake/Modules/FindGettext.cmake
index f1b0f5d..43a4220 100644
--- a/cmake/Modules/FindGettext.cmake
+++ b/cmake/Modules/FindGettext.cmake
@@ -10,18 +10,18 @@
include(LibFindMacros)
-libfind_pkg_check_modules(Gettext_PKGCONF Gettext)
+libfind_pkg_check_modules(gettext_PKGCONF gettext)
-find_path(Gettext_INCLUDE_DIR
+find_path(gettext_INCLUDE_DIR
NAMES libintl.h
- PATHS ${Gettext_PKGCONF_INCLUDE_DIRS}
+ PATHS ${gettext_PKGCONF_INCLUDE_DIRS}
)
-find_library(Gettext_LIBRARY
+find_library(gettext_LIBRARY
NAMES libintl
- PATHS ${Gettext_PKGCONF_LIBRARY_DIRS}
+ PATHS ${gettext_PKGCONF_LIBRARY_DIRS}
)
-set(Gettext_PROCESS_INCLUDES Gettext_INCLUDE_DIR)
-set(Gettext_PROCESS_LIBS Gettext_LIBRARY)
+set(gettext_PROCESS_INCLUDES gettext_INCLUDE_DIR)
+set(gettext_PROCESS_LIBS gettext_LIBRARY)
libfind_process(gettext)
diff --git a/data/schema.xml b/data/schema.xml
index 60fcd55..9d1938d 100644
--- a/data/schema.xml
+++ b/data/schema.xml
@@ -178,6 +178,7 @@ to save the current settings to XML.
<entry name="audio/playback" type="string_list">
<stringvalue></stringvalue>
<stringvalue>alsa:hw:0</stringvalue>
+ <stringvalue>channels=2</stringvalue>
<!-- <stringvalue>channels=2,rate=44100,frames=256@alsa</stringvalue> -->
<locale name="C">
<short>Playback devices</short>
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index 816e4c5..c84fd5c 100644
--- a/game/CMakeLists.txt
+++ b/game/CMakeLists.txt
@@ -20,7 +20,7 @@ else()
endif()
# Find all the libs that don't require extra parameters
-foreach(lib ${OUR_LIBS} SDL PangoCairo LibRSVG LibXML++ Magick++ GLEW AVFormat SWScale OpenGL Z Jpeg Tiff Png Gettext)
+foreach(lib ${OUR_LIBS} SDL PangoCairo LibRSVG LibXML++ Magick++ GLEW AVFormat SWScale OpenGL gettext Z Jpeg Tiff Png)
find_package(${lib} REQUIRED)
include_directories(${${lib}_INCLUDE_DIRS})
list(APPEND LIBS ${${lib}_LIBRARIES})
diff --git a/game/fs.cc b/game/fs.cc
index 3d3fc30..5e644f7 100644
--- a/game/fs.cc
+++ b/game/fs.cc
@@ -8,6 +8,11 @@
#include <list>
#include <sstream>
+#ifdef _WIN32
+#include <windows.h>
+#include <Shlobj.h>
+#endif
+
fs::path getHomeDir() {
static fs::path dir;
static bool initialized = false;
@@ -20,13 +25,36 @@ fs::path getHomeDir() {
}
fs::path getConfigDir() {
+
static fs::path dir;
static bool initialized = false;
if (!initialized) {
initialized = true;
- char const* conf = getenv("XDG_CONFIG_HOME");
- if (conf) dir = fs::path(conf) / "performous";
- else dir = getHomeDir() / ".config" / "performous";
+ #ifndef _WIN32
+ {
+ char const* conf = getenv("XDG_CONFIG_HOME");
+ if (conf) dir = fs::path(conf) / "performous";
+ else dir = getHomeDir() / ".config" / "performous";
+ }
+ #else
+ {
+ //open AppData directory
+ std::string str;
+ ITEMIDLIST* pidl;
+ char AppDir[MAX_PATH];
+ HRESULT hRes = SHGetSpecialFolderLocation( NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE , &pidl );
+ if (hRes==NOERROR)
+ {
+ SHGetPathFromIDList( pidl, AppDir );
+ int i;
+ for(i = 0; AppDir[i] != '\0'; i++){
+ if(AppDir[i] == '\\') str += '/';
+ else str += AppDir[i];
+ }
+ dir = fs::path(str) / "performous";
+ }
+ }
+ #endif
}
return dir;
}
@@ -77,8 +105,9 @@ std::string getPath(fs::path const& filename) {
#ifdef _WIN32
// Add APPLIC~1 (user-specific application data) FIXME: Not tested
{
- char const* appdata = getenv("APPDATA");
- if (appdata) dirs.push_back(appdata / shortDir);
+ //char const* appdata = getenv("APPDATA");
+ //if (appdata) dirs.push_back(appdata / shortDir);
+ dirs.push_back(getConfigDir());
}
#else
// Adding XDG_DATA_HOME
diff --git a/game/main.cc b/game/main.cc
index 6e42d13..fb00719 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -8,6 +8,7 @@
#include "database.hh"
#include "xtime.hh"
#include "video_driver.hh"
+#include "i18n.h"
// Screens
#include "screen_intro.hh"
@@ -206,6 +207,11 @@ template <typename Container> void confOverride(Container const& c, std::string
}
int main(int argc, char** argv) {
+ // initialize gettext
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, "../locale");
+ textdomain (PACKAGE);
+
std::cout << PACKAGE " " VERSION << std::endl;
std::signal(SIGINT, quit);
std::signal(SIGTERM, quit);
diff --git a/lang/README b/lang/README
new file mode 100644
index 0000000..b33acca
--- /dev/null
+++ b/lang/README
@@ -0,0 +1,21 @@
+To add new languages:
+
+Download POEdit (http://www.poedit.net/)
+ 1. Start POEdit
+ 2. Click File -> New Catalog
+ 3. Enter a project name (performous)
+ 4. Click the Paths tab at the top
+ 5. Click the New Item icon (second one, looks like a little square)
+ 6. Enter the path to the directory containing your plugin file ("." tells POEdit to scan the directory that you will save the file to, usually only need to include ../game), press enter
+ 7. Click the Keywords tab at the top
+ 8. Click the New Item icon
+ 9. Enter _ (that's underscore), press enter
+ 12. Click Okay
+ 13. Choose a name for your .po file (performous)
+
+REMEMBER TO SAVE INTO A SUBDIR WITH <your-locale>/LC_MESSAGES/performous.po
+
+Example for English:
+en/LC_MESSAGES/performous.po
+
+Thanks to guide at http://codex.wordpress.org/User:Skippy/Creating_POT_Files
\ No newline at end of file
diff --git a/lang/it/LC_MESSAGES/performous.mo b/lang/it/LC_MESSAGES/performous.mo
new file mode 100644
index 0000000..160d278
Binary files /dev/null and b/lang/it/LC_MESSAGES/performous.mo differ
diff --git a/lang/it/LC_MESSAGES/performous.po b/lang/it/LC_MESSAGES/performous.po
new file mode 100644
index 0000000..05f88f2
--- /dev/null
+++ b/lang/it/LC_MESSAGES/performous.po
@@ -0,0 +1,96 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Performous\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2009-12-07 01:56+0100\n"
+"PO-Revision-Date: \n"
+"Last-Translator: Xaldyz <xa...@us...>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-KeywordsList: _\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-SearchPath-0: ../game\n"
+
+#: ../game/screen_hiscore.cc:104
+msgid "Hiscore for "
+msgstr "Punteggio per "
+
+#: ../game/screen_intro.cc:9
+msgid "Perform"
+msgstr "Perform"
+
+#: ../game/screen_intro.cc:9
+msgid "Start performing!"
+msgstr "Start performing!"
+
+#: ../game/screen_intro.cc:10
+msgid "Practice"
+msgstr "Pratica"
+
+#: ../game/screen_intro.cc:10
+msgid "Check your skills or test the microphones"
+msgstr "Controlla quanto sei bravo / Test microfono"
+
+#: ../game/screen_intro.cc:11
+msgid "Configure"
+msgstr "Configura"
+
+#: ../game/screen_intro.cc:11
+msgid "Configure game options"
+msgstr "Opzioni di configurazione del gioco"
+
+#: ../game/screen_intro.cc:12
+msgid "Quit"
+msgstr "Esci"
+
+#: ../game/screen_intro.cc:12
+msgid "Leave the game"
+msgstr "Esci dal gioco"
+
+#: ../game/screen_intro.cc:19
+msgid "No playback devices could be used.\n"
+msgstr "Nessun dispositivo di riproduzione trovato.\n"
+
+#: ../game/screen_intro.cc:20
+msgid "No microphones found.\n"
+msgstr "Nessun microfono trovato.\n"
+
+#: ../game/screen_intro.cc:21
+msgid ""
+"\n"
+"Please configure some before playing."
+msgstr ""
+"\n"
+"Per favore controlla le tue impostazioni\n"
+"prima di giocare."
+
+#: ../game/screen_players.cc:110
+msgid "No players found!"
+msgstr "Nessun giocatore trovato!"
+
+#: ../game/screen_players.cc:111
+msgid "Enter a name to create a new player."
+msgstr "Inserisci il nome di un nuovo giocatore"
+
+#: ../game/screen_players.cc:113
+msgid "Press enter to create player!"
+msgstr "Premi invio per creare un giocatore!"
+
+#: ../game/screen_songs.cc:209
+msgid "No songs found!"
+msgstr "Nessuna canzone trovata!"
+
+#: ../game/screen_songs.cc:210
+msgid ""
+"Visit performous.org\n"
+"for free songs"
+msgstr ""
+"Visita il sito performous.org\n"
+"per canzoni gratuite"
+
+#: ../game/screen_songs.cc:212
+msgid "no songs match search"
+msgstr "nessuna corrispondenza trovata"
+
|