Hi,

A template is a resource with placeholders. You need to interpolate
its content before serving it to the client.

In the example:
response.renderJavascriptReference(new ResourceReference(MyPage.class,
"my.js", getLocale(), getStyle()));

locale and style are used to load the most specific resource, e.g.
my_en_GB_green.js, where 'green' is a style.
Neither locale nor style are used to manipulate the content of that resource.

To do what you need :
Map<String, String> vars = new HashMap<String, String>() {
  @Override
  public String get(String resourceKey) {
   return MyComponent.this.getString(resourceKey); // or any other
variant of this method (overload)
  }
}

interpolatedTextTemplate = textTemplate.interpolate(vars);
response.renderJavaScript(interpolatedTextTemplate)

On Mon, Mar 19, 2012 at 4:15 AM, Bertrand Guay-Paquet
<ber...@step.polymtl.ca> wrote:
> Yeah I threw that out there in case it also applied to templates. I don't
> know anything about them in Wicket...
>
>
> On 18/03/2012 8:19 PM, infiniter wrote:
>>
>> Oh no.
>> What I need is to be able to support something like the following, but for
>> TEMPLATES, 'cause I want to localize them:
>>  public void renderHead(IHeaderResponse response) {
>>         response.renderJavascriptReference(new ResourceReference(
>>         MyPage.class, "my.js", getLocale(), getStyle()));
>>     }
>>
>> anyone?
>>
>> --
>> View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/support-for-L10N-in-templates-tp4479741p4483475.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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

Reply via email to