summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Günther <tom@toms-cafe.de>2007-12-03 23:10:04 +0100
committerThomas Günther <tom@toms-cafe.de>2007-12-03 23:10:04 +0100
commit4d21e602d958f69686b649e0c9ed4526485e962e (patch)
tree4170e76ce9d56c9d7fd483458541d5da2976adcc
parent5e67f4c92a8df9871f56850fa3132ec1a73bacb2 (diff)
downloadvdr-plugin-sudoku-4d21e602d958f69686b649e0c9ed4526485e962e.tar.gz
vdr-plugin-sudoku-4d21e602d958f69686b649e0c9ed4526485e962e.tar.bz2
Added gettext support (VDR >= 1.5.7)
-rw-r--r--HISTORY8
-rw-r--r--Makefile56
-rw-r--r--i18n.cpp6
-rw-r--r--i18n.h9
-rw-r--r--po/de_DE.po47
-rw-r--r--po/es_ES.po47
-rw-r--r--po/fi_FI.po47
-rw-r--r--sudoku.cpp9
8 files changed, 204 insertions, 25 deletions
diff --git a/HISTORY b/HISTORY
index e0bc313..e62e5ec 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,5 +1,5 @@
-VDR Plugin 'sudoku' Revision History
-------------------------------------
+VDR plug-in 'Sudoku' Revision History
+-------------------------------------
2005-10-28: Version 0.1.0
@@ -22,3 +22,7 @@ VDR Plugin 'sudoku' Revision History
2007-02-23: Version 0.1.3
- Added Spanish language texts (thanks to bittor from open7x0.org).
+
+____-__-__: Version _._._
+
+- Added gettext support (VDR >= 1.5.7).
diff --git a/Makefile b/Makefile
index 131f90d..7b21409 100644
--- a/Makefile
+++ b/Makefile
@@ -3,11 +3,13 @@
#
# See the README file for copyright information and how to reach the author.
#
-# $Id: Makefile 28 2006-04-25 00:09:14Z tom $
+# $Id: Makefile 102 2007-12-03 22:10:04Z tom $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
# By default the main source file also carries this name.
+# IMPORTANT: the presence of this macro is important for the Make.config
+# file. So it must be defined, even if it is not used here!
#
PLUGIN = sudoku
@@ -44,43 +46,61 @@ PACKAGE = vdr-$(ARCHIVE)
### Includes and Defines (add further entries here):
INCLUDES += -I$(VDRDIR)/include
-
DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
+CXXFLAGS += $(INCLUDES) $(DEFINES)
-### The object files (add further files here):
+### The source and object files
-OBJS = $(PLUGIN).o setup.o i18n.o bitmap.o menu.o \
- puzzle.o generator.o solver.o backtrack.o
+SRCS = $(wildcard *.cpp)
+OBJS = $(SRCS:%.cpp=%.o)
-### Implicit rules:
+### The main target:
-%.o: %.cpp
- $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
+all: libvdr-$(PLUGIN).so i18n
+ @cd tools && $(MAKE)
-# Dependencies:
+### Dependencies:
-MAKEDEP = $(CXX) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile
- @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.cpp) > $@
+ @$(CXX) -MM -MG $(SRCS) > $@
-include $(DEPFILE)
-### Targets:
+### Internationalization (I18N):
-all: libvdr-$(PLUGIN).so
- @cd tools && $(MAKE)
+PODIR = po
+LOCALEDIR = $(VDRDIR)/locale
+I18Npo = $(notdir $(wildcard $(PODIR)/*.po))
+I18Npot = $(PODIR)/$(PLUGIN).pot
+
+$(I18Npot): $(SRCS)
+ xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP \
+ --msgid-bugs-address='<tom@toms-cafe.de>' -o $@ $^
+
+%.po: $(I18Npot)
+ msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
+ @touch $@
+
+$(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.po
+ @mkdir -p $(dir $@)
+ msgfmt -c -o $@ $<
+
+.PHONY: i18n
+i18n: $(I18Npo:%.po=$(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo)
+
+### Targets:
libvdr-$(PLUGIN).so: $(OBJS)
- $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
- @cp $@ $(LIBDIR)/$@.$(APIVERSION)
+ $(CXX) $(CXXFLAGS) -shared $^ -o $@
+ @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
dist: clean
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@mkdir $(TMPDIR)/$(ARCHIVE)
@cp -a * $(TMPDIR)/$(ARCHIVE)
@tar czf $(PACKAGE).tgz -C $(TMPDIR) \
- --exclude debian --exclude CVS --exclude .svn $(ARCHIVE)
+ --exclude debian --exclude CVS --exclude .svn $(ARCHIVE)
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@echo Distribution package created as $(PACKAGE).tgz
@@ -88,6 +108,6 @@ srcdoc: Doxyfile $(OBJS:%.o=%.cpp) $(OBJS:%.o=%.h)
VERSION=$(VERSION) /usr/bin/doxygen
clean:
- @-rm -f $(OBJS) $(DEPFILE) *.so* *.tgz core* *~
+ @-rm -f $(DEPFILE) *.o *.so $(I18Npot) *.tgz core* *~
@-rm -rf srcdoc
@cd tools && $(MAKE) clean
diff --git a/i18n.cpp b/i18n.cpp
index a052eb3..965ee4d 100644
--- a/i18n.cpp
+++ b/i18n.cpp
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: i18n.cpp 68 2007-02-23 20:43:08Z tom $
+ * $Id: i18n.cpp 102 2007-12-03 22:10:04Z tom $
*
*
* Translations provided by:
@@ -17,6 +17,8 @@
#include <vdr/config.h>
+#if VDRVERSNUM < 10507
+
const tI18nPhrase SudokuPlugin::Phrases[] = {
{ "Sudoku", // English
"Sudoku", // Deutsch / German
@@ -218,3 +220,5 @@ const tI18nPhrase SudokuPlugin::Phrases[] = {
},
{ NULL }
};
+
+#endif
diff --git a/i18n.h b/i18n.h
index 7e75648..c1b0b79 100644
--- a/i18n.h
+++ b/i18n.h
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: i18n.h 11 2005-10-28 01:00:01Z tom $
+ * $Id: i18n.h 102 2007-12-03 22:10:04Z tom $
*/
#ifndef VDR_SUDOKU_I18N_H
@@ -11,8 +11,13 @@
#include "sudoku.h"
#include <vdr/i18n.h>
+#include <vdr/config.h>
+#if VDRVERSNUM < 10507
+
+#define trNOOP(s) (s)
+
namespace SudokuPlugin
{
@@ -20,4 +25,6 @@ namespace SudokuPlugin
} // namespace SudokuPlugin
+#endif
+
#endif // VDR_SUDOKU_I18N_H
diff --git a/po/de_DE.po b/po/de_DE.po
new file mode 100644
index 0000000..6b8846e
--- /dev/null
+++ b/po/de_DE.po
@@ -0,0 +1,47 @@
+# German translations for vdr-sudoku package.
+# Copyright (C) 2007 Thomas Günther <tom@toms-cafe.de>
+# This file is distributed under the same license as the vdr-sudoku package.
+# Thomas Günther <tom@toms-cafe.de>, 2005.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: vdr-sudoku 0.1.3\n"
+"Report-Msgid-Bugs-To: <tom@toms-cafe.de>\n"
+"POT-Creation-Date: 2007-12-03 22:48+0100\n"
+"PO-Revision-Date: 2007-08-20 22:43+0200\n"
+"Last-Translator: Thomas Günther <tom@toms-cafe.de>\n"
+"Language-Team: <vdr@linuxtv.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-15\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid ""
+"Congratulations!\n"
+"Press OK to start a new puzzle"
+msgstr ""
+"Herzlichen Glückwunsch!\n"
+"OK startet ein neues Puzzle"
+
+msgid "Givens count"
+msgstr "Anzahl vorgegebener Zahlen"
+
+msgid "Symmetric givens"
+msgstr "Vorgegebene Zahlen symmetrisch anordnen"
+
+msgid "Mark errors"
+msgstr "Fehler markieren"
+
+msgid "Mark ambiguous numbers"
+msgstr "Unklare Zahlen markieren"
+
+msgid "Clear marks on reset"
+msgstr "Markierungen löschen beim Reset"
+
+msgid "Transparency (%)"
+msgstr "Transparenz (%)"
+
+msgid "Sudoku - generate and solve Number Place puzzles"
+msgstr "Sudoku - Erzeugen und Lösen von Zahlenpuzzles"
+
+msgid "Sudoku"
+msgstr "Sudoku"
diff --git a/po/es_ES.po b/po/es_ES.po
new file mode 100644
index 0000000..e6f3583
--- /dev/null
+++ b/po/es_ES.po
@@ -0,0 +1,47 @@
+# Spanish translations for vdr-sudoku package.
+# Copyright (C) 2007 Thomas Günther <tom@toms-cafe.de>
+# This file is distributed under the same license as the vdr-sudoku package.
+# bittor from open7x0.org, 2007.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: vdr-sudoku 0.1.3\n"
+"Report-Msgid-Bugs-To: <tom@toms-cafe.de>\n"
+"POT-Creation-Date: 2007-12-03 22:48+0100\n"
+"PO-Revision-Date: 2007-08-20 22:43+0200\n"
+"Last-Translator: bittor from open7x0.org\n"
+"Language-Team: <vdr@linuxtv.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-15\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid ""
+"Congratulations!\n"
+"Press OK to start a new puzzle"
+msgstr ""
+"¡Enhorabuena!\n"
+"Pulse OK para iniciar un nuevo rompecabezas"
+
+msgid "Givens count"
+msgstr "Celdas rellenadas"
+
+msgid "Symmetric givens"
+msgstr "Números simétricos rellenados"
+
+msgid "Mark errors"
+msgstr "Marcar errores"
+
+msgid "Mark ambiguous numbers"
+msgstr "Marcar números ambiguos"
+
+msgid "Clear marks on reset"
+msgstr "Quitar marcas al reiniciar"
+
+msgid "Transparency (%)"
+msgstr "Transparencia (%)"
+
+msgid "Sudoku - generate and solve Number Place puzzles"
+msgstr "Solucionar rompecabezas numérico"
+
+msgid "Sudoku"
+msgstr "Sudoku"
diff --git a/po/fi_FI.po b/po/fi_FI.po
new file mode 100644
index 0000000..d1ce558
--- /dev/null
+++ b/po/fi_FI.po
@@ -0,0 +1,47 @@
+# Finnish translations for vdr-sudoku package.
+# Copyright (C) 2007 Thomas Günther <tom@toms-cafe.de>
+# This file is distributed under the same license as the vdr-sudoku package.
+# Ville Skyttä <ville.skytta@iki.fi>, 2005.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: vdr-sudoku 0.1.3\n"
+"Report-Msgid-Bugs-To: <tom@toms-cafe.de>\n"
+"POT-Creation-Date: 2007-12-03 22:48+0100\n"
+"PO-Revision-Date: 2007-08-20 22:43+0200\n"
+"Last-Translator: Ville Skyttä <ville.skytta@iki.fi>\n"
+"Language-Team: <vdr@linuxtv.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-15\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid ""
+"Congratulations!\n"
+"Press OK to start a new puzzle"
+msgstr ""
+"Onnittelut!\n"
+"Valitse 'OK' aloittaaksesi uuden tehtävän"
+
+msgid "Givens count"
+msgstr "Annettujen numeroiden lukumäärä"
+
+msgid "Symmetric givens"
+msgstr "Järjestä annetut symmetrisesti"
+
+msgid "Mark errors"
+msgstr "Merkitse virheet"
+
+msgid "Mark ambiguous numbers"
+msgstr "Merkitse epävarmat"
+
+msgid "Clear marks on reset"
+msgstr "Poista merkinnät aloitettaessa"
+
+msgid "Transparency (%)"
+msgstr "Läpinäkyvyys (%)"
+
+msgid "Sudoku - generate and solve Number Place puzzles"
+msgstr "Sudoku-numeroristikot"
+
+msgid "Sudoku"
+msgstr "Sudoku"
diff --git a/sudoku.cpp b/sudoku.cpp
index f455144..6d3248c 100644
--- a/sudoku.cpp
+++ b/sudoku.cpp
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: sudoku.cpp 70 2007-02-23 20:45:21Z tom $
+ * $Id: sudoku.cpp 102 2007-12-03 22:10:04Z tom $
*/
#include "sudoku.h"
@@ -12,6 +12,7 @@
#include "setup.h"
#include "i18n.h"
#include <vdr/plugin.h>
+#include <vdr/config.h>
/** 'Sudoku' is a VDR plugin to generate and solve Number Place puzzles. */
@@ -23,10 +24,10 @@ namespace SudokuPlugin
/** Short description of the plugin's purpose */
static const char* DESCRIPTION =
- "Sudoku - generate and solve Number Place puzzles";
+ trNOOP("Sudoku - generate and solve Number Place puzzles");
/** Name of the entry in VDR's main menu */
- static const char* MAINMENUENTRY = "Sudoku";
+ static const char* MAINMENUENTRY = trNOOP("Sudoku");
//--- class SudokuPlugin::Plugin ---------------------------------------------
@@ -76,7 +77,9 @@ using namespace SudokuPlugin;
*/
bool Plugin::Start()
{
+#if VDRVERSNUM < 10507
RegisterI18n(Phrases);
+#endif
puzzle.generate(setup.givens_count, setup.symmetric);
curr = curr.center();
return true;