How to handle localization in javascript files?
- by Arnis L.
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?