Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-08 Thread Phil Thompson
On Saturday 08 April 2006 1:05 am, Barry Warsaw wrote: On Sat, 2006-04-08 at 00:45 +0200, Martin v. Löwis wrote: *Never* try to do i18n that way. Don't combine fragments through concatenation. Instead, always use placeholders. Martin is of course absolutely right! If you have many

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-07 Thread Martin v. Löwis
Martin Blais wrote: P(a(Click here to forget, href=... No. That's not going to work: pygettext needs to be able to extract the string for the catalogs. No markup, no extraction. (This is how you enter strings that are not meant to be translated.) I know; I wrote pygettext. You can pass the

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-07 Thread M.-A. Lemburg
Martin Blais wrote: Hi all I got an evil idea for Python this morning -- Guido: no, it's not about linked lists :-) -- , and I'd like to bounce it here. But first, a bit of context. This has been discussed a few times before, see e.g.

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-07 Thread Alexander Schremmer
On Thu, 6 Apr 2006 20:35:51 -0400, Martin Blais wrote: This is pretty standard getttext stuff, if you used _() a lot I'm surprised you don't have a need for N_(), I always needed it when I used i18n (or maybe I misunderstood your question?). Have you thought about simply writing _ = lambda

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-07 Thread Martin Blais
On 4/7/06, Alexander Schremmer [EMAIL PROTECTED] wrote: On Thu, 6 Apr 2006 20:35:51 -0400, Martin Blais wrote: This is pretty standard getttext stuff, if you used _() a lot I'm surprised you don't have a need for N_(), I always needed it when I used i18n (or maybe I misunderstood your

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-07 Thread Martin Blais
On 4/7/06, M.-A. Lemburg [EMAIL PROTECTED] wrote: Martin Blais wrote: Hi all I got an evil idea for Python this morning -- Guido: no, it's not about linked lists :-) -- , and I'd like to bounce it here. But first, a bit of context. This has been discussed a few times before, see

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-07 Thread Martin Blais
On 4/7/06, Martin v. Löwis [EMAIL PROTECTED] wrote: Martin Blais wrote: P(a(Click here to forget, href=... No. That's not going to work: pygettext needs to be able to extract the string for the catalogs. No markup, no extraction. (This is how you enter strings that are not meant to be

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-07 Thread Alexander Schremmer
On Fri, 7 Apr 2006 10:07:26 -0400, Martin Blais wrote: There are cases where you need N_() after initialization, so you need both, really. See the link I sent to Alex earlier (to the GNU manual example). On the page you were referring to, I cannot find a particular use case that does not

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-07 Thread Martin Blais
On 4/7/06, Alexander Schremmer [EMAIL PROTECTED] wrote: On Fri, 7 Apr 2006 10:07:26 -0400, Martin Blais wrote: There are cases where you need N_() after initialization, so you need both, really. See the link I sent to Alex earlier (to the GNU manual example). On the page you were

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-07 Thread Barry Warsaw
On Thu, 2006-04-06 at 11:48 -0400, Martin Blais wrote: - This implies that we would have to introduce some way for these strings to call a custom function at runtime. Yes, definitely. For example, in Mailman we bind _() not to gettext's _() but to a special one that looks up the translation

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-07 Thread Barry Warsaw
On Fri, 2006-04-07 at 13:29 +0200, Alexander Schremmer wrote: Have you thought about simply writing _ = lambda x:x instead of N_ ...? By doing that, you just need to care about one function (of course _ doesn't translate in that case and you might need to del _ afterwards). That's essentially

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-07 Thread Martin v. Löwis
Martin Blais wrote: I'm not sure all the cases are handled, but for those which aren't I can't see why I couldn't hack the pygettext parser to make it do what I want, e.g. is the case were the function contains multiple strings handled? :: P(A_(Status: , get_balance(), dollars, href=

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-07 Thread Barry Warsaw
On Sat, 2006-04-08 at 00:45 +0200, Martin v. Löwis wrote: *Never* try to do i18n that way. Don't combine fragments through concatenation. Instead, always use placeholders. Martin is of course absolutely right! If you have many fragments, the translator gets the challenge of translating

[Python-Dev] The i string-prefix: I18n'ed strings

2006-04-06 Thread Martin Blais
Hi all I got an evil idea for Python this morning -- Guido: no, it's not about linked lists :-) -- , and I'd like to bounce it here. But first, a bit of context. In the context of writing i18n apps, programmers have to mark strings that may be internationalized in a way that - a special hook

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-06 Thread Alex Martelli
On 4/6/06, Martin Blais [EMAIL PROTECTED] wrote: ... So I had the following idea: would it not be nice if there existed a string-prefix 'i' -- a string prefix like for the raw (r'...') and unicode (u'...') strings -- that would mark the string as being for i18n? Something like this

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-06 Thread Martin v. Löwis
Martin Blais wrote: ... A(P(_(Click here to forget), href=... ... I assume that this should be P(A(_(Click here to forget), href=... instead (i.e. href is a parameter to A, not to P) (In my example, I built a library not unlike stan for creating HTML, which is where classes A

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-06 Thread Martin Blais
On 4/6/06, Martin v. Löwis [EMAIL PROTECTED] wrote: Martin Blais wrote: ... A(P(_(Click here to forget), href=... ... I assume that this should be P(A(_(Click here to forget), href=... instead (i.e. href is a parameter to A, not to P) Yeah, that's right, sorry. (You know,

Re: [Python-Dev] The i string-prefix: I18n'ed strings

2006-04-06 Thread Martin Blais
On 4/6/06, Alex Martelli [EMAIL PROTECTED] wrote: On 4/6/06, Martin Blais [EMAIL PROTECTED] wrote: - We could also have a prefix I for strings to be marked but not runtime-translated, to replace the N_() strings. I'm more dubious about this one, because I don't really see the point.