From 6d8f92e24058dcb6f0c62532cbb01c3656bc7e97 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 19 Jan 2008 12:25:54 +0100 Subject: [PATCH] The new option --localedir can be used to set the locale directory at runtime --- CONTRIBUTORS | 1 + HISTORY | 2 ++ config.h | 10 +++++----- i18n.c | 6 ++++-- i18n.h | 6 ++++-- vdr.c | 17 +++++++++++++++-- 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 7f7c265c..0cd64b79 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -223,6 +223,7 @@ Stefan Huelswitt for suggesting to increase the APIVERSION to allow plugins that relied on the cStatus::MsgSetVolume() bug to react properly for improving the 'i18n' target in the Makefile to avoid unnecessary work + for a patch that was used to implement the --localedir option Ulrich Röder for pointing out that there are channels that have a symbol rate higher than 27500 diff --git a/HISTORY b/HISTORY index 91813dba..14b74107 100644 --- a/HISTORY +++ b/HISTORY @@ -5569,3 +5569,5 @@ Video Disk Recorder Revision History - Fixed the Play function in the pictures plugin. - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Updated the Makefile of the skincurses plugin (thanks to Rolf Ahrenberg). +- The new option --localedir can be used to set the locale directory at runtime + (based on a patch from Stefan Huelswitt). diff --git a/config.h b/config.h index ba3a3841..e0a0284e 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.303 2007/11/25 13:45:48 kls Exp $ + * $Id: config.h 1.304 2008/01/19 12:08:29 kls Exp $ */ #ifndef __CONFIG_H @@ -22,13 +22,13 @@ // VDR's own version number: -#define VDRVERSION "1.5.13" -#define VDRVERSNUM 10513 // Version * 10000 + Major * 100 + Minor +#define VDRVERSION "1.5.14" +#define VDRVERSNUM 10514 // Version * 10000 + Major * 100 + Minor // The plugin API's version number: -#define APIVERSION "1.5.13" -#define APIVERSNUM 10513 // Version * 10000 + Major * 100 + Minor +#define APIVERSION "1.5.14" +#define APIVERSNUM 10514 // Version * 10000 + Major * 100 + Minor // When loading plugins, VDR searches them by their APIVERSION, which // may be smaller than VDRVERSION in case there have been no changes to diff --git a/i18n.c b/i18n.c index a018f238..66111f47 100644 --- a/i18n.c +++ b/i18n.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.c 1.318 2007/11/01 10:38:27 kls Exp $ + * $Id: i18n.c 1.319 2008/01/19 12:07:11 kls Exp $ * * */ @@ -100,8 +100,10 @@ static void SetEnvLanguage(const char *Locale) ++_nl_msg_cat_cntr; } -void I18nInitialize(void) +void I18nInitialize(const char *LocaleDir) { + if (LocaleDir) + I18nLocaleDir = LocaleDir; LanguageLocales.Append(strdup(I18N_DEFAULT_LOCALE)); LanguageNames.Append(strdup(SkipContext(LanguageName))); LanguageCodes.Append(strdup(LanguageCodeList[0])); diff --git a/i18n.h b/i18n.h index cbe42b99..8f960ea3 100644 --- a/i18n.h +++ b/i18n.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: i18n.h 1.24 2007/08/24 13:35:18 kls Exp $ + * $Id: i18n.h 1.25 2008/01/19 11:56:19 kls Exp $ */ #ifndef __I18N_H @@ -19,8 +19,10 @@ typedef const char *tI18nPhrase[22]; ///< obsolete - switch to 'gettext'! #define I18N_MAX_LOCALE_LEN 16 // for buffers that hold en_US etc. #define I18N_MAX_LANGUAGES 256 // for buffers that hold all available languages -void I18nInitialize(void); +void I18nInitialize(const char *LocaleDir = NULL); ///< Detects all available locales and loads the language names and codes. + ///< If LocaleDir is given, it must point to a static string that lives + ///< for the entire lifetime of the program. void I18nRegister(const char *Plugin); ///< Registers the named plugin, so that it can use internationalized texts. void I18nSetLocale(const char *Locale); diff --git a/vdr.c b/vdr.c index 05b9e487..03bc1428 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/vdr * - * $Id: vdr.c 1.305 2008/01/13 11:51:53 kls Exp $ + * $Id: vdr.c 1.306 2008/01/19 12:25:54 kls Exp $ */ #include @@ -198,6 +198,7 @@ int main(int argc, char *argv[]) bool MuteAudio = false; int WatchdogTimeout = DEFAULTWATCHDOG; const char *Terminal = NULL; + const char *LocaleDir = NULL; bool UseKbd = true; const char *LircDevice = NULL; @@ -229,6 +230,7 @@ int main(int argc, char *argv[]) { "help", no_argument, NULL, 'h' }, { "lib", required_argument, NULL, 'L' }, { "lirc", optional_argument, NULL, 'l' | 0x100 }, + { "localedir",required_argument, NULL, 'l' | 0x200 }, { "log", required_argument, NULL, 'l' }, { "mute", no_argument, NULL, 'm' }, { "no-kbd", no_argument, NULL, 'n' | 0x100 }, @@ -306,6 +308,14 @@ int main(int argc, char *argv[]) case 'l' | 0x100: LircDevice = optarg ? optarg : LIRC_DEVICE; break; + case 'l' | 0x200: + if (access(optarg, R_OK | X_OK) == 0) + LocaleDir = optarg; + else { + fprintf(stderr, "vdr: can't access locale directory: %s\n", optarg); + return 2; + } + break; case 'm': MuteAudio = true; break; case 'n' | 0x100: @@ -407,6 +417,8 @@ int main(int argc, char *argv[]) " -L DIR, --lib=DIR search for plugins in DIR (default is %s)\n" " --lirc[=PATH] use a LIRC remote control device, attached to PATH\n" " (default: %s)\n" + " --localedir=DIR search for locale files in DIR (default is\n" + " %s)\n" " -m, --mute mute audio of the primary DVB device at startup\n" " --no-kbd don't use the keyboard as an input device\n" " -p PORT, --port=PORT use PORT for SVDRP (default: %d)\n" @@ -430,6 +442,7 @@ int main(int argc, char *argv[]) DEFAULTEPGDATAFILENAME, DEFAULTPLUGINDIR, LIRC_DEVICE, + LOCDIR, DEFAULTSVDRPPORT, RCU_DEVICE, VideoDirectory, @@ -515,7 +528,7 @@ int main(int argc, char *argv[]) // Initialize internationalization: - I18nInitialize(); + I18nInitialize(LocaleDir); // Main program loop variables - need to be here to have them initialized before any EXIT():