Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

T4ResX

Transform ResX files into strongly typed classes via T4

####Consult Documentation

##Download

#Overview

##Have a project that uses ResX files ?

  • Transform ResX files in a project into a strongly typed assembly
  • Access your translations
    • 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 again in your dlls to return localized error messages
    • return Resources.User.RegisterError;

####Use variables inside your ResX files

  • Format various messages
    • .resx: Welcome {0}
      • .cs: return Resources.User.Welcome("Robert")
      • result: Welcome Robert
  • Dynamically replace variables
    • .resx: Register with {DOMAIN}
      • .cs: return Resources.Branding.Register;
      • result: Register with www.i-technology.net
    • .resx: {BRAND} announces new feature for {0}
      • .cs: return Resources.Branding.Feature("T4")
      • result: I-Technology announces new feature for T4

####Export & Reuse your translations

  • Pull translations directly into localized JavaScript files
    • <script src="/GetNameSpaceAsJs?ns=Resources.User"></script>
  • Or assign inline
    • var localized = GetNameSpaceAsJson("Resources.User");
  • Grab a series of translations as collection
    • Dictionary<string, Dictionary<string string>> items = GetResourcesByNameSpace("Resources.User");
  • Or do 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");

##Updates

###0.99 / 2012-12-05

  • First commit.
  • Sample site up on Windows Azure @ t4resx.azurewebsites.net
  • If it's down, it might be normal ..running on a free instance with daily resource limits

About

Transform ResX files into strongly typed classes via T4

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages