Re: How to get a translated string for an arbitrary locale?

2011-10-29 Thread Andrew Schetinin
Thanks, Igor, it worked.

Regards,

Andrew Schetinin

On Fri, Oct 28, 2011 at 10:45 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote:

 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 ascheti...@gmail.com
 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
 



Re: How to get a translated string for an arbitrary locale?

2011-10-28 Thread Igor Vaynberg
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 ascheti...@gmail.com 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: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to get a translated string for an arbitrary locale?

2011-10-28 Thread Andrew Schetinin
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 igor.vaynb...@gmail.comwrote:

 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 ascheti...@gmail.com
 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: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




-- 
--
Andrew Schetinin


Re: How to get a translated string for an arbitrary locale?

2011-10-28 Thread Igor Vaynberg
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 ascheti...@gmail.com 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 igor.vaynb...@gmail.comwrote:

 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 ascheti...@gmail.com
 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: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




 --
 --
 Andrew Schetinin


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org