summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrwastl <mrwastl@users.sourceforge.net>2010-05-09 21:34:56 +0200
committermrwastl <mrwastl@users.sourceforge.net>2010-05-09 21:43:15 +0200
commit621ae324977687d33f8662b5986f3d16b9023c3f (patch)
tree133357415b423ae03a4b59978dfb5ae4c57fecf5
parent2707e55f48685452892e40e95b19655880f0e042 (diff)
downloadvdr-plugin-graphlcd-621ae324977687d33f8662b5986f3d16b9023c3f.tar.gz
vdr-plugin-graphlcd-621ae324977687d33f8662b5986f3d16b9023c3f.tar.bz2
plugin should now be working for both non-UTF8 and UTF8 versions of VDR; VDR < 1.5.x: small workaround so that month/day-names are displayed in the configured language
-rw-r--r--Makefile5
-rw-r--r--common.c33
-rw-r--r--plugin.c2
3 files changed, 39 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 137b401..d8484f8 100644
--- a/Makefile
+++ b/Makefile
@@ -67,12 +67,15 @@ endif
### The object files (add further files here):
-OBJS = alias.o common.o display.o i18n.o menu.o plugin.o setup.o skinconfig.o state.o strfct.o
+#OBJS = alias.o common.o display.o i18n.o menu.o plugin.o setup.o skinconfig.o state.o strfct.o
+OBJS = alias.o common.o display.o menu.o plugin.o setup.o skinconfig.o state.o strfct.o
### The main target:
TARGETS = libvdr-$(PLUGIN).so
ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c)
TARGETS += i18n
+else
+OBJS += i18n.o
endif
diff --git a/common.c b/common.c
index 431600a..f791d16 100644
--- a/common.c
+++ b/common.c
@@ -4,6 +4,35 @@
#include <vdr/plugin.h>
+#if APIVERSNUM < 10503
+#include <locale.h>
+
+static char* locID[] = {
+ "en_US", //" English",
+ "de_DE", // "Deutsch",
+ "sl_SI", // "Slovenski",
+ "it_IT", // "Italiano",
+ "nl_NL", // "Nederlands",
+ "pt_PT", // "Português",
+ "fr_FR", // "Français",
+ "no_NO", // "Norsk",
+ "fi_FI", // "suomi", Finnish (this is not a typo - it's really lowercase!)
+ "pl_PL", // "Polski",
+ "es_ES", // "Español",
+ "el_GR", // "ÅëëçíéêÜ", Greek
+ "sv_SE", // "Svenska",
+ "ro_RO", // "Românã",
+ "hu_HU", // "Magyar",
+ "ca_ES", // "Català",
+ "ru_RU", // "ÀãááÚØÙ", Russian
+ "hr_HR", // "Hrvatski",
+ "et_EE", // "Eesti",
+ "da_DK", // "Dansk",
+ "cs_CZ" // "Èesky", Czech
+};
+#endif
+
+
GLCD::cType TimeType(time_t Time, const std::string &Format)
{
static char result[1000];
@@ -14,6 +43,10 @@ GLCD::cType TimeType(time_t Time, const std::string &Format)
{
if (Format.length() > 0)
{
+// for vdr < 1.5.x: force locale for correct language output. for >= 1.5.x: system locale should be fine
+#if APIVERSNUM < 10503
+ setlocale(LC_TIME, locID[Setup.OSDLanguage]);
+#endif
strftime(result, sizeof(result), Format.c_str(), tm);
GLCD::cType r = result;
diff --git a/plugin.c b/plugin.c
index 56130f8..bdeea86 100644
--- a/plugin.c
+++ b/plugin.c
@@ -131,7 +131,9 @@ bool cPluginGraphLCD::Initialize()
unsigned int displayNumber = 0;
const char * cfgDir;
+#if APIVERSNUM < 10503
RegisterI18n(Phrases);
+#endif
if (mConfigName.length() == 0)
{