you are right. i was looking in 1.5 where we have exposed the locale. for the time being you can simply do this: Locale old=session.getlocale(); session.setlocale(foo); localizer.get(..); session.setlocale(old);
-igor On Fri, Oct 28, 2011 at 1:22 PM, Andrew Schetinin <[email protected]> wrote: > Hi Igor, > > But as I said, this method is deprecated and ignores Locale parameter: > > @Deprecated > public String getString(final String key, final Component component, > final IModel<?> model, > final Locale locale, final String style, final String defaultValue) > throws MissingResourceException > { > return getString(key, component, model, defaultValue); > } > > Or am I looking in a wrong place? > > Regards, > > Andrew > > On Fri, Oct 28, 2011 at 8:54 PM, Igor Vaynberg <[email protected]>wrote: > >> Localizer#getString(final String key, final Component component, final >> IModel<?> model, final Locale locale, final String style, final String >> defaultValue) >> >> -igor >> >> On Fri, Oct 28, 2011 at 10:54 AM, Andrew Schetinin <[email protected]> >> wrote: >> > Hi, >> > >> > I have a question about Wicket localization I could not find an answer >> for. >> > >> > I have a component where I'd like to get a translated message for a given >> > key. >> > The actual string is sitting somewhere in a grand-parent panel, and I >> have >> > no any access to it. >> > >> > I'd like to get translations for that key in more than one language (I >> have >> > a list of locale names). >> > >> > It is easy to get a translation for a current locale - >> > component.getLocalizer().getString() would do the job. But Localizer does >> > not help me to get strings for other locales. >> > Once upon a time, there seems to be Localizer.getString() method that >> > accepts Locale, but as I can see now it ignores the locale parameter - >> the >> > method is deprecated in Wicket 1.4.18. >> > >> > There is also ComponentStringResourceLoader that has a method that >> returns a >> > string for a given class and any locale. But the translation string I'm >> > looking for is sitting somewhere up the component hierarchy - I've no >> idea >> > where - so I cannot know the class name. >> > >> > I'd appreciate if somebody could hint what classes and methods to look >> for, >> > and tell me if it is possible at all. >> > >> > Thank you in advance, >> > >> > Andrew >> > >> > -- >> > -- >> > Andrew Schetinin >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > > -- > -- > Andrew Schetinin > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
