Re: Messages translation

"Ksenia Marasanova" <[email protected]>
Newsgroups gmane.comp.python.formencode
Message-ID <[email protected]>
Hi,

On 7/24/06, michelts <[email protected]> wrote:
> Hi guys,
>
> I have a question about translation messages in some validator, now I
> extend the class of validator with the translated messages as above:
>
> >>> from formencode.validators import String
> >>> class String(String):
> ...             messages = {'empty':'Another message reather than the original'}
> ...
> >>>
>
> The problem is that I have to do it to each validator I have. I
> thinking on a idea over message handling on FormEncode, it seems to
> get messages following the sequence above:
>
> - from FancyValidator class
> - from the specific Validator class (suppose String)
> - from an extension of Validator class
> - from the keyword messages of a Validator (os extension of Validator) instance
>
> We could put all standard messages on a single file and remove the
> setting of messages on specific validators, with this I will edit only
> one file to change messages like empty, tooShort, etc. The sequence
> will be:
>
> - from the messages file
> - from the specific Validator class (the validators at validators.py
> will not set messages)
>  - from an extension of the Validator class
> - from the keyword messages of a Validator
>
> What do you think? Any suggestions?


Wouldn't it be more convenient just to replace all messages with
underscore function:
messages = {
        'empty': _("Please enter a value"),
        }

?

Ksenia

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.