Alex,
according to Thiago, you can have string substitution in the javascript:
>>>THIAGO
Another solution is to put a Tapestry expression expansion inside the Javascript code:

Page class:

public Link getEventLink() {
    return componentResources.createXXXLink(parameters);
}

Template:

window.location.href='${eventLink}' + this.cells[1].textContent;
<<<THIAGO

So presumably, you can use "${message:some-message-key}", and it will be translated properly.

I haven't tried this myself, so please let me know if this works.
Ciao,
Jonathan
On 11/02/2009 06:01, Alex Kotchnev wrote:
What is the best method for internationalizing strings inside of .js files
included using the @IncludeJavaScript annotation ? I've looked around and I
see that I can use the regular message catalog and string substitution (e.g.
addScript(String format, Object... arguments);) if the script is attached to
a particular element or something similar. However, if I am including the js
using the @IncludeJavaScript annotation, what is the best approach ? I've
tried (and it works great) to add localized js assets (e.g. foo.js,
foo_bg.js, etc) and the localization works nicely. However, my little hangup
with that is the actual code inside of the js is the same, just the messages
are different. Can I somehow configure T5 to process the js (just like a tml
file) and do message substitution inside (e.g. so that I can use expansions
like ${message:foo-message} inside the js file).

I guess I can also include the js inline in the .tml and the message catalog
substitution would work.

Cheers,

Alex K


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

Reply via email to