Ah, right... we got around that by not using the class (partly so we could
use the same resource strings across different classes).  The only other
thing I can suggest is to use more unique keys for anonymous classes, though
that is clearly not ideal.  Maybe someone else knows a better solution.

On Thu, Apr 22, 2010 at 3:27 AM, Zilvinas Vilutis <cika...@gmail.com> wrote:

> the combination of class, key, locale, style must be unique, so if I
> have the same keys ( while locale and style is not changing ) - the
> classname must be unique. So I cannot use this in anonymous classes,
> as it does not resolve, e.g. page class name
>
>
> Žilvinas Vilutis
>
> Mobile:   (+370) 652 38353
> E-mail:   cika...@gmail.com
>
>
>
> On Wed, Apr 21, 2010 at 1:46 PM, Josh Glassman <josh...@gmail.com> wrote:
> > Not sure what you mean about implementing a unique class... any class
> which
> > inherits from Component can call getString(String key), which will call
> your
> > custom IStringResourceLoader.  Additionally, you can set the locale on
> any
> > MarkupContainer or the Session, and Components will use their parent's
> > locale falling back to the Session's.
> >
> > You can also use the wicket:message tag directly in your markup, which
> uses
> > whatever locale it's associated class uses.
> >
> > What we do is set the locale on the Session, and use that and a resource
> key
> > to pull the string from the database.  We use DB caching, and turn off
> the
> > built-in resource string caching that wicket does (see below, goes in
> > WebApplication.init()).
> >
> > getResourceSettings().setLocalizer(new Localizer() {
> >   @Override
> >   protected void putIntoCache(String cacheKey, String string) {
> >      // Do nothing... no caching desired, since our DB layer caches
> >   }
> > });
> >
> >
> >
> > On Tue, Apr 20, 2010 at 1:53 PM, Zilvinas Vilutis <cika...@gmail.com>
> wrote:
> >
> >> Yes,
> >>
> >> That seems to work. Although each component which needs to be
> >> localized needs to implement a unique class, 'cause in many cases the
> >> Component class is "WebMarkupContainer" ( if we use components in list
> >> & etc ).
> >>
> >> Does anyone have practice on using any performance experience on that?
> >>
> >> Do you use DB caching or method caching?
> >>
> >>
> >> Žilvinas Vilutis
> >>
> >> Mobile:   (+370) 652 38353
> >> E-mail:   cika...@gmail.com
> >>
> >>
> >>
> >> On Tue, Apr 20, 2010 at 7:40 AM, Josh Glassman <josh...@gmail.com>
> wrote:
> >> > Yup, you have the right idea.
> >> >
> >> > Something like...
> >> >    public class DatabaseStringResourceLoader implements
> >> > IStringResourceLoader {...}
> >> >
> >> > And then in your WebApplication.init()...
> >> >    getResourceSettings().addStringResourceLoader(new
> >> > DatabaseStringResourceLoader());
> >> >
> >> > Cheers,
> >> > Josh
> >> >
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to