From patchwork Sun Aug 19 15:56:31 2007 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anssi Hannula X-Patchwork-Id: 12507 Received: from pne-smtpout3-sn2.hy.skanova.net ([81.228.8.111]) by www.linuxtv.org with esmtp (Exim 4.63) (envelope-from ) id 1IMn91-0003Q3-Cx for vdr@linuxtv.org; Sun, 19 Aug 2007 17:56:51 +0200 Received: from mail.onse.fi (84.250.84.250) by pne-smtpout3-sn2.hy.skanova.net (7.2.075) id 46B71FFB0009264A for vdr@linuxtv.org; Sun, 19 Aug 2007 17:56:16 +0200 Received: from gamma.onse.fi (gamma [10.0.0.7]) by mail.onse.fi (Postfix) with ESMTP id 5D93A3D18089 for ; Sun, 19 Aug 2007 18:56:15 +0300 (EEST) Message-ID: <46C8682F.1080200@gmail.com> Date: Sun, 19 Aug 2007 18:56:31 +0300 From: Anssi Hannula User-Agent: Thunderbird 2.0.0.6 (X11/20070805) MIME-Version: 1.0 To: VDR Mailing List Subject: [vdr] locale names, patch for large localedirs X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.9 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Aug 2007 15:56:51 -0000 Status: O X-Status: X-Keywords: X-UID: 13831 Hi! Very nice to see gettext() working, for a while I thought it was going to be a complete mess :) IMHO, two simple things could still be done: Attached is a simple patch that allows using VDR with large localedir that contains more locales than I18N_MAX_LANGUAGES. AFAICS there is no reason to stop searching unless I18N_MAX_LANGUAGES vdr locales were actually found. Also, it is a convention (all programs in my system follow it) that .po files (and thus the locale directory name) be without the territory name, i.e. fi instead of fi_FI. If there would be any additional translations for some language, they would be named like fi_DE. Index: vdr-1.5.8/i18n.c =================================================================== --- vdr-1.5.8/i18n.c +++ vdr-1.5.8/i18n.c 2007-08-19 18:38:54.000000000 +0300 @@ -112,7 +112,7 @@ for (int i = 0; i < Locales.Size(); i++) { cString FileName = cString::sprintf("%s/%s/LC_MESSAGES/vdr.mo", I18nLocaleDir, Locales[i]); if (access(FileName, F_OK) == 0) { // found a locale with VDR texts - if (i < I18N_MAX_LANGUAGES - 1) { + if (NumLocales < I18N_MAX_LANGUAGES) { SetEnvLanguage(Locales[i]); NumLocales++; if (strstr(OldLocale, Locales[i]) == OldLocale)