Message ID | 46CED532.1000405@cadsoft.de |
---|---|
State | New |
Headers |
Received: from raven.cadsoft.de ([217.7.101.211]) by www.linuxtv.org with esmtp (Exim 4.63) (envelope-from <Klaus.Schmidinger@cadsoft.de>) id 1IOYh2-0005CG-81 for vdr@linuxtv.org; Fri, 24 Aug 2007 14:55:16 +0200 Received: from [192.168.100.10] (hawk.cadsoft.de [192.168.100.10]) by raven.cadsoft.de (8.13.3/8.13.3) with ESMTP id l7OCtE3k002247 for <vdr@linuxtv.org>; Fri, 24 Aug 2007 14:55:14 +0200 Message-ID: <46CED532.1000405@cadsoft.de> Date: Fri, 24 Aug 2007 14:55:14 +0200 From: Klaus Schmidinger <Klaus.Schmidinger@cadsoft.de> Organization: CadSoft Computer GmbH User-Agent: Thunderbird 1.5.0.12 (X11/20060911) MIME-Version: 1.0 To: vdr@linuxtv.org References: <46CD7406.3060003@gmx.de> In-Reply-To: <46CD7406.3060003@gmx.de> Content-Type: text/plain; charset=ISO-8859-1 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (raven.cadsoft.de [192.168.1.1]); Fri, 24 Aug 2007 14:55:15 +0200 (CEST) Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by raven.cadsoft.de id l7OCtE3k002247 Subject: Re: [vdr] translation context handling in vdr >= 1.5.7 X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.9 Precedence: list Reply-To: VDR Mailing List <vdr@linuxtv.org> List-Id: VDR Mailing List <vdr.linuxtv.org> List-Unsubscribe: <http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr>, <mailto:vdr-request@linuxtv.org?subject=unsubscribe> List-Archive: <http://www.linuxtv.org/pipermail/vdr> List-Post: <mailto:vdr@linuxtv.org> List-Help: <mailto:vdr-request@linuxtv.org?subject=help> List-Subscribe: <http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr>, <mailto:vdr-request@linuxtv.org?subject=subscribe> X-List-Received-Date: Fri, 24 Aug 2007 12:55:16 -0000 Status: O X-Status: X-Keywords: X-UID: 13916 |
Commit Message
Klaus Schmidinger
Aug. 24, 2007, 12:55 p.m. UTC
On 08/23/07 13:48, Christian Wieninger wrote: > Hi, > > I just noticed a small change in the context handling of translations > since vdr-1.5.7. Till now it was possible to have e.g. > > const char AllowedChars[] = trNOOP("$ > abcdefghijklmnopqrstuvwxyz0123456789-.,#~\\^$[]|()*+?{}/:%@&"); > > Note the 2 '$'. The first one only helps to have the second one in the > translation and not to be interpreted as context. > > Previous implementations of I18nTranslate did only cut the context of > the english version. So the translation could look like this in i18n.c > or the po-files: > > // The allowed characters in strings: > { "$ abcdefghijklmnopqrstuvwxyz0123456789-.,#~\\^$[]|()*+?{}/:%@&", > " aäbcdefghijklmnoöpqrsßtuüvwxyz0123456789-.,#~\\^$[]|()*+?{}/:%@&", > " abcdefghijklmnopqrstuvwxyz0123456789-.,#~\\^$[]|()*+?{}/:%@&", > ... > > The current implementation cuts the translations too which results in > > "[]|()*+?{}/:%@&" > > Is this intended? If so, one could add the dummy '$' also at the > beginning of the translation, but has to handle this again for backwards > compatibility. > > If it's not intended the following patch should give the previous behaviour: > > --- vdr-1.5.8/i18n.c 2007-08-19 16:10:46.000000000 +0200 > +++ vdr-1.5.8-patched/i18n.c 2007-08-23 12:47:48.000000000 +0200 > @@ -208,10 +208,10 @@ > t = dgettext(Plugin, s); > if (t == s) > t = gettext(s); > - s = t; > + return t; > } > - const char *p = strchr(s, '$'); > - return p ? p + 1 : s; > + else > + return SkipContext(s); > } > > const char *I18nLocale(int Language) gettext() may or may not return the original string, so if no translation is found, the context needs to be stripped. Please try this: Klaus
Comments
Klaus Schmidinger wrote: > On 08/23/07 13:48, Christian Wieninger wrote: >> Hi, >> >> I just noticed a small change in the context handling of translations >> since vdr-1.5.7. Till now it was possible to have e.g. >> >> const char AllowedChars[] = trNOOP("$ >> abcdefghijklmnopqrstuvwxyz0123456789-.,#~\\^$[]|()*+?{}/:%@&"); >> >> Note the 2 '$'. The first one only helps to have the second one in the >> translation and not to be interpreted as context. >> >> Previous implementations of I18nTranslate did only cut the context of >> the english version. So the translation could look like this in i18n.c >> or the po-files: >> >> // The allowed characters in strings: >> { "$ abcdefghijklmnopqrstuvwxyz0123456789-.,#~\\^$[]|()*+?{}/:%@&", >> " aäbcdefghijklmnoöpqrsßtuüvwxyz0123456789-.,#~\\^$[]|()*+?{}/:%@&", >> " abcdefghijklmnopqrstuvwxyz0123456789-.,#~\\^$[]|()*+?{}/:%@&", >> ... >> >> The current implementation cuts the translations too which results in >> >> "[]|()*+?{}/:%@&" >> >> Is this intended? If so, one could add the dummy '$' also at the >> beginning of the translation, but has to handle this again for backwards >> compatibility. >> >> If it's not intended the following patch should give the previous behaviour: [...] > > gettext() may or may not return the original string, so if no translation > is found, the context needs to be stripped. [...] For the record, gettext also has context support: http://www.gnu.org/software/gettext/manual/gettext.html#Contexts But if it needs too many changes, maybe it is not worth it.
On 08/24/07 15:37, Anssi Hannula wrote: > ... > For the record, gettext also has context support: > http://www.gnu.org/software/gettext/manual/gettext.html#Contexts > > But if it needs too many changes, maybe it is not worth it. I thought about that shortly, but decided not to use it. There's not really too much to gain, and it would mean we'd have to touch quite a few places. Klaus
Klaus Schmidinger wrote: > gettext() may or may not return the original string, so if no translation > is found, the context needs to be stripped. > > Please try this: sorry for the late response. gmx seemed to be blacklisted again ;) Works like a charm. BR, Christian
--- i18n.c 2007/08/19 16:03:03 1.313 +++ i18n.c 2007/08/24 12:53:53 @@ -208,10 +208,10 @@ t = dgettext(Plugin, s); if (t == s) t = gettext(s); - s = t; + if (t != s) + return t; } - const char *p = strchr(s, '$'); - return p ? p + 1 : s; + return SkipContext(s); } const char *I18nLocale(int Language)