On 10/07/11 17:56 +0200, Albert Cervera i Areny wrote: > A Diumenge, 10 de juliol de 2011 13:47:13, Cédric Krier va escriure: > > On 10/07/11 13:39 +0200, Albert Cervera i Areny wrote: > > > A Diumenge, 10 de juliol de 2011 13:21:25, Cédric Krier va escriure: > > > > On 10/07/11 13:11 +0200, Albert Cervera i Areny wrote: > > > > > A Diumenge, 10 de juliol de 2011 12:52:58, Cédric Krier va escriure: > > > > > > On 10/07/11 12:39 +0200, Albert Cervera i Areny wrote: > > > > > > Right now, the translation mechanism gives you the precise place > > > > > > where the string is used but not depending on the position (line) > > > > > > where it is. Also the gettext syntax just doesn't give you the > > > > > > Model from which the string comes. > > > > > > > > > > You're right. As I said, if self.raise_user_error() (or equivalent > > > > > function) accepted the complete string without pre-declaration it > > > > > would do the job for me. > > > > > > > > It will break the fact that right now we know exactly from where comes > > > > the string and it is used for translation. With a gettext-like method, > > > > you loose this and I think it is bad because the same string in > > > > English could have different translation in other languages because of > > > > the usage context. > > > > > > You would with a gettext-like function you would loose that and it > > > wouldn't work, but with a "self.raise_user_error()" function it would > > > work just like > > > > > now. Except for the way strings are extracted: > > No because the script that will extract the strings will not know from > > which Model it comes. > > You're right. I see a couple of solutions for this. I guess you won't like > any > of those, but let me try it ;-) > > - Use standard gettext's application (which will store filename and line) and > move through the stack call to find out who's calling and pick up filename > from > there. (Translations would be filename based instead of model-based).
That's exactly what is bad with the gettext tools and most of the time we got many Model in one py file. Also it forget all about the business concept. > - Write our own script (or whatever) to extract strings and model name too. I find it is overkill to just allow the developpers to be lazy. -- Cédric Krier B2CK SPRL Rue de Rotterdam, 4 4000 Liège Belgium Tel: +32 472 54 46 59 Email/Jabber: [email protected] Website: http://www.b2ck.com/
pgpOKNnSdCOgP.pgp
Description: PGP signature
