On 28.03.2011 23:14, Bernhard Schussek wrote:
> 2011/3/28 Fabien Potencier <[email protected]>:
>> I don't see how this could work. In the validation component, you will need
>> to implement some kind of interface for your translation implementation, but
>> for sure not the interface from the Translation component. How do you
>> integrate the translation component then?
>
> There are two solutions: Either we define a TranslatorInterface,
> MessageInterpolatorInterface or something similar in the Validator
> component and implement an adapter for the Translation component in a
> bridge. Our performance folks won't like the additional method call
> here.
I somehow felt like this was partly aimed at me, so let me answer this
concern :)
// copied from the Translator component
interface MessageInterpolatorInterface
{
function trans($id, array $parameters = array(), $domain = null,
$locale = null);
function transChoice($id, $number, array $parameters = array(),
$domain = null, $locale = null);
}
// in the translator component
class Translator implements TranslatorInterface
{
// implements the interface in Translator
}
// in a bridge - just extend and implement the other interface
// you have a new class that has the correct mask without overhead
class BridgeTranslator extends Translator implements
MessageInterpolatorInterface
{
}
I see no reason this wouldn't work? But I'd still prefer the
Symfony\Component\Interface containing a bunch of general purpose
interfaces.
Cheers
--
Jordi Boggiano
@seldaek :: http://seld.be/
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en