4

I have localized resx files that I want to convert to JSON and store in js files (e.g. en-US.js).

What would be an efficient means of converting the resource files to javascript files at each build?

Kappers
  • 1,341
  • 3
  • 15
  • 26
  • Just out of curiousity, why are you wanting to do this? – Fuzzy Analysis Sep 12 '12 at 22:28
  • 1
    So that I can make use of the existing resx files in javascript, without manually maintaining both the resx files and the javascript files. I want to be able to load the file on the client once I have the user's culture and hand it off to some singleton js instance, or a utility like http://i18next.com/ – Kappers Sep 12 '12 at 22:43

1 Answers1

5

Create a t4 template to parse it and output your js files. You could do this via a prebuild.

Get Visual Studio to run a T4 Template on every build

I would do this prebuild and then define a bundle to minify and bundle that folder using asp.net 4.5 bundling API or a third party tool like squishit or Minify etc.

Community
  • 1
  • 1
Adam Tuliper
  • 29,982
  • 4
  • 53
  • 71