How to handle localization in javascript files?
Posted
by Arnis L.
on Stack Overflow
See other posts from Stack Overflow
or by Arnis L.
Published on 2009-07-06T12:53:51Z
Indexed on
2010/03/30
3:33 UTC
Read the original article
Hit count: 352
I want javascript to be separated from views.
Got requirement to implement localization for simple image button generated by JS:
<img src="..." onclick="..." title="Close" />
What's the best technique to localize title of it?
P.s. Found a solution by Ayende. This is the right direction.
Edit:
I got Localization helper class which provides Controller.Resource('foo') extension method.
Thinking about to extend it (helper) so it could return all JavaScript resources (from "ClientSideResources" subfolder in App_LocalResources) for specified controller by it's name.
Then - call it in BaseController, add it to ViewData and render it in Layout.
Would that be a good idea?
© Stack Overflow or respective owner