A Diumenge, 10 de juliol de 2011 18:48:46, Cédric Krier va escriure:
> 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.

I don't want to insist much more on this, but I don't see an issue into making 
it based on filename instead of model.

> Also it forget all about the business
> concept.

I don't think I understand you here.

> > - 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.

Will take a look at it to try to find out if it's overkill ;-) 

IMHO, the purpose of a framework is make developer's life easier. One can 
always change "easy" with "lazy" but I think the goal of the framework still 
is to make it easy for developers to create new modules. (Of course it has its 
limits but will try to find out myself how complicated it is in this case).

-- 
Albert Cervera i Areny
http://www.NaN-tic.com
OpenERP Partners
Tel: +34 93 553 18 03

http://twitter.com/albertnan 
http://www.nan-tic.com/blog

-- 
[email protected] mailing list

Reply via email to