Re: QuickForm2: messages and translations
| From: | Christian Weiske | Date: | Wed, 18 May 2011 05:54:11 +0000 |
| Subject: | Re: QuickForm2: messages and translations | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-54283@lists.php.net to get a copy of this message | ||
Hello Alexey,
> Some of the QF2 elements (currently Date and InputFile) have built-in
> translatable messages (weekdays and months lists and upload errors,
> respectively).
>
> I'd really like to have some feedback (especially from Christian) on
> the implementation, this will be useful for custom elements as well,
> so should be well designed.
>
> A couple of questions Bertrand raised:
> 1) Is get() a good enough method name? Won't it lead to name
> conflicts in MessageProvider implementations?
That depends on the message provider implementation. If it's a class
with the single task of translating messages, get() is fine, maybe
even "->_()" like the gettext function is called.
If the class does several things, get() is obviously not the correct
way. By the way, this reminds me of specifying a callback instead of
the message provider object - the method naming problem does not exist
there.
> 2) Is it OK that get() can return an array of messages rather than
> a single message? Of course, if it can only return strings, we'll
> need 12 get() calls in a loop in Date element for getting the month
> names.
I do think so. QF2 could even provide a proxy provider for
simple message providers that don't accept multiple translation
requests at once, while one can always supply a sophisticated one.
--
Regards/Mit freundlichen Grüßen
Christian Weiske
-=≡ Geeking around in the name of science since 1982 ≡=-
Attachment: [application/pgp-signature] signature.asc
Attachment: [application/pgp-signature] signature.asc