Skip to content
| Marketplace
Sign in
Visual Studio>Templates>T4ResX
T4ResX

T4ResX

Robert Hoffmann

|
2,365 installs
| (0) | Free
T4 Template that transforms ResX files into a strongly typed class.
Download

 

T4ResX will help you localize your models, properties, error messages, html, javascript ..etc, via simple ResX files, by generating a strongly typed assembly that you can then use in any type of project you like (asp.net, mvc, forms, phone ...).

 

This extension adds a item template forT4ResX to Visual Studio, so that you can easily include it in any project at any time.

 

Check out the Wiki for usage instruction & how to exploit helper methods (especially for localized javascript).

 

UPDATE: Recompiled VSIX with VS2010. Will now correctly install in both VS2010 & VS2012. 2012 has a bug where you can declare a VSIX compatible with prior VS products but install will then fail because VS2012 uses a newer and incompatible VSIX format..


Overview

 

Have a project that uses ResX files ?

  • Transform all ResX files in a project into a strongly typed assembly

  • Access your translations directly

    • From inside .cshtml & .aspx files

      • @Resources.User.Pseudo / <%= Resources.User.Pseudo %>
  • Bind your translations to a ViewModel

    • [Display(Name = "Pseudo", ResourceType = typeof(Resources.User))]

  • Use it in your dll's to return localized error messages

    • return Resources.User.RegisterError;

Use variables inside your ResX files

  • Format error messages
    • .resx: Welcome {0}
    • .cs   : return Resources.User.Welcome("Pseudo")
  • Use dynamic variables
    • Register with {DOMAIN}
    • {BRAND} announces new feature for {0}

Export & Reuse your translations

  • Pull translations directly into localized JavaScript files
    • <script src="/GetNameSpaceAsJs?ns=Resources.User"></script>
  • Or assign the object inline
    • var localized = @Utilities.GetNameSpaceAsJson("Resources.User");
  • Grab a series of translations as collection
    • Dictionary<string, Dictionary<string string>> items = GetResourcesByNameSpace("Resources.User");
  • Or just grab bits & pieces
    • Dictionary<string, Dictionary<string string>> items = GetResourcesByNameSpace(".*");
    • Dictionary<string, Dictionary<string string>> items = GetResourcesByNameSpace("Resources.User.*");
    • Dictionary<string, Dictionary<string string>> items = GetResourcesByNameSpace("^User|Branding");
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft