You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Martin Dietze <di...@fh-wedel.de> on 2007/05/31 13:24:08 UTC

T5: Using my own localization backend

Hi,

 I need to use a particular localization backend for my
project. As I understand, T5 provides its own code for
retrieving messages based on the .properties files, and if
I understand Howard's posting from Mar 4 right, simply
plugging in my own ComponentMessageSource implementation
is not yet supported.

Would it make any sense trying to circumvent T5's message
facilities and implement my own which I could access by a
different prefix, i.e. "msg:", or is this complete nonsense?

Cheers,

Martin

-- 
----------- / http://herbert.the-little-red-haired-girl.org / -------------
=+= 
manche meinen, lechts und rinks kann man nicht velwechsern.
werch ein illtum!  -- elnst jandr

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: Using my own localization backend

Posted by Howard Lewis Ship <hl...@gmail.com>.
When you inject a service, Tapestry works primarily by the type (whether its
the type of a field in a component, or the type of a parameter to service
builder method or a constructor).

When resolving, based on type, Tapestry will search all the services defined
by any and all modules, looking for a single service that fits the bill.
That is, a single service whose service interface is assignable to the field
type.  This is often the case, a single interface, a single service.

When you contribute a new service that has the same interface as an existing
service, that creates an ambiguity.  Without additional disambiguating
information, Tapestry is unable to determine which of the two services to
inject.  This is considered an error.

One way to disambiguate is to use @InjectService("ServiceId")  (or the
corresponding @Service annotation on a field in a component). This removes
the ambiguity, but doesn't override the existing service.  Short of hacking
existing service implementation to use @InjectService, you can't get
Tapestry to use your service in the other services it defines.

Alias is used to disambiguate on type.  By making a contribution there, you
are saying "for type foo.bar.Baz, my implementation should be used.".  What
you contribute is usually a service, but can even be an object constructed
on the fly.

In your case, you are trying to override the default ComponentMessageSource,
and need to contribute an AliasContribution so that your CMS will be used
everywhere the built-in CMS is used in a typical Tapestry application.  Your
CMS implementation can even inject the default CMS, using @InjectService.

On 5/31/07, Martin Dietze <di...@fh-wedel.de> wrote:
>
> On Thu, May 31, 2007, SergeEby wrote:
>
> > You can provide your own implementation by contributing to
> aliasOverrides:
> >
> > http://tapestry.apache.org/tapestry5/tapestry-core/guide/alias.html
>
> Thank you for your reply. I took a look at that page, but I do
> not quite understand it. It seems like I lack some a-priori
> knowledge on some of T5's concepts.
>
> Could you give me a quick example and / or some hint on how I
> could facilitate this mechanism for using my own localization
> backend?
>
> Cheers,
>
> Martin
>
> --
> ----------- / http://herbert.the-little-red-haired-girl.org /
> -------------
> =+=
> In an organization, each person rises to the level of his own
> incompetency.
>            -- The Peter Principle
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

Re: T5: Using my own localization backend

Posted by Martin Dietze <di...@fh-wedel.de>.
On Thu, May 31, 2007, SergeEby wrote:

> You can provide your own implementation by contributing to aliasOverrides:
> 
> http://tapestry.apache.org/tapestry5/tapestry-core/guide/alias.html

Thank you for your reply. I took a look at that page, but I do
not quite understand it. It seems like I lack some a-priori
knowledge on some of T5's concepts.

Could you give me a quick example and / or some hint on how I
could facilitate this mechanism for using my own localization
backend?

Cheers,

Martin

-- 
----------- / http://herbert.the-little-red-haired-girl.org / -------------
=+= 
In an organization, each person rises to the level of his own incompetency.
           -- The Peter Principle 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: Using my own localization backend

Posted by SergeEby <sd...@hotmail.com>.
Hi,

You can provide your own implementation by contributing to aliasOverrides:

http://tapestry.apache.org/tapestry5/tapestry-core/guide/alias.html

/Serge


Martin Dietze wrote:
> 
> Hi,
> 
>  I need to use a particular localization backend for my
> project. As I understand, T5 provides its own code for
> retrieving messages based on the .properties files, and if
> I understand Howard's posting from Mar 4 right, simply
> plugging in my own ComponentMessageSource implementation
> is not yet supported.
> 
> Would it make any sense trying to circumvent T5's message
> facilities and implement my own which I could access by a
> different prefix, i.e. "msg:", or is this complete nonsense?
> 
> Cheers,
> 
> Martin
> 
> -- 
> ----------- / http://herbert.the-little-red-haired-girl.org /
> -------------
> =+= 
> manche meinen, lechts und rinks kann man nicht velwechsern.
> werch ein illtum!  -- elnst jandr
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-Using-my-own-localization-backend-tf3845988.html#a10892326
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org