summaryrefslogtreecommitdiff
path: root/common.c
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:34:56 +0200
commitbee592f98129e7a986b6a4007ff33e34bfaa09f4 (patch)
tree133357415b423ae03a4b59978dfb5ae4c57fecf5 /common.c
parent2707e55f48685452892e40e95b19655880f0e042 (diff)
downloadvdr-plugin-graphlcd-bee592f98129e7a986b6a4007ff33e34bfaa09f4.tar.gz
vdr-plugin-graphlcd-bee592f98129e7a986b6a4007ff33e34bfaa09f4.tar.bz2
VDR < 1.5.x: small workaround for displaying month/day-names in configures language; plugin should now be working for both non-UTF8 and UTF8 versions of VDR
Diffstat (limited to 'common.c')
-rw-r--r--common.c33
1 files changed, 33 insertions, 0 deletions
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;