├── .gitignore ├── README.md ├── build.cmd ├── build.proj ├── build ├── NuGet.exe └── PsuedoizerConsole.exe ├── docs └── logo │ ├── ProjectIcon.png │ ├── i18n logo.design │ └── i18n logo_250.png └── src ├── Code52.i18n.MVC ├── Code52.i18n.MVC.csproj ├── NuSpec │ ├── Code52.i18n.MVC3.nuspec │ ├── Code52.i18n.MVC4.nuspec │ ├── Content │ │ ├── App_Readme │ │ │ └── Code52.i18n.MVC.readme.txt.pp │ │ ├── App_Start │ │ │ └── AppStart_Code52_i18n.cs.pp │ │ ├── Code52.i18n │ │ │ ├── CultureHelper.cs.pp │ │ │ ├── LanguageFilterAttribute.cs.pp │ │ │ └── LocalizationHelpers.cs.pp │ │ ├── Content │ │ │ └── code52.i18n │ │ │ │ ├── Code52.i18n.css │ │ │ │ └── images │ │ │ │ ├── WorldHeader.png │ │ │ │ ├── bg_regions_international_tile.png │ │ │ │ ├── flags │ │ │ │ ├── de.png │ │ │ │ ├── es.png │ │ │ │ ├── fr.png │ │ │ │ ├── gb.png │ │ │ │ └── it.png │ │ │ │ └── icon_international_map.png │ │ ├── Controllers │ │ │ └── LanguageController.cs.pp │ │ ├── Scripts │ │ │ └── Code52.i18n.js │ │ ├── Views │ │ │ └── Shared │ │ │ │ └── LanguageSelection.ascx │ │ └── web.config.transform │ └── tools │ │ └── install.ps1 └── Properties │ └── AssemblyInfo.cs ├── Code52.i18n.MVC3.Example ├── Code52.i18n.MVC3.Example.csproj ├── NuSpec │ ├── Code52.i18n.MVC3.Example.Razor.nuspec │ ├── Content │ │ ├── App_Start │ │ │ └── ModelMetadataProvider.cs.pp │ │ ├── Controllers │ │ │ ├── AccountController.cs.pp │ │ │ ├── BooksController.cs.pp │ │ │ └── HomeController.cs.pp │ │ ├── Models │ │ │ ├── Accounts │ │ │ │ ├── ChangePasswordModel.cs.pp │ │ │ │ ├── LoginModel.cs.pp │ │ │ │ └── RegisterModel.cs.pp │ │ │ └── Book.cs.pp │ │ ├── Resources │ │ │ ├── Books.Designer.cs.pp │ │ │ ├── Books.resx │ │ │ ├── Language.Designer.cs.pp │ │ │ └── Language.resx │ │ └── Views │ │ │ ├── Account │ │ │ ├── ChangePassword.cshtml.pp │ │ │ ├── ChangePasswordSuccess.cshtml │ │ │ ├── Login.cshtml.pp │ │ │ └── Register.cshtml.pp │ │ │ ├── Books │ │ │ ├── Create.cshtml.pp │ │ │ ├── Delete.cshtml.pp │ │ │ ├── Details.cshtml.pp │ │ │ ├── Edit.cshtml.pp │ │ │ └── Index.cshtml.pp │ │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ └── Index.cshtml │ │ │ └── Shared │ │ │ └── _LoginPartial.cshtml │ └── tools │ │ └── install.ps1 └── Properties │ └── AssemblyInfo.cs ├── Code52.i18n.MVC4.Example ├── Code52.i18n.MVC4.Example.csproj ├── NuSpec │ ├── Code52.i18n.MVC4.Example.Razor.nuspec │ ├── Content │ │ ├── App_Start │ │ │ └── ModelMetadataProvider.cs.pp │ │ ├── Controllers │ │ │ ├── AccountController.cs.pp │ │ │ ├── BooksController.cs.pp │ │ │ └── HomeController.cs.pp │ │ ├── Models │ │ │ ├── Accounts │ │ │ │ ├── ChangePasswordModel.cs.pp │ │ │ │ ├── LoginModel.cs.pp │ │ │ │ └── RegisterModel.cs.pp │ │ │ └── Book.cs.pp │ │ ├── Resources │ │ │ ├── Books.Designer.cs.pp │ │ │ ├── Books.resx │ │ │ ├── Language.Designer.cs.pp │ │ │ └── Language.resx │ │ └── Views │ │ │ ├── Account │ │ │ ├── ChangePassword.cshtml.pp │ │ │ ├── ChangePasswordSuccess.cshtml │ │ │ ├── Login.cshtml.pp │ │ │ └── Register.cshtml.pp │ │ │ ├── Books │ │ │ ├── Create.cshtml.pp │ │ │ ├── Delete.cshtml.pp │ │ │ ├── Details.cshtml.pp │ │ │ ├── Edit.cshtml.pp │ │ │ └── Index.cshtml.pp │ │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ ├── Contact.cshtml │ │ │ └── Index.cshtml │ │ │ └── Shared │ │ │ └── _LoginPartial.cshtml │ └── tools │ │ └── install.ps1 └── Properties │ └── AssemblyInfo.cs ├── Code52.i18n.sln └── Code52.i18n.zreproj /.gitignore: -------------------------------------------------------------------------------- 1 | [Oo]bj/ 2 | [Bb]in/ 3 | *.user 4 | /TestResults 5 | *.vspscc 6 | *.vssscc 7 | deploy 8 | deploy/* 9 | *.suo 10 | *.cache 11 | packages/ 12 | msbuild.log 13 | artifacts/log 14 | artifacts/ 15 | post-build* 16 | _ReSharper.* 17 | deploy-to-ec2* 18 | src/Code52.i18n.MVC4.Sample.CSharp/Scripts/jquery.globalize/* -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Internationalization.MVC4 2 | 3 | ### Goals: 4 | 5 | Provide a collection of packages to help developers get started building globalized and localized application using ASP.NET MVC. 6 | 7 | ### Getting started 8 | 9 | * Read up on the [initial brainstorming](http://sync.in/ltlbzbgOQx) we did for ideas and features. 10 | * Fork the code on [GitHub](https://github.com/Code52/internationalization-mvc4) and have a play! 11 | * Introduce yourself in the [JabbR](http://jabbr.net/#/rooms/code52) room! 12 | * Grab a task from the [Trello](https://trello.com/board/internationalization-mvc4/4f49efbbd105c95e0c12332e) board and get involved! 13 | 14 | ### Possible package structure 15 | 16 | The initial plan is to ship a number of NuGet packages (and sample projects) to allow developers to pull localization features into the app. 17 | 18 | #### Note: this is subject to change 19 | 20 | * **Core** - contains the basics of creating and managing resources and consuming them in DataAnnotations and Views. Includes some tricks to ensure your app respects the culture sent from the user's browser to the server. 21 | * **Testing** - demonstrating how to test the use of resources in an app 22 | * **Browser** - extending localization to the browser and allowing the user to override the culture. 23 | 24 | Other packages under consideration: 25 | 26 | * **jQueryUI Sample Site** - how to localize UI controls which leverage jQuery and jQuery UI. 27 | * **KendoUI Sample Site** - how to localize UI controls from the Kendo UI library. -------------------------------------------------------------------------------- /build.cmd: -------------------------------------------------------------------------------- 1 | @echo Off 2 | SETLOCAL 3 | SET NUGET=build\nuget.exe 4 | 5 | set config=%1 6 | if "%config%" == "" ( 7 | set config=Debug 8 | ) 9 | set version=%2 10 | if "%version%" == "" ( 11 | set version=0.1.12 12 | ) 13 | 14 | %WINDIR%\Microsoft.NET\Framework\v4.0.30319\msbuild build.proj /p:Configuration="%config%" /m /v:M /fl /flp:LogFile=msbuild.log;Verbosity=Normal /nr:false 15 | 16 | rmdir artifacts /S /Q 17 | mkdir artifacts 18 | 19 | .\build\nuget.exe pack src\Code52.i18n.MVC\NuSpec\Code52.i18n.MVC3.nuspec -Version %VERSION% -OutputDirectory artifacts 20 | .\build\nuget.exe pack src\Code52.i18n.MVC\NuSpec\Code52.i18n.MVC4.nuspec -Version %VERSION% -OutputDirectory artifacts 21 | .\build\nuget.exe pack src\Code52.i18n.MVC3.Example\NuSpec\Code52.i18n.MVC3.Example.Razor.nuspec -Version %VERSION% -OutputDirectory artifacts 22 | .\build\nuget.exe pack src\Code52.i18n.MVC4.Example\NuSpec\Code52.i18n.MVC4.Example.Razor.nuspec -Version %VERSION% -OutputDirectory artifacts -------------------------------------------------------------------------------- /build.proj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | .\ 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /build/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code52/internationalization-mvc4/50d81ecd491697484490e9913f9cc97df671f454/build/NuGet.exe -------------------------------------------------------------------------------- /build/PsuedoizerConsole.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code52/internationalization-mvc4/50d81ecd491697484490e9913f9cc97df671f454/build/PsuedoizerConsole.exe -------------------------------------------------------------------------------- /docs/logo/ProjectIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code52/internationalization-mvc4/50d81ecd491697484490e9913f9cc97df671f454/docs/logo/ProjectIcon.png -------------------------------------------------------------------------------- /docs/logo/i18n logo.design: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code52/internationalization-mvc4/50d81ecd491697484490e9913f9cc97df671f454/docs/logo/i18n logo.design -------------------------------------------------------------------------------- /docs/logo/i18n logo_250.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code52/internationalization-mvc4/50d81ecd491697484490e9913f9cc97df671f454/docs/logo/i18n logo_250.png -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/Code52.i18n.MVC.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {EFA9A1CD-06FF-41EC-9B2B-BA5EE890D2A5} 9 | Library 10 | Properties 11 | Code52.i18n.MVC 12 | Code52.i18n.MVC 13 | v4.0 14 | 512 15 | ..\ 16 | true 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | Designer 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | Designer 74 | 75 | 76 | 77 | 84 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Code52.i18n.MVC3.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0.1 5 | bforster,dchristiansen 6 | bforster,dchristiansen 7 | http://code52.org/internationalization-mvc4 8 | https://github.com/DavidChristiansen/internationalization-mvc4/raw/master/docs/logo/ProjectIcon.png 9 | 10 | 11 | 12 | 13 | 14 | 15 | Code52.i18n.MVC3 16 | ASP.NET Internationalisation (i18n) for MVC3 17 | false 18 | A core package to create an internationalization-ready web application 19 | 20 | Initial release 21 | localization globalization MVC MVC3 ASP.NET Web i18n l10n 22 | 23 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Code52.i18n.MVC4.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0.1 5 | bforster,dchristiansen 6 | bforster,dchristiansen 7 | http://code52.org/internationalization-mvc4 8 | https://github.com/DavidChristiansen/internationalization-mvc4/raw/master/docs/logo/ProjectIcon.png 9 | 10 | 11 | 12 | 13 | 14 | 15 | Code52.i18n.MVC4 16 | ASP.NET Internationalisation (i18n) for MVC4 17 | false 18 | A core package to create an internationalization-ready web application 19 | 20 | Initial release 21 | localization globalization MVC MVC4 ASP.NET Web i18n l10n 22 | 23 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/App_Readme/Code52.i18n.MVC.readme.txt.pp: -------------------------------------------------------------------------------- 1 | [Code52.i18n] - ASP.NET Internationalisation for MVC 2 | 3 | -- About Code52 i18n -- 4 | The purpose of the Code52 i18n project is to provide an easy way to implement localisation support 5 | to ASP.NET project. We currently have a reference implementation for MVC3 Razor and MVC4 Razor. 6 | 7 | -- About Code52 -- 8 | We want to build fun stuff in our spare time, give back to projects which need support, and create a community which is inclusive and engaging. 9 | 10 | Find out more about Code52 on their website http://code52.org/ 11 | 12 | -- Getting Started -- 13 | 14 | ::::::::::::::::::::::::::::::: 15 | 1. Create a Language resource file 16 | ::::::::::::::::::::::::::::::: 17 | 18 | Applications need to have at least one resource (resx) file to tracks the base text and translations. 19 | 20 | To add a resource file, right-click in a folder and select "Add | New Item". 21 | In the dialog box, select General from the left-hand menu and then "Resources File". 22 | 23 | Ensure that "Strings" is selected in the top-left combo box. This will give you a list of name-value pairs 24 | which you can edit and create - these will be accessible from code. 25 | 26 | If your resource file should be visible to other projects, set the "Access Modifier" value to "Public". 27 | 28 | ::::::::::::::::::::::::::::::: 29 | 2. Add reference to language selection UserControl 30 | ::::::::::::::::::::::::::::::: 31 | 32 | Add the following reference to a page / layout that you wish to display the language selection options to the user. 33 | 34 | @Html.Partial("LanguageSelection") 35 | 36 | 37 | ::::::::::::::::::::::::::::::: 38 | 3. Update your site layout 39 | ::::::::::::::::::::::::::::::: 40 | 41 | 42 | Instructions 43 | ------------ 44 | 45 | Add this using statement to the top of your Razor file to reference the CultureHelper class: 46 | 47 | @using $rootnamespace$.Code52.i18n 48 | 49 | 50 | Before the closing tag reference a stylesheet to for the language selection page: 51 | 52 | 53 | 54 | 55 | 56 | Before the closing tag of your page, add the following scripts to set up the localisation and validation: 57 | 58 | 59 | 60 | 61 | 62 | @if (CultureHelper.GetCurrentNeutralCulture() != "en") 63 | { 64 | 65 | } 66 | 67 | 68 | 71 | 72 | 73 | If you're not sure how it should look, here's one we prepared earlier: 74 | 75 | https://gist.github.com/2028204 76 | 77 | 78 | 79 | Explanation 80 | ------------ 81 | 82 | 83 | 84 | This is the reference to the javascript that handles the language selection control and initialises localisation within javascript. 85 | 86 | 87 | 88 | This references the MVC action that generates a Javascript object from the Language resource file. 89 | 90 | 93 | 94 | This statement initialises localisation for the current culture. -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/App_Start/AppStart_Code52_i18n.cs.pp: -------------------------------------------------------------------------------- 1 | [assembly: WebActivator.PreApplicationStartMethod(typeof($rootnamespace$.App_Start.Code52_i18n), "Start")] 2 | namespace $rootnamespace$.App_Start { 3 | 4 | using System.Web.Mvc; 5 | using System.Web.Routing; 6 | using Code52.i18n; 7 | 8 | public class Code52_i18n { 9 | public static void Start() { 10 | RouteTable.Routes.MapRoute("Language", "i18n/Code52.i18n.language.js", new { controller = "Language", action = "Language" }); 11 | GlobalFilters.Filters.Add(new LanguageFilterAttribute()); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Code52.i18n/CultureHelper.cs.pp: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$.Code52.i18n 2 | { 3 | using System; 4 | using System.Collections.Concurrent; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Threading; 8 | 9 | public static class CultureHelper { 10 | private static readonly IList _validCultures = new List { "af", "af-ZA", "sq", "sq-AL", "gsw-FR", "am-ET", "ar", "ar-DZ", "ar-BH", "ar-EG", "ar-IQ", "ar-JO", "ar-KW", "ar-LB", "ar-LY", "ar-MA", "ar-OM", "ar-QA", "ar-SA", "ar-SY", "ar-TN", "ar-AE", "ar-YE", "hy", "hy-AM", "as-IN", "az", "az-Cyrl-AZ", "az-Latn-AZ", "ba-RU", "eu", "eu-ES", "be", "be-BY", "bn-BD", "bn-IN", "bs-Cyrl-BA", "bs-Latn-BA", "br-FR", "bg", "bg-BG", "ca", "ca-ES", "zh-HK", "zh-MO", "zh-CN", "zh-Hans", "zh-SG", "zh-TW", "zh-Hant", "co-FR", "hr", "hr-HR", "hr-BA", "cs", "cs-CZ", "da", "da-DK", "prs-AF", "div", "div-MV", "nl", "nl-BE", "nl-NL", "en", "en-AU", "en-BZ", "en-CA", "en-029", "en-IN", "en-IE", "en-JM", "en-MY", "en-NZ", "en-PH", "en-SG", "en-ZA", "en-TT", "en-GB", "en-US", "en-ZW", "et", "et-EE", "fo", "fo-FO", "fil-PH", "fi", "fi-FI", "fr", "fr-BE", "fr-CA", "fr-FR", "fr-LU", "fr-MC", "fr-CH", "fy-NL", "gl", "gl-ES", "ka", "ka-GE", "de", "de-AT", "de-DE", "de-LI", "de-LU", "de-CH", "el", "el-GR", "kl-GL", "gu", "gu-IN", "ha-Latn-NG", "he", "he-IL", "hi", "hi-IN", "hu", "hu-HU", "is", "is-IS", "ig-NG", "id", "id-ID", "iu-Latn-CA", "iu-Cans-CA", "ga-IE", "xh-ZA", "zu-ZA", "it", "it-IT", "it-CH", "ja", "ja-JP", "kn", "kn-IN", "kk", "kk-KZ", "km-KH", "qut-GT", "rw-RW", "sw", "sw-KE", "kok", "kok-IN", "ko", "ko-KR", "ky", "ky-KG", "lo-LA", "lv", "lv-LV", "lt", "lt-LT", "wee-DE", "lb-LU", "mk", "mk-MK", "ms", "ms-BN", "ms-MY", "ml-IN", "mt-MT", "mi-NZ", "arn-CL", "mr", "mr-IN", "moh-CA", "mn", "mn-MN", "mn-Mong-CN", "ne-NP", "no", "nb-NO", "nn-NO", "oc-FR", "or-IN", "ps-AF", "fa", "fa-IR", "pl", "pl-PL", "pt", "pt-BR", "pt-PT", "pa", "pa-IN", "quz-BO", "quz-EC", "quz-PE", "ro", "ro-RO", "rm-CH", "ru", "ru-RU", "smn-FI", "smj-NO", "smj-SE", "se-FI", "se-NO", "se-SE", "sms-FI", "sma-NO", "sma-SE", "sa", "sa-IN", "sr", "sr-Cyrl-BA", "sr-Cyrl-SP", "sr-Latn-BA", "sr-Latn-SP", "nso-ZA", "tn-ZA", "si-LK", "sk", "sk-SK", "sl", "sl-SI", "es", "es-AR", "es-BO", "es-CL", "es-CO", "es-CR", "es-DO", "es-EC", "es-SV", "es-GT", "es-HN", "es-MX", "es-NI", "es-PA", "es-PY", "es-PE", "es-PR", "es-ES", "es-US", "es-UY", "es-VE", "sv", "sv-FI", "sv-SE", "syr", "syr-SY", "tg-Cyrl-TJ", "tzm-Latn-DZ", "ta", "ta-IN", "tt", "tt-RU", "te", "te-IN", "th", "th-TH", "bo-CN", "tr", "tr-TR", "tk-TM", "ug-CN", "uk", "uk-UA", "wen-DE", "ur", "ur-PK", "uz", "uz-Cyrl-UZ", "uz-Latn-UZ", "vi", "vi-VN", "cy-GB", "wo-SN", "sah-RU", "ii-CN", "yo-NG" }; 11 | private static readonly IList _cultures = new List { 12 | "en-GB", // first culture is the DEFAULT 13 | "fr", 14 | "pl" 15 | }; 16 | private static readonly ConcurrentDictionary _getImplementedCultureCache = new ConcurrentDictionary(); 17 | 18 | public static string GetImplementedCulture(string name) { 19 | if (string.IsNullOrEmpty(name)) 20 | return GetDefaultCulture(); // return Default culture 21 | if (_getImplementedCultureCache.ContainsKey(name)) 22 | return _getImplementedCultureCache[name]; // we have worked this out before and cached the result. Send it back. 23 | if (_validCultures.Count(c => c.Equals(name, StringComparison.InvariantCultureIgnoreCase)) == 0) 24 | return CacheCulture(name, GetDefaultCulture()); // return Default culture if it is invalid 25 | if (_cultures.Count(c => c.Equals(name, StringComparison.InvariantCultureIgnoreCase)) > 0) 26 | return CacheCulture(name, name); // accept it 27 | var n = GetNeutralCulture(name); 28 | foreach (var c in _cultures) 29 | if (c.StartsWith(n)) 30 | return CacheCulture(name, c); 31 | return CacheCulture(name, GetDefaultCulture()); // return Default culture as no match found 32 | } 33 | 34 | private static string CacheCulture(string originalName, string implementedName) 35 | { 36 | _getImplementedCultureCache.AddOrUpdate(originalName, implementedName, (_, __) => implementedName); 37 | return implementedName; 38 | } 39 | 40 | public static string GetDefaultCulture() { 41 | return _cultures[0]; // return Default culture 42 | 43 | } 44 | 45 | public static string GetCurrentCulture() { 46 | return Thread.CurrentThread.CurrentCulture.Name; 47 | } 48 | 49 | public static string GetCurrentNeutralCulture() { 50 | return GetNeutralCulture(Thread.CurrentThread.CurrentCulture.Name); 51 | } 52 | 53 | public static string GetNeutralCulture(string name) { 54 | if (name.Length < 2) 55 | return name; 56 | 57 | return name.Substring(0, 2); // Read first two chars only. E.g. "en", "es" 58 | } 59 | 60 | } 61 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Code52.i18n/LanguageFilterAttribute.cs.pp: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$.Code52.i18n 2 | { 3 | using System.Threading; 4 | using System.Web.Mvc; 5 | 6 | public class LanguageFilterAttribute : ActionFilterAttribute 7 | { 8 | public override void OnActionExecuting(ActionExecutingContext filterContext) 9 | { 10 | var request = filterContext.HttpContext.Request; 11 | string cultureName = null; 12 | var cultureCookie = request.Cookies["_culture"]; 13 | if (request.UserLanguages != null) 14 | cultureName = cultureCookie != null ? cultureCookie.Value : request.UserLanguages[0]; 15 | cultureName = CultureHelper.GetImplementedCulture(cultureName); // This is safe 16 | Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(cultureName); 17 | Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture; 18 | 19 | base.OnActionExecuting(filterContext); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Code52.i18n/LocalizationHelpers.cs.pp: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$.Code52.i18n 2 | { 3 | using System; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | public static class LocalizationHelpers { 8 | public static IHtmlString MetaAcceptLanguage(this HtmlHelper html) { 9 | var acceptLanguage = HttpUtility.HtmlAttributeEncode(System.Threading.Thread.CurrentThread.CurrentUICulture.ToString()); 10 | return new HtmlString(String.Format("", acceptLanguage)); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/Code52.i18n.css: -------------------------------------------------------------------------------- 1 |  2 | 3 | #languageselection 4 | { 5 | } 6 | #languages 7 | { 8 | margin-top: 5px; 9 | display: none; 10 | padding-top: 10px; 11 | padding-left: 10px; 12 | padding-right: 10px; 13 | height: 40px; 14 | background-color: #efefef; 15 | } 16 | #languages h4 17 | { 18 | letter-spacing: normal; 19 | font-family: "Segoe UI" ,Candara, "Bitstream Vera Sans" , "DejaVu Sans" , "Bitstream Vera Sans" , "Trebuchet MS" ,Verdana, "Verdana Ref" ,sans serif; 20 | font-size: 11px; 21 | text-transform: capitalize; 22 | font-weight: bold; 23 | color: #606060; 24 | margin-top: -7px; 25 | } 26 | #languages UL 27 | { 28 | margin-left: -40px; 29 | list-style: none; 30 | display: block; 31 | padding-top: 5px; 32 | } 33 | #languages LI 34 | { 35 | float: left; 36 | border-right: 1px dotted #cecece; 37 | padding-right: 5px; 38 | margin-right: 5px; 39 | margin-top: -16px; 40 | } 41 | #languages LI:last-child 42 | { 43 | border-right: none; 44 | } 45 | .language 46 | { 47 | padding-bottom: 2px; 48 | background-position: left; 49 | background-repeat: no-repeat; 50 | margin-left: 5px; 51 | padding-left: 20px; 52 | text-align: left; 53 | } 54 | #currentlanguageSelection 55 | { 56 | margin-left: 15px; 57 | } 58 | .language A 59 | { 60 | line-height: 10px; 61 | font-family: "Segoe UI" ,Candara, "Bitstream Vera Sans" , "DejaVu Sans" , "Bitstream Vera Sans" , "Trebuchet MS" ,Verdana, "Verdana Ref" , "sans serif"; 62 | font-size: 12px; 63 | } 64 | 65 | #currentlanguage 66 | { 67 | padding: 5px; 68 | } 69 | #currentlanguageSelection_icon 70 | { 71 | float: left; 72 | margin-top: 2px; 73 | } 74 | #i18n-options-container 75 | { 76 | border-radius: 5px 5px 5px 5px; 77 | } 78 | #i18n-options a 79 | { 80 | } 81 | #i18n-options 82 | { 83 | background: url("/content/code52.i18n/images/icon_international_map.png") no-repeat scroll right 0px transparent; 84 | z-index: 1000; 85 | padding-right: 55px; 86 | width:65px; 87 | text-align: right; 88 | } 89 | #i18n-options span 90 | { 91 | } 92 | 93 | #i18n-regions 94 | { 95 | background: url("/content/code52.i18n/images/worldheader.png") no-repeat scroll 0 0 transparent; 96 | height: 100px; 97 | margin: 0 auto; 98 | position: relative; 99 | width: 900px; 100 | display: none; 101 | } 102 | #i18n-regions h4 103 | { 104 | height: 25px; 105 | left: 190px; 106 | position: absolute; 107 | top: 15px; 108 | width: 160px; 109 | } 110 | #i18n-regions ul 111 | { 112 | left: 400px; 113 | list-style: none outside none; 114 | margin: 0; 115 | padding: 0; 116 | position: absolute; 117 | top: 0; 118 | } 119 | #i18n-regions li 120 | { 121 | background: none repeat scroll 0 0 transparent; 122 | color: #FFFFFF; 123 | float: left; 124 | font-size: 12px; 125 | font-weight: normal; 126 | list-style: none outside none; 127 | margin: 18px 2.5em 0 0; 128 | padding: 0; 129 | text-transform: uppercase; 130 | } 131 | #i18n-regions ol 132 | { 133 | display: block; 134 | list-style: square inside none; 135 | margin: 0; 136 | padding: 0; 137 | } 138 | #i18n-regions li.lang 139 | { 140 | background: none repeat scroll 0 0 transparent; 141 | font-size: 11px; 142 | font-weight: normal; 143 | line-height: 15px; 144 | list-style: none outside none; 145 | margin: 0 5px 0 0; 146 | padding: 0; 147 | text-transform: none; 148 | white-space: nowrap; 149 | } 150 | #i18n-regions li.lang a 151 | { 152 | color: white; 153 | } 154 | #placeholder-regions 155 | { 156 | background: url("/content/code52.i18n/images/bg_regions_international_tile.png") repeat-x scroll 0 0 transparent; 157 | } 158 | .language 159 | { 160 | background-position: left 7px; 161 | background-repeat: no-repeat; 162 | margin-left: 5px; 163 | padding-left: 20px; 164 | text-align: left; 165 | } 166 | #currentlanguageSelection 167 | { 168 | margin-left: 15px; 169 | } 170 | .language A 171 | { 172 | line-height: 10px; 173 | } 174 | .language_EN 175 | { 176 | background-image: url(/content/code52.i18n/images/flags/gb.png); 177 | } 178 | .language_IT 179 | { 180 | background-image: url(/content/code52.i18n/images/flags/it.png); 181 | } 182 | .language_FR 183 | { 184 | background-image: url(/content/code52.i18n/images/flags/fr.png); 185 | } 186 | .language_ES 187 | { 188 | background-image: url(/content/code52.i18n/images/flags/es.png); 189 | } 190 | .language_DE 191 | { 192 | background-image: url(/content/code52.i18n/images/flags/de.png); 193 | } 194 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/WorldHeader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code52/internationalization-mvc4/50d81ecd491697484490e9913f9cc97df671f454/src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/WorldHeader.png -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/bg_regions_international_tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code52/internationalization-mvc4/50d81ecd491697484490e9913f9cc97df671f454/src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/bg_regions_international_tile.png -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/flags/de.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code52/internationalization-mvc4/50d81ecd491697484490e9913f9cc97df671f454/src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/flags/de.png -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/flags/es.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code52/internationalization-mvc4/50d81ecd491697484490e9913f9cc97df671f454/src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/flags/es.png -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/flags/fr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code52/internationalization-mvc4/50d81ecd491697484490e9913f9cc97df671f454/src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/flags/fr.png -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/flags/gb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code52/internationalization-mvc4/50d81ecd491697484490e9913f9cc97df671f454/src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/flags/gb.png -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/flags/it.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code52/internationalization-mvc4/50d81ecd491697484490e9913f9cc97df671f454/src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/flags/it.png -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/icon_international_map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Code52/internationalization-mvc4/50d81ecd491697484490e9913f9cc97df671f454/src/Code52.i18n.MVC/NuSpec/Content/Content/code52.i18n/images/icon_international_map.png -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Controllers/LanguageController.cs.pp: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$.Controllers 2 | { 3 | using System; 4 | using System.Collections; 5 | using System.Globalization; 6 | using System.Resources; 7 | using System.Text; 8 | using System.Web; 9 | using System.Web.Mvc; 10 | 11 | [OutputCache(Duration = 60, VaryByCustom = "culture")] 12 | public class LanguageController : Controller 13 | { 14 | public RedirectResult Change(string customer, string token, string language) 15 | { 16 | if (string.IsNullOrWhiteSpace(language)) 17 | Response.Redirect("/", true); 18 | if (!string.IsNullOrWhiteSpace(language)) 19 | { 20 | switch (language.ToLower()) 21 | { 22 | case "fr": 23 | SetCulture("fr"); 24 | break; 25 | case "pl": 26 | SetCulture("pl"); 27 | break; 28 | case "en-US": 29 | SetCulture("en-US"); 30 | break; 31 | default: 32 | SetCulture("en-GB"); 33 | break; 34 | } 35 | } 36 | return new RedirectResult(string.Format("/{0}/{1}/verify", customer, token)); 37 | } 38 | 39 | protected void SetCulture(string name) 40 | { 41 | var cultureCookie = Request.Cookies["_culture"] ?? new HttpCookie("_culture"); 42 | cultureCookie.Value = name; 43 | // NOTE: you should specify the domain for the cookie. 44 | // cultureCookie.Domain = Request.Url.Host; 45 | cultureCookie.Expires = DateTime.Now.AddYears(1); 46 | cultureCookie.Path = "/"; 47 | Response.Cookies.Add(cultureCookie); 48 | } 49 | 50 | public JavaScriptResult Language() 51 | { 52 | return GetResourceScript(Resources.Language.ResourceManager); 53 | } 54 | 55 | JavaScriptResult GetResourceScript(ResourceManager resourceManager) 56 | { 57 | var cacheName = string.Format("ResourceJavaScripter.{0}", CultureInfo.CurrentCulture.Name); 58 | var value = HttpRuntime.Cache.Get(cacheName) as JavaScriptResult; 59 | if (value == null) 60 | { 61 | JavaScriptResult javaScriptResult = CreateResourceScript(resourceManager); 62 | HttpContext.Cache.Insert(cacheName, javaScriptResult); 63 | return javaScriptResult; 64 | } 65 | return value; 66 | } 67 | 68 | static JavaScriptResult CreateResourceScript(ResourceManager resourceManager) 69 | { 70 | var resourceSet = resourceManager.GetResourceSet(CultureInfo.CurrentCulture, true, true); 71 | var sb = new StringBuilder("Code52.Language.Dictionary={"); 72 | foreach (DictionaryEntry dictionaryEntry in resourceSet) 73 | { 74 | var s = dictionaryEntry.Value as string; 75 | if (s == null) 76 | { 77 | continue; 78 | } 79 | string value = resourceSet.GetString((string)dictionaryEntry.Key) ?? s; 80 | sb.AppendFormat("\"{0}\":\"{1}\",", dictionaryEntry.Key, Microsoft.Security.Application.Encoder.JavaScriptEncode(value.Replace("\"", "\\\"").Replace('{', '[').Replace('}', ']'), false)); 81 | } 82 | string script = sb.ToString(); 83 | if (!string.IsNullOrEmpty(script)) 84 | { 85 | script = script.Remove(script.Length - 1); 86 | } 87 | script += "};"; 88 | return new JavaScriptResult { Script = script }; 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Scripts/Code52.i18n.js: -------------------------------------------------------------------------------- 1 | (function (window, undefined) { 2 | var i18n = function () { 3 | var base = this; 4 | base.init = function () { 5 | base.lang.init(); 6 | } 7 | base.lang = { 8 | settings: { 9 | placeholderregionsID: '#placeholder-regions', 10 | langOptionsContainerID: '#i18n-options-container', 11 | langOptionsRegionsID: '#i18n-regions', 12 | currentLanguage_Link: '#currentlanguage_link', 13 | currentLanguage_Text: '#currentlanguage_text' 14 | }, 15 | init: function () { 16 | 17 | $(base.lang.settings.currentLanguage_Link).attr('title', Globalize.culture().nativeName); 18 | $(base.lang.settings.currentLanguage_Text).html(Globalize.culture().nativeName); 19 | $(base.lang.settings.langOptionsContainerID).hover(function () { 20 | $(this).stop().animate({ backgroundColor: '#E4EBF4' }); 21 | }, function () { 22 | $(this).stop().animate({ backgroundColor: 'white' }); 23 | }); 24 | $(base.lang.settings.langOptionsContainerID).toggle(function () { 25 | $(base.lang.settings.langOptionsRegionsID) 26 | .remove() 27 | .prependTo(base.lang.settings.placeholderregionsID).slideToggle('swing'); 28 | $('.language a').click(function () { 29 | if ($(this).hasClass(Globalize.culture().name.toLowerCase())) 30 | return false; 31 | $.cookie("_culture", $(this).attr("class"), { expires: 365, path: '/' /*, domain: 'example.com' */ }); 32 | window.location.reload(); // reload 33 | return false; 34 | }); 35 | $("#expandSign").html('[−]'); 36 | }, function () { 37 | $(base.lang.settings.langOptionsRegionsID).slideToggle('swing'); 38 | $("#expandSign").html('[+]'); 39 | }); 40 | } 41 | }; 42 | base.init(); 43 | }; 44 | window.Code52 = {}; 45 | window.Code52.Language = { 46 | instance: null, 47 | defaults: { 48 | }, 49 | Init: function (culture) { 50 | Globalize.culture(culture); 51 | instance = new i18n(); 52 | } 53 | }; 54 | })(window); -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/Views/Shared/LanguageSelection.ascx: -------------------------------------------------------------------------------- 1 | <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> 2 |
3 |
4 |
5 |
6 | 7 |  [+] 8 |
9 |
10 |
    11 |
  • Languages 12 |
      13 |
    1. 14 |
      15 | English 16 |
      17 |
    2. 18 |
    3. 19 |
      20 | Français 21 |
      22 |
    4. 23 |
    5. 24 |
      25 | Polish 26 |
      27 |
    6. 28 |
    29 |
  • 30 |
31 |
32 |
-------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/Content/web.config.transform: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/NuSpec/tools/install.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | $path = [System.IO.Path] 3 | $readmefile = $path::Combine($path::GetDirectoryName($project.FileName), "App_Readme\Code52.i18n.MVC.readme.txt") 4 | $DTE.ItemOperations.OpenFile($readmefile) -------------------------------------------------------------------------------- /src/Code52.i18n.MVC/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Code52.i18n.MVC")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Code52.i18n.MVC")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("83300f07-1689-4581-a75d-72ef6d8d225c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/Code52.i18n.MVC3.Example.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {AB508CF3-5988-4275-B29F-3E192836F166} 9 | Library 10 | Properties 11 | Code52.i18n.MVC3.Example 12 | Code52.i18n.MVC3.Example 13 | v4.0 14 | 512 15 | ..\ 16 | true 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | Designer 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 82 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Code52.i18n.MVC3.Example.Razor.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code52.i18n.MVC3.Sample.Razor 5 | 0.1 6 | ASP.NET Internationalisation (i18n) Sample for MVC3 7 | bforster, dchristiansen 8 | bforster, dchristiansen 9 | false 10 | http://code52.org/internationalization-mvc4 11 | https://github.com/DavidChristiansen/internationalization-mvc4/raw/master/docs/logo/ProjectIcon.png 12 | Sample implementation of i18n package 13 | A sample implementation of the [Code52] ASP.NET Internationalisation (i18n) package for MVC3 14 | localization globalization MVC MVC3 ASP.NET Web i18n l10n 15 | 16 | 17 | 18 | 19 | Initial release 20 | 21 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/App_Start/ModelMetadataProvider.cs.pp: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | using $rootnamespace$.Resources; 3 | using ModelMetadataExtensions; 4 | 5 | [assembly: WebActivator.PreApplicationStartMethod(typeof($rootnamespace$.App_Start.ModelMetadataProvider), "Start")] 6 | namespace $rootnamespace$.App_Start 7 | { 8 | public static class ModelMetadataProvider 9 | { 10 | public static void Start() 11 | { 12 | ModelMetadataProviders.Current = new ConventionalModelMetadataProvider(false, typeof(Language)); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Controllers/AccountController.cs.pp: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$.Controllers 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Web.Mvc; 7 | using System.Web.Security; 8 | 9 | using $rootnamespace$.Models.Accounts; 10 | 11 | public class AccountController : Controller { 12 | 13 | // 14 | // GET: /Account/Login 15 | 16 | public ActionResult Login() 17 | { 18 | return View(); 19 | } 20 | 21 | // 22 | // POST: /Account/Login 23 | 24 | [HttpPost] 25 | public ActionResult Login(LoginModel model, string returnUrl) 26 | { 27 | if (ModelState.IsValid) 28 | { 29 | if (Membership.ValidateUser(model.UserName, model.Password)) 30 | { 31 | FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); 32 | if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") 33 | && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) 34 | { 35 | return Redirect(returnUrl); 36 | } 37 | else 38 | { 39 | return RedirectToAction("Index", "Home"); 40 | } 41 | } 42 | else 43 | { 44 | ModelState.AddModelError("", "The user name or password provided is incorrect."); 45 | } 46 | } 47 | 48 | // If we got this far, something failed, redisplay form 49 | return View(model); 50 | } 51 | 52 | // 53 | // GET: /Account/LogOff 54 | 55 | public ActionResult LogOff() 56 | { 57 | FormsAuthentication.SignOut(); 58 | 59 | return RedirectToAction("Index", "Home"); 60 | } 61 | 62 | // 63 | // GET: /Account/Register 64 | 65 | public ActionResult Register() 66 | { 67 | return View(); 68 | } 69 | 70 | // 71 | // POST: /Account/Register 72 | 73 | [HttpPost] 74 | public ActionResult Register(RegisterModel model) 75 | { 76 | if (ModelState.IsValid) 77 | { 78 | // Attempt to register the user 79 | MembershipCreateStatus createStatus; 80 | Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus); 81 | 82 | if (createStatus == MembershipCreateStatus.Success) 83 | { 84 | FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */); 85 | return RedirectToAction("Index", "Home"); 86 | } 87 | else 88 | { 89 | ModelState.AddModelError("", ErrorCodeToString(createStatus)); 90 | } 91 | } 92 | 93 | // If we got this far, something failed, redisplay form 94 | return View(model); 95 | } 96 | 97 | // 98 | // GET: /Account/ChangePassword 99 | 100 | [Authorize] 101 | public ActionResult ChangePassword() 102 | { 103 | return View(); 104 | } 105 | 106 | // 107 | // POST: /Account/ChangePassword 108 | 109 | [Authorize] 110 | [HttpPost] 111 | public ActionResult ChangePassword(ChangePasswordModel model) 112 | { 113 | if (ModelState.IsValid) 114 | { 115 | 116 | // ChangePassword will throw an exception rather 117 | // than return false in certain failure scenarios. 118 | bool changePasswordSucceeded; 119 | try 120 | { 121 | MembershipUser currentUser = Membership.GetUser(User.Identity.Name, true /* userIsOnline */); 122 | changePasswordSucceeded = currentUser.ChangePassword(model.OldPassword, model.NewPassword); 123 | } 124 | catch (Exception) 125 | { 126 | changePasswordSucceeded = false; 127 | } 128 | 129 | if (changePasswordSucceeded) 130 | { 131 | return RedirectToAction("ChangePasswordSuccess"); 132 | } 133 | else 134 | { 135 | ModelState.AddModelError("", "The current password is incorrect or the new password is invalid."); 136 | } 137 | } 138 | 139 | // If we got this far, something failed, redisplay form 140 | return View(model); 141 | } 142 | 143 | // 144 | // GET: /Account/ChangePasswordSuccess 145 | 146 | public ActionResult ChangePasswordSuccess() 147 | { 148 | return View(); 149 | } 150 | 151 | #region Status Codes 152 | private static string ErrorCodeToString(MembershipCreateStatus createStatus) 153 | { 154 | // See http://go.microsoft.com/fwlink/?LinkID=177550 for 155 | // a full list of status codes. 156 | switch (createStatus) 157 | { 158 | case MembershipCreateStatus.DuplicateUserName: 159 | return "User name already exists. Please enter a different user name."; 160 | 161 | case MembershipCreateStatus.DuplicateEmail: 162 | return "A user name for that e-mail address already exists. Please enter a different e-mail address."; 163 | 164 | case MembershipCreateStatus.InvalidPassword: 165 | return "The password provided is invalid. Please enter a valid password value."; 166 | 167 | case MembershipCreateStatus.InvalidEmail: 168 | return "The e-mail address provided is invalid. Please check the value and try again."; 169 | 170 | case MembershipCreateStatus.InvalidAnswer: 171 | return "The password retrieval answer provided is invalid. Please check the value and try again."; 172 | 173 | case MembershipCreateStatus.InvalidQuestion: 174 | return "The password retrieval question provided is invalid. Please check the value and try again."; 175 | 176 | case MembershipCreateStatus.InvalidUserName: 177 | return "The user name provided is invalid. Please check the value and try again."; 178 | 179 | case MembershipCreateStatus.ProviderError: 180 | return "The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator."; 181 | 182 | case MembershipCreateStatus.UserRejected: 183 | return "The user creation request has been canceled. Please verify your entry and try again. If the problem persists, please contact your system administrator."; 184 | 185 | default: 186 | return "An unknown error occurred. Please verify your entry and try again. If the problem persists, please contact your system administrator."; 187 | } 188 | } 189 | #endregion 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Controllers/BooksController.cs.pp: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$.Controllers 2 | { 3 | using System.Linq; 4 | using System.Web.Mvc; 5 | using System.Collections.Generic; 6 | using Models; 7 | 8 | public class BooksController : Controller 9 | { 10 | private static readonly List _booksRepository = new List(); // not thread safe. 11 | 12 | public ActionResult Index() 13 | { 14 | return View(_booksRepository); 15 | } 16 | 17 | public ActionResult Details(int id) 18 | { 19 | var bookToView = _booksRepository.Single(b => b.Id == id); 20 | 21 | return View(bookToView); 22 | } 23 | 24 | public ActionResult Create() 25 | { 26 | return View(); 27 | } 28 | 29 | [HttpPost] 30 | public ActionResult Create(Book book) 31 | { 32 | if (!ModelState.IsValid) 33 | { 34 | return View(book); 35 | } 36 | 37 | book.Id = _booksRepository.Count == 0 ? 1 : _booksRepository.Max(b => b.Id) + 1; 38 | _booksRepository.Add(book); 39 | 40 | return RedirectToAction("Index"); 41 | } 42 | 43 | public ActionResult Edit(int id) 44 | { 45 | var bookToEdit = _booksRepository.Single(b => b.Id == id); 46 | 47 | return View(bookToEdit); 48 | } 49 | 50 | [HttpPost] 51 | public ActionResult Edit(int id, Book book) 52 | { 53 | if (!ModelState.IsValid) 54 | { 55 | return View(book); 56 | } 57 | 58 | var bookToEdit = _booksRepository.Single(b => b.Id == book.Id); 59 | bookToEdit.Title = book.Title; 60 | bookToEdit.Author = book.Author; 61 | 62 | return RedirectToAction("Index"); 63 | } 64 | 65 | public ActionResult Delete(int id) 66 | { 67 | var bookToRemove = _booksRepository.Single(b => b.Id == id); 68 | 69 | return View(bookToRemove); 70 | } 71 | 72 | [HttpPost] 73 | public ActionResult Delete(int id, FormCollection collection) 74 | { 75 | if (!ModelState.IsValid) 76 | { 77 | return View(); 78 | } 79 | 80 | var bookToRemove = _booksRepository.Single(b => b.Id == id); 81 | _booksRepository.Remove(bookToRemove); 82 | 83 | return RedirectToAction("Index"); 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Controllers/HomeController.cs.pp: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$.Controllers 2 | { 3 | using System.Web.Mvc; 4 | 5 | public class HomeController : Controller 6 | { 7 | public ActionResult Index() 8 | { 9 | ViewBag.Message = "Welcome to ASP.NET MVC!"; 10 | 11 | return View(); 12 | } 13 | 14 | public ActionResult About() 15 | { 16 | return View(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Models/Accounts/ChangePasswordModel.cs.pp: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.Web.Mvc; 3 | 4 | namespace $rootnamespace$.Models.Accounts 5 | { 6 | public class ChangePasswordModel 7 | { 8 | [Required] 9 | [DataType(DataType.Password)] 10 | public string OldPassword { get; set; } 11 | 12 | [Required] 13 | [StringLength(100, MinimumLength = 6)] 14 | [DataType(DataType.Password)] 15 | public string NewPassword { get; set; } 16 | 17 | [DataType(DataType.Password)] 18 | [Compare("NewPassword")] 19 | public string ConfirmPassword { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Models/Accounts/LoginModel.cs.pp: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace $rootnamespace$.Models.Accounts 4 | { 5 | public class LoginModel 6 | { 7 | [Required] 8 | public string UserName { get; set; } 9 | 10 | [Required] 11 | [DataType(DataType.Password)] 12 | public string Password { get; set; } 13 | 14 | public bool RememberMe { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Models/Accounts/RegisterModel.cs.pp: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.Web.Mvc; 3 | 4 | namespace $rootnamespace$.Models.Accounts 5 | { 6 | public class RegisterModel 7 | { 8 | [Required] 9 | public string UserName { get; set; } 10 | 11 | [Required] 12 | [DataType(DataType.EmailAddress)] 13 | public string Email { get; set; } 14 | 15 | [Required] 16 | [StringLength(100, MinimumLength = 6)] 17 | [DataType(DataType.Password)] 18 | public string Password { get; set; } 19 | 20 | [DataType(DataType.Password)] 21 | [Compare("Password")] 22 | public string ConfirmPassword { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Models/Book.cs.pp: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$.Models 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | using Resources; 5 | 6 | public class Book 7 | { 8 | public int Id { get; set; } 9 | 10 | [Required(ErrorMessageResourceType = typeof(Books))] 11 | [Display(ResourceType = typeof(Books))] 12 | public string Title { get; set; } 13 | 14 | [Required(ErrorMessageResourceType = typeof(Books))] 15 | [Display(ResourceType = typeof(Books))] 16 | public string Author { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Resources/Books.Designer.cs.pp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.225 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace $rootnamespace$.Resources { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | public class Books { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Books() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | public static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("$rootnamespace$.Resources.Books", typeof(Books).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | public static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Author. 65 | /// 66 | public static string Book_Author { 67 | get { 68 | return ResourceManager.GetString("Book_Author", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to The Author field is required. 74 | /// 75 | public static string Book_Author_Required { 76 | get { 77 | return ResourceManager.GetString("Book_Author_Required", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to Title. 83 | /// 84 | public static string Book_Title { 85 | get { 86 | return ResourceManager.GetString("Book_Title", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to The Title field is required. 92 | /// 93 | public static string Book_Title_Required { 94 | get { 95 | return ResourceManager.GetString("Book_Title_Required", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to Book. 101 | /// 102 | public static string Books_Book { 103 | get { 104 | return ResourceManager.GetString("Books_Book", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to Books. 110 | /// 111 | public static string Books_Books { 112 | get { 113 | return ResourceManager.GetString("Books_Books", resourceCulture); 114 | } 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Resources/Books.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Book 122 | 123 | 124 | Books 125 | 126 | 127 | Author 128 | 129 | 130 | The Author field is required 131 | 132 | 133 | Title 134 | 135 | 136 | The Title field is required 137 | 138 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Resources/Language.Designer.cs.pp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.261 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace $rootnamespace$.Resources { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | public class Language { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Language() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | public static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("$rootnamespace$.Resources.Language", typeof(Language).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | public static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Your quintessential app description page.. 65 | /// 66 | public static string About_Title { 67 | get { 68 | return ResourceManager.GetString("About_Title", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to Confirm new password. 74 | /// 75 | public static string ChangePasswordModel_ConfirmPassword { 76 | get { 77 | return ResourceManager.GetString("ChangePasswordModel_ConfirmPassword", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to The new password and confirmation password do not match.. 83 | /// 84 | public static string ChangePasswordModel_ConfirmPassword_Compare { 85 | get { 86 | return ResourceManager.GetString("ChangePasswordModel_ConfirmPassword_Compare", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to New password. 92 | /// 93 | public static string ChangePasswordModel_NewPassword { 94 | get { 95 | return ResourceManager.GetString("ChangePasswordModel_NewPassword", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to The {0} must be at least {2} characters long.. 101 | /// 102 | public static string ChangePasswordModel_NewPassword_StringLength { 103 | get { 104 | return ResourceManager.GetString("ChangePasswordModel_NewPassword_StringLength", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to Current password. 110 | /// 111 | public static string ChangePasswordModel_OldPassword { 112 | get { 113 | return ResourceManager.GetString("ChangePasswordModel_OldPassword", resourceCulture); 114 | } 115 | } 116 | 117 | /// 118 | /// Looks up a localized string similar to Your quintessential contact page.. 119 | /// 120 | public static string Contact_Title { 121 | get { 122 | return ResourceManager.GetString("Contact_Title", resourceCulture); 123 | } 124 | } 125 | 126 | /// 127 | /// Looks up a localized string similar to This text came from the resource file. how cool is that.. 128 | /// 129 | public static string Demonstration_Alert { 130 | get { 131 | return ResourceManager.GetString("Demonstration_Alert", resourceCulture); 132 | } 133 | } 134 | 135 | /// 136 | /// Looks up a localized string similar to Modify this template to jump-start your ASP.NET application. 137 | /// 138 | public static string Index_Title { 139 | get { 140 | return ResourceManager.GetString("Index_Title", resourceCulture); 141 | } 142 | } 143 | 144 | /// 145 | /// Looks up a localized string similar to Back to List. 146 | /// 147 | public static string Global_BackToList { 148 | get { 149 | return ResourceManager.GetString("Global_BackToList", resourceCulture); 150 | } 151 | } 152 | 153 | /// 154 | /// Looks up a localized string similar to Create. 155 | /// 156 | public static string Global_Create { 157 | get { 158 | return ResourceManager.GetString("Global_Create", resourceCulture); 159 | } 160 | } 161 | 162 | /// 163 | /// Looks up a localized string similar to Create New. 164 | /// 165 | public static string Global_CreateNew { 166 | get { 167 | return ResourceManager.GetString("Global_CreateNew", resourceCulture); 168 | } 169 | } 170 | 171 | /// 172 | /// Looks up a localized string similar to Delete. 173 | /// 174 | public static string Global_Delete { 175 | get { 176 | return ResourceManager.GetString("Global_Delete", resourceCulture); 177 | } 178 | } 179 | 180 | /// 181 | /// Looks up a localized string similar to Are you sure you want to delete this?. 182 | /// 183 | public static string Global_DeleteConfirm { 184 | get { 185 | return ResourceManager.GetString("Global_DeleteConfirm", resourceCulture); 186 | } 187 | } 188 | 189 | /// 190 | /// Looks up a localized string similar to Details. 191 | /// 192 | public static string Global_Details { 193 | get { 194 | return ResourceManager.GetString("Global_Details", resourceCulture); 195 | } 196 | } 197 | 198 | /// 199 | /// Looks up a localized string similar to Edit. 200 | /// 201 | public static string Global_Edit { 202 | get { 203 | return ResourceManager.GetString("Global_Edit", resourceCulture); 204 | } 205 | } 206 | 207 | /// 208 | /// Looks up a localized string similar to Save. 209 | /// 210 | public static string Global_Save { 211 | get { 212 | return ResourceManager.GetString("Global_Save", resourceCulture); 213 | } 214 | } 215 | 216 | /// 217 | /// Looks up a localized string similar to Password. 218 | /// 219 | public static string LoginModel_Password { 220 | get { 221 | return ResourceManager.GetString("LoginModel_Password", resourceCulture); 222 | } 223 | } 224 | 225 | /// 226 | /// Looks up a localized string similar to Remember me?. 227 | /// 228 | public static string LoginModel_RememberMe { 229 | get { 230 | return ResourceManager.GetString("LoginModel_RememberMe", resourceCulture); 231 | } 232 | } 233 | 234 | /// 235 | /// Looks up a localized string similar to User name foo bar baz. 236 | /// 237 | public static string LoginModel_UserName { 238 | get { 239 | return ResourceManager.GetString("LoginModel_UserName", resourceCulture); 240 | } 241 | } 242 | 243 | /// 244 | /// Looks up a localized string similar to Code52 i18n Demo site. 245 | /// 246 | public static string Logo_Title { 247 | get { 248 | return ResourceManager.GetString("Logo_Title", resourceCulture); 249 | } 250 | } 251 | 252 | /// 253 | /// Looks up a localized string similar to My ASP.NET MVC Application. 254 | /// 255 | public static string Master_SiteTitle { 256 | get { 257 | return ResourceManager.GetString("Master_SiteTitle", resourceCulture); 258 | } 259 | } 260 | 261 | /// 262 | /// Looks up a localized string similar to About. 263 | /// 264 | public static string Menu_About { 265 | get { 266 | return ResourceManager.GetString("Menu_About", resourceCulture); 267 | } 268 | } 269 | 270 | /// 271 | /// Looks up a localized string similar to Books. 272 | /// 273 | public static string Menu_Books { 274 | get { 275 | return ResourceManager.GetString("Menu_Books", resourceCulture); 276 | } 277 | } 278 | 279 | /// 280 | /// Looks up a localized string similar to Contact. 281 | /// 282 | public static string Menu_Contact { 283 | get { 284 | return ResourceManager.GetString("Menu_Contact", resourceCulture); 285 | } 286 | } 287 | 288 | /// 289 | /// Looks up a localized string similar to Home. 290 | /// 291 | public static string Menu_Home { 292 | get { 293 | return ResourceManager.GetString("Menu_Home", resourceCulture); 294 | } 295 | } 296 | 297 | /// 298 | /// Looks up a localized string similar to Confirm new password. 299 | /// 300 | public static string RegisterModel_ConfirmPassword { 301 | get { 302 | return ResourceManager.GetString("RegisterModel_ConfirmPassword", resourceCulture); 303 | } 304 | } 305 | 306 | /// 307 | /// Looks up a localized string similar to The new password and confirmation password do not match.. 308 | /// 309 | public static string RegisterModel_ConfirmPassword_Compare { 310 | get { 311 | return ResourceManager.GetString("RegisterModel_ConfirmPassword_Compare", resourceCulture); 312 | } 313 | } 314 | 315 | /// 316 | /// Looks up a localized string similar to Password. 317 | /// 318 | public static string RegisterModel_Password { 319 | get { 320 | return ResourceManager.GetString("RegisterModel_Password", resourceCulture); 321 | } 322 | } 323 | 324 | /// 325 | /// Looks up a localized string similar to The {0} must be at least {2} characters long.. 326 | /// 327 | public static string RegisterModel_Password_StringLength { 328 | get { 329 | return ResourceManager.GetString("RegisterModel_Password_StringLength", resourceCulture); 330 | } 331 | } 332 | 333 | /// 334 | /// Looks up a localized string similar to User name. 335 | /// 336 | public static string RegisterModel_UserName { 337 | get { 338 | return ResourceManager.GetString("RegisterModel_UserName", resourceCulture); 339 | } 340 | } 341 | 342 | /// 343 | /// Looks up a localized string similar to Facebook. 344 | /// 345 | public static string Social_Facebook { 346 | get { 347 | return ResourceManager.GetString("Social_Facebook", resourceCulture); 348 | } 349 | } 350 | 351 | /// 352 | /// Looks up a localized string similar to Twitter. 353 | /// 354 | public static string Social_Twitter { 355 | get { 356 | return ResourceManager.GetString("Social_Twitter", resourceCulture); 357 | } 358 | } 359 | } 360 | } 361 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Resources/Language.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Your quintessential app description page. 122 | 123 | 124 | Create New 125 | 126 | 127 | Confirm new password 128 | 129 | 130 | The new password and confirmation password do not match. 131 | 132 | 133 | New password 134 | 135 | 136 | The {0} must be at least {2} characters long. 137 | 138 | 139 | Current password 140 | 141 | 142 | Your quintessential contact page. 143 | 144 | 145 | This text came from the resource file. how cool is that. 146 | 147 | 148 | Modify this template to jump-start your ASP.NET application 149 | 150 | 151 | Password 152 | 153 | 154 | Remember me? 155 | 156 | 157 | User name foo bar baz 158 | 159 | 160 | Code52 i18n Demo site 161 | 162 | 163 | My ASP.NET MVC Application 164 | The title displayed on _Layout.cshtml 165 | 166 | 167 | About 168 | Main menu - link text - About 169 | 170 | 171 | Contact 172 | Main menu - link text - Contact 173 | 174 | 175 | Home 176 | Main menu - link text - Home 177 | 178 | 179 | Confirm new password 180 | 181 | 182 | The new password and confirmation password do not match. 183 | 184 | 185 | Password 186 | 187 | 188 | The {0} must be at least {2} characters long. 189 | 190 | 191 | User name 192 | 193 | 194 | Facebook 195 | A link to Facebook - title reads Facebook 196 | 197 | 198 | Twitter 199 | A link to Twitter - title reads Twitter 200 | 201 | 202 | Back to List 203 | 204 | 205 | Create 206 | 207 | 208 | Delete 209 | 210 | 211 | Are you sure you want to delete this? 212 | 213 | 214 | Details 215 | 216 | 217 | Edit 218 | 219 | 220 | Save 221 | 222 | 223 | Books 224 | 225 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Views/Account/ChangePassword.cshtml.pp: -------------------------------------------------------------------------------- 1 | @model $rootnamespace$.Models.Accounts.ChangePasswordModel 2 | 3 | @{ 4 | ViewBag.Title = "Change Password"; 5 | } 6 | 7 |
8 |

@ViewBag.Title.

9 |

Use the form below to change your password.

10 |
11 | 12 |

13 | New passwords are required to be a minimum of @Membership.MinRequiredPasswordLength characters in length. 14 |

15 | 16 | 17 | 18 | 19 | @using (Html.BeginForm()) { 20 | @Html.ValidationSummary(true, "Password change was unsuccessful. Please correct the errors and try again.") 21 | 22 |
23 | Change Password Form 24 |
    25 |
  1. 26 | @Html.LabelFor(m => m.OldPassword) 27 | @Html.PasswordFor(m => m.OldPassword) 28 | @Html.ValidationMessageFor(m => m.OldPassword) 29 |
  2. 30 |
  3. 31 | @Html.LabelFor(m => m.NewPassword) 32 | @Html.PasswordFor(m => m.NewPassword) 33 | @Html.ValidationMessageFor(m => m.NewPassword) 34 |
  4. 35 |
  5. 36 | @Html.LabelFor(m => m.ConfirmPassword) 37 | @Html.PasswordFor(m => m.ConfirmPassword) 38 | @Html.ValidationMessageFor(m => m.ConfirmPassword) 39 |
  6. 40 |
41 | 42 |
43 | } 44 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Views/Account/ChangePasswordSuccess.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Change Password"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |

Your password has been changed successfully.

8 |
9 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Views/Account/Login.cshtml.pp: -------------------------------------------------------------------------------- 1 | @model $rootnamespace$.Models.Accounts.LoginModel 2 | 3 | @{ 4 | ViewBag.Title = "Log in"; 5 | } 6 | 7 |
8 |

@ViewBag.Title.

9 |

Enter your user name and password below.

10 |
11 | 12 | 13 | 14 | 15 | @using (Html.BeginForm((string)ViewBag.FormAction, "Account")) { 16 | @Html.ValidationSummary(true, "Log in was unsuccessful. Please correct the errors and try again.") 17 | 18 |
19 | Log in Form 20 |
    21 |
  1. 22 | @Html.LabelFor(m => m.UserName) 23 | @Html.TextBoxFor(m => m.UserName) 24 | @Html.ValidationMessageFor(m => m.UserName) 25 |
  2. 26 |
  3. 27 | @Html.LabelFor(m => m.Password) 28 | @Html.PasswordFor(m => m.Password) 29 | @Html.ValidationMessageFor(m => m.Password) 30 |
  4. 31 |
  5. 32 | @Html.CheckBoxFor(m => m.RememberMe) 33 | @Html.LabelFor(m => m.RememberMe, new { @class = "checkbox" }) 34 |
  6. 35 |
36 | 37 |
38 |

39 | @Html.ActionLink("Register", "Register") if you don't have an account. 40 |

41 | } 42 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Views/Account/Register.cshtml.pp: -------------------------------------------------------------------------------- 1 | @model $rootnamespace$.Models.Accounts.RegisterModel 2 | 3 | @{ 4 | ViewBag.Title = "Register"; 5 | } 6 | 7 |
8 |

@ViewBag.Title.

9 |

Use the form below to create a new account.

10 |
11 | 12 |

13 | Passwords are required to be a minimum of @Membership.MinRequiredPasswordLength characters in length. 14 |

15 | 16 | 17 | 18 | 19 | @using (Html.BeginForm((string)ViewBag.FormAction, "Account")) { 20 | @Html.ValidationSummary(true, "Account creation was unsuccessful. Please correct the errors and try again.") 21 | 22 |
23 | Registration Form 24 |
    25 |
  1. 26 | @Html.LabelFor(m => m.UserName) 27 | @Html.TextBoxFor(m => m.UserName) 28 | @Html.ValidationMessageFor(m => m.UserName) 29 |
  2. 30 |
  3. 31 | @Html.LabelFor(m => m.Email) 32 | @Html.TextBoxFor(m => m.Email) 33 | @Html.ValidationMessageFor(m => m.Email) 34 |
  4. 35 |
  5. 36 | @Html.LabelFor(m => m.Password) 37 | @Html.PasswordFor(m => m.Password) 38 | @Html.ValidationMessageFor(m => m.Password) 39 |
  6. 40 |
  7. 41 | @Html.LabelFor(m => m.ConfirmPassword) 42 | @Html.PasswordFor(m => m.ConfirmPassword) 43 | @Html.ValidationMessageFor(m => m.ConfirmPassword) 44 |
  8. 45 |
46 | 47 |
48 | } 49 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Views/Books/Create.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using $rootnamespace$.Resources 2 | 3 | @model $rootnamespace$.Models.Book 4 | 5 | @{ 6 | ViewBag.Title = "Create"; 7 | Layout = "~/Views/Shared/_Layout.cshtml"; 8 | } 9 | 10 |

@Language.Global_Create

11 | 12 | 13 | 14 | 15 | @using (Html.BeginForm()) { 16 | @Html.ValidationSummary(true) 17 | 18 |
19 | @Books.Books_Book 20 | 21 |
22 | @Html.LabelFor(model => model.Title) 23 |
24 |
25 | @Html.EditorFor(model => model.Title) 26 | @Html.ValidationMessageFor(model => model.Title) 27 |
28 | 29 |
30 | @Html.LabelFor(model => model.Author) 31 |
32 |
33 | @Html.EditorFor(model => model.Author) 34 | @Html.ValidationMessageFor(model => model.Author) 35 |
36 | 37 |

38 | 39 |

40 |
41 | } 42 | 43 |
44 | @Html.ActionLink(@Language.Global_BackToList, "Index") 45 |
46 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Views/Books/Delete.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using $rootnamespace$.Resources 2 | 3 | @model $rootnamespace$.Models.Book 4 | 5 | @{ 6 | ViewBag.Title = "Delete"; 7 | Layout = "~/Views/Shared/_Layout.cshtml"; 8 | } 9 | 10 |

@Language.Global_Delete

11 | 12 |

@Language.Global_DeleteConfirm

13 |
14 | @Books.Books_Book 15 | 16 |
17 | @Html.DisplayNameFor(model => model.Title) 18 |
19 |
20 | @Html.DisplayFor(model => model.Title) 21 |
22 | 23 |
24 | @Html.DisplayNameFor(model => model.Author) 25 |
26 |
27 | @Html.DisplayFor(model => model.Author) 28 |
29 |
30 | @using (Html.BeginForm()) { 31 |

32 | | 33 | @Html.ActionLink(@Language.Global_BackToList, "Index") 34 |

35 | } 36 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Views/Books/Details.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using $rootnamespace$.Resources 2 | 3 | @model $rootnamespace$.Models.Book 4 | 5 | @{ 6 | ViewBag.Title = "Details"; 7 | Layout = "~/Views/Shared/_Layout.cshtml"; 8 | } 9 | 10 |

@Language.Global_Details

11 | 12 |
13 | @Books.Books_Book 14 | 15 |
16 | @Html.DisplayNameFor(model => model.Title) 17 |
18 |
19 | @Html.DisplayFor(model => model.Title) 20 |
21 | 22 |
23 | @Html.DisplayNameFor(model => model.Author) 24 |
25 |
26 | @Html.DisplayFor(model => model.Author) 27 |
28 |
29 |

30 | @Html.ActionLink(@Language.Global_Edit, "Edit", new { id=Model.Id }) | 31 | @Html.ActionLink(@Language.Global_BackToList, "Index") 32 |

33 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Views/Books/Edit.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using $rootnamespace$.Resources 2 | 3 | @model $rootnamespace$.Models.Book 4 | 5 | @{ 6 | ViewBag.Title = "Edit"; 7 | Layout = "~/Views/Shared/_Layout.cshtml"; 8 | } 9 | 10 |

@Language.Global_Edit

11 | 12 | 13 | 14 | 15 | @using (Html.BeginForm()) { 16 | @Html.ValidationSummary(true) 17 | 18 |
19 | @Books.Books_Book 20 | 21 | @Html.HiddenFor(model => model.Id) 22 | 23 |
24 | @Html.LabelFor(model => model.Title) 25 |
26 |
27 | @Html.EditorFor(model => model.Title) 28 | @Html.ValidationMessageFor(model => model.Title) 29 |
30 | 31 |
32 | @Html.LabelFor(model => model.Author) 33 |
34 |
35 | @Html.EditorFor(model => model.Author) 36 | @Html.ValidationMessageFor(model => model.Author) 37 |
38 | 39 |

40 | 41 |

42 |
43 | } 44 | 45 |
46 | @Html.ActionLink(@Language.Global_BackToList, "Index") 47 |
48 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Views/Books/Index.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using $rootnamespace$.Resources 2 | 3 | @model IEnumerable<$rootnamespace$.Models.Book> 4 | 5 | @{ 6 | ViewBag.Title = "Index"; 7 | Layout = "~/Views/Shared/_Layout.cshtml"; 8 | } 9 | 10 |

@Books.Books_Books

11 | 12 |

13 | @Html.ActionLink(Language.Global_CreateNew, "Create") 14 |

15 | 16 | 17 | 20 | 23 | 24 | 25 | 26 | @foreach (var item in Model) { 27 | 28 | 31 | 34 | 39 | 40 | } 41 | 42 |
18 | @Html.DisplayNameFor(model => model.Title) 19 | 21 | @Html.DisplayNameFor(model => model.Author) 22 |
29 | @Html.DisplayFor(modelItem => item.Title) 30 | 32 | @Html.DisplayFor(modelItem => item.Author) 33 | 35 | @Html.ActionLink(@Language.Global_Edit, "Edit", new { id=item.Id }) | 36 | @Html.ActionLink(@Language.Global_Details, "Details", new { id=item.Id }) | 37 | @Html.ActionLink(@Language.Global_Delete, "Delete", new { id=item.Id }) 38 |
43 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About Us"; 3 | } 4 | 5 |

About

6 |

7 | Put content here. 8 |

9 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home Page"; 3 | } 4 |

@ViewBag.Message

5 |

6 | To learn more about ASP.NET MVC visit http://asp.net/mvc. 7 |

8 | 9 |

10 | to demonstrate retrieving language resource via JS. 11 |

12 | 13 | 23 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/Content/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @if(Request.IsAuthenticated) { 2 | Welcome @User.Identity.Name! 3 | [ @Html.ActionLink("Log Off", "LogOff", "Account") ] 4 | } 5 | else { 6 | @:[ @Html.ActionLink("Log On", "LogOn", "Account") ] 7 | } 8 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/NuSpec/tools/install.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | #script to fix code-behind for resx 3 | set-alias Write-Host -Name whecho 4 | whecho "Restoring resource code-behinds (this may cause the project to be reloaded with a dialog) ..." 5 | $resitems = @{} 6 | foreach ($item in $project.ProjectItems) 7 | { 8 | if ($item.Name -eq "Resources") { 9 | $resources = $item 10 | foreach ($resitem in $resources.ProjectItems) { 11 | $codebehinditem = $NULL 12 | if ($resitem.Name.ToLower().EndsWith(".resx")) { 13 | $hasCodeBehind = $FALSE 14 | switch ($item.ProjectItems) { default { 15 | if ($_.Name.ToLower() -eq $resitem.Name.ToLower().Replace(".resx", ".designer.cs")) { 16 | $hasCodeBehind = $TRUE 17 | $codebehinditem = $_ 18 | } 19 | }} 20 | if ($hasCodeBehind -eq $TRUE) { 21 | $fn = $resitem.FileNames(0) 22 | $cbfn = $codebehinditem.FileNames(0) 23 | $codebehinditem.Remove() 24 | $cb2 = $resitem.ProjectItems.AddFromFile($cbfn) 25 | } 26 | $resitems.Add("Resources\" + $resitem.Name, $resitem.FileNames(0)) 27 | whecho $resitem.Name 28 | } 29 | } 30 | } 31 | } 32 | $project.Save($project.FullName) 33 | $projxml = [xml](get-content $project.FullName) 34 | $ns = New-Object System.Xml.XmlNamespaceManager $projxml.NameTable 35 | $defns = "http://schemas.microsoft.com/developer/msbuild/2003" 36 | $ns.AddNamespace("csproj", $defns) 37 | foreach ($item in $resitems.GetEnumerator()) { 38 | $xpath = "//csproj:Project/csproj:ItemGroup/csproj:Compile[@Include=`"" + $item.Name.Replace(".resx", ".Designer.cs") + "`"]" 39 | $resxDesignerNode = $projxml.SelectSingleNode($xpath, $ns) 40 | 41 | if ($resxDesignerNode -ne $NULL) { 42 | 43 | $autogen = $projxml.CreateElement('AutoGen', $defns) 44 | $autogen.InnerText = 'True' 45 | $resxDesignerNode.AppendChild($autogen) 46 | 47 | $designtime = $projxml.CreateElement('DesignTime', $defns) 48 | $designtime.InnerText = 'True' 49 | $resxDesignerNode.AppendChild($designtime) 50 | } 51 | 52 | $xpath = "//csproj:Project/csproj:ItemGroup/csproj:EmbeddedResource[@Include=`"" + $item.Name + "`"]" 53 | $resxNode = $projxml.SelectSingleNode($xpath, $ns) 54 | 55 | $generator = $projxml.CreateElement('Generator', $defns) 56 | $generator.InnerText = 'PublicResXFileCodeGenerator' 57 | $resxNode.AppendChild($generator) 58 | 59 | if ($resxDesignerNode -ne $NULL) { 60 | $lastGenOutput = $projxml.CreateElement('LastGenOutput', $defns) 61 | $lastGenOutput.InnerText = $item.Name.Replace("Resources\", "").Replace(".resx", ".Designer.cs") 62 | $resxNode.AppendChild($lastGenOutput) 63 | } 64 | } 65 | 66 | $projxml.Save($project.FullName) -------------------------------------------------------------------------------- /src/Code52.i18n.MVC3.Example/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Code52.i18n.MVC")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Code52.i18n.MVC")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("83300f07-1689-4581-a75d-72ef6d8d225c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/Code52.i18n.MVC4.Example.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {1554DFF2-E628-47DE-B2F6-720F316A3298} 9 | Library 10 | Properties 11 | Code52.i18n.MVC4.Example 12 | Code52.i18n.MVC4.Example 13 | v4.0 14 | 512 15 | ..\ 16 | true 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | True 40 | ..\packages\AspNetMvc.4.0.20126.16343\lib\net40\System.Web.Mvc.dll 41 | 42 | 43 | 44 | 45 | Designer 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 85 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Code52.i18n.MVC4.Example.Razor.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Code52.i18n.MVC4.Sample.Razor 5 | 0.1 6 | ASP.NET Internationalisation (i18n) Sample for MVC4 7 | bforster, dchristiansen 8 | bforster, dchristiansen 9 | false 10 | http://code52.org/internationalization-mvc4 11 | https://github.com/DavidChristiansen/internationalization-mvc4/raw/master/docs/logo/ProjectIcon.png 12 | Sample implementation of i18n package 13 | A sample implementation of the [Code52] ASP.NET Internationalisation (i18n) package for MVC4 14 | localization globalization MVC MVC4 ASP.NET Web i18n l10n 15 | 16 | 17 | 18 | 19 | 20 | Initial release 21 | 22 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/App_Start/ModelMetadataProvider.cs.pp: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | using $rootnamespace$.Resources; 3 | using ModelMetadataExtensions; 4 | 5 | [assembly: WebActivator.PreApplicationStartMethod(typeof($rootnamespace$.App_Start.ModelMetadataProvider), "Start")] 6 | namespace $rootnamespace$.App_Start 7 | { 8 | public static class ModelMetadataProvider 9 | { 10 | public static void Start() 11 | { 12 | ModelMetadataProviders.Current = new ConventionalModelMetadataProvider(false, typeof(Language)); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Controllers/AccountController.cs.pp: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$.Controllers { 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Web.Mvc; 6 | using System.Web.Security; 7 | 8 | using $rootnamespace$.Models.Accounts; 9 | 10 | [Authorize] 11 | public class AccountController : Controller { 12 | 13 | // 14 | // GET: /Account/Login 15 | 16 | [AllowAnonymous] 17 | public ActionResult Login() { 18 | return this.ContextDependentView(); 19 | } 20 | 21 | // 22 | // POST: /Account/JsonLogin 23 | 24 | [AllowAnonymous] 25 | [HttpPost] 26 | public JsonResult JsonLogin(LoginModel model, string returnUrl) { 27 | if (this.ModelState.IsValid) { 28 | if (Membership.ValidateUser(model.UserName, model.Password)) { 29 | FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); 30 | return this.Json(new { success = true, redirect = returnUrl }); 31 | } else { 32 | this.ModelState.AddModelError("", "The user name or password provided is incorrect."); 33 | } 34 | } 35 | 36 | // If we got this far, something failed 37 | return this.Json(new { errors = this.GetErrorsFromModelState() }); 38 | } 39 | 40 | // 41 | // POST: /Account/Login 42 | 43 | [AllowAnonymous] 44 | [HttpPost] 45 | public ActionResult Login(LoginModel model, string returnUrl) { 46 | if (this.ModelState.IsValid) { 47 | if (Membership.ValidateUser(model.UserName, model.Password)) { 48 | FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe); 49 | if (this.Url.IsLocalUrl(returnUrl)) { 50 | return this.Redirect(returnUrl); 51 | } else { 52 | return this.RedirectToAction("Index", "Home"); 53 | } 54 | } else { 55 | this.ModelState.AddModelError("", "The user name or password provided is incorrect."); 56 | } 57 | } 58 | 59 | // If we got this far, something failed, redisplay form 60 | return this.View(model); 61 | } 62 | 63 | // 64 | // GET: /Account/LogOff 65 | 66 | public ActionResult LogOff() { 67 | FormsAuthentication.SignOut(); 68 | 69 | return this.RedirectToAction("Index", "Home"); 70 | } 71 | 72 | // 73 | // GET: /Account/Register 74 | 75 | [AllowAnonymous] 76 | public ActionResult Register() { 77 | return this.ContextDependentView(); 78 | } 79 | 80 | // 81 | // POST: /Account/JsonRegister 82 | 83 | [AllowAnonymous] 84 | [HttpPost] 85 | public ActionResult JsonRegister(RegisterModel model) { 86 | if (this.ModelState.IsValid) { 87 | // Attempt to register the user 88 | MembershipCreateStatus createStatus; 89 | Membership.CreateUser(model.UserName, model.Password, model.Email, passwordQuestion: null, passwordAnswer: null, isApproved: true, providerUserKey: null, status: out createStatus); 90 | 91 | if (createStatus == MembershipCreateStatus.Success) { 92 | FormsAuthentication.SetAuthCookie(model.UserName, createPersistentCookie: false); 93 | return this.Json(new { success = true }); 94 | } else { 95 | this.ModelState.AddModelError("", ErrorCodeToString(createStatus)); 96 | } 97 | } 98 | 99 | // If we got this far, something failed 100 | return this.Json(new { errors = this.GetErrorsFromModelState() }); 101 | } 102 | 103 | // 104 | // POST: /Account/Register 105 | 106 | [AllowAnonymous] 107 | [HttpPost] 108 | public ActionResult Register(RegisterModel model) { 109 | if (this.ModelState.IsValid) { 110 | // Attempt to register the user 111 | MembershipCreateStatus createStatus; 112 | Membership.CreateUser(model.UserName, model.Password, model.Email, passwordQuestion: null, passwordAnswer: null, isApproved: true, providerUserKey: null, status: out createStatus); 113 | 114 | if (createStatus == MembershipCreateStatus.Success) { 115 | FormsAuthentication.SetAuthCookie(model.UserName, createPersistentCookie: false); 116 | return this.RedirectToAction("Index", "Home"); 117 | } else { 118 | this.ModelState.AddModelError("", ErrorCodeToString(createStatus)); 119 | } 120 | } 121 | 122 | // If we got this far, something failed, redisplay form 123 | return this.View(model); 124 | } 125 | 126 | // 127 | // GET: /Account/ChangePassword 128 | 129 | public ActionResult ChangePassword() { 130 | return this.View(); 131 | } 132 | 133 | // 134 | // POST: /Account/ChangePassword 135 | 136 | [HttpPost] 137 | public ActionResult ChangePassword(ChangePasswordModel model) { 138 | if (this.ModelState.IsValid) { 139 | 140 | // ChangePassword will throw an exception rather 141 | // than return false in certain failure scenarios. 142 | bool changePasswordSucceeded; 143 | try { 144 | MembershipUser currentUser = Membership.GetUser(this.User.Identity.Name, userIsOnline: true); 145 | changePasswordSucceeded = currentUser.ChangePassword(model.OldPassword, model.NewPassword); 146 | } catch (Exception) { 147 | changePasswordSucceeded = false; 148 | } 149 | 150 | if (changePasswordSucceeded) { 151 | return this.RedirectToAction("ChangePasswordSuccess"); 152 | } else { 153 | this.ModelState.AddModelError("", "The current password is incorrect or the new password is invalid."); 154 | } 155 | } 156 | 157 | // If we got this far, something failed, redisplay form 158 | return this.View(model); 159 | } 160 | 161 | // 162 | // GET: /Account/ChangePasswordSuccess 163 | 164 | public ActionResult ChangePasswordSuccess() { 165 | return this.View(); 166 | } 167 | 168 | private ActionResult ContextDependentView() { 169 | string actionName = this.ControllerContext.RouteData.GetRequiredString("action"); 170 | if (this.Request.QueryString["content"] != null) { 171 | this.ViewBag.FormAction = "Json" + actionName; 172 | return this.PartialView(); 173 | } else { 174 | this.ViewBag.FormAction = actionName; 175 | return this.View(); 176 | } 177 | } 178 | 179 | private IEnumerable GetErrorsFromModelState() { 180 | return this.ModelState.SelectMany(x => x.Value.Errors.Select(error => error.ErrorMessage)); 181 | } 182 | 183 | #region Status Codes 184 | private static string ErrorCodeToString(MembershipCreateStatus createStatus) { 185 | // See http://go.microsoft.com/fwlink/?LinkID=177550 for 186 | // a full list of status codes. 187 | switch (createStatus) { 188 | case MembershipCreateStatus.DuplicateUserName: 189 | return "User name already exists. Please enter a different user name."; 190 | 191 | case MembershipCreateStatus.DuplicateEmail: 192 | return "A user name for that e-mail address already exists. Please enter a different e-mail address."; 193 | 194 | case MembershipCreateStatus.InvalidPassword: 195 | return "The password provided is invalid. Please enter a valid password value."; 196 | 197 | case MembershipCreateStatus.InvalidEmail: 198 | return "The e-mail address provided is invalid. Please check the value and try again."; 199 | 200 | case MembershipCreateStatus.InvalidAnswer: 201 | return "The password retrieval answer provided is invalid. Please check the value and try again."; 202 | 203 | case MembershipCreateStatus.InvalidQuestion: 204 | return "The password retrieval question provided is invalid. Please check the value and try again."; 205 | 206 | case MembershipCreateStatus.InvalidUserName: 207 | return "The user name provided is invalid. Please check the value and try again."; 208 | 209 | case MembershipCreateStatus.ProviderError: 210 | return "The authentication provider returned an error. Please verify your entry and try again. If the problem persists, please contact your system administrator."; 211 | 212 | case MembershipCreateStatus.UserRejected: 213 | return "The user creation request has been canceled. Please verify your entry and try again. If the problem persists, please contact your system administrator."; 214 | 215 | default: 216 | return "An unknown error occurred. Please verify your entry and try again. If the problem persists, please contact your system administrator."; 217 | } 218 | } 219 | #endregion 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Controllers/BooksController.cs.pp: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$.Controllers 2 | { 3 | using System.Linq; 4 | using System.Web.Mvc; 5 | using System.Collections.Generic; 6 | using Models; 7 | 8 | public class BooksController : Controller 9 | { 10 | private static readonly List _booksRepository = new List(); // not thread safe. 11 | 12 | public ActionResult Index() 13 | { 14 | return View(_booksRepository); 15 | } 16 | 17 | public ActionResult Details(int id) 18 | { 19 | var bookToView = _booksRepository.Single(b => b.Id == id); 20 | 21 | return View(bookToView); 22 | } 23 | 24 | public ActionResult Create() 25 | { 26 | return View(); 27 | } 28 | 29 | [HttpPost] 30 | public ActionResult Create(Book book) 31 | { 32 | if (!ModelState.IsValid) 33 | { 34 | return View(book); 35 | } 36 | 37 | book.Id = _booksRepository.Count == 0 ? 1 : _booksRepository.Max(b => b.Id) + 1; 38 | _booksRepository.Add(book); 39 | 40 | return RedirectToAction("Index"); 41 | } 42 | 43 | public ActionResult Edit(int id) 44 | { 45 | var bookToEdit = _booksRepository.Single(b => b.Id == id); 46 | 47 | return View(bookToEdit); 48 | } 49 | 50 | [HttpPost] 51 | public ActionResult Edit(int id, Book book) 52 | { 53 | if (!ModelState.IsValid) 54 | { 55 | return View(book); 56 | } 57 | 58 | var bookToEdit = _booksRepository.Single(b => b.Id == book.Id); 59 | bookToEdit.Title = book.Title; 60 | bookToEdit.Author = book.Author; 61 | 62 | return RedirectToAction("Index"); 63 | } 64 | 65 | public ActionResult Delete(int id) 66 | { 67 | var bookToRemove = _booksRepository.Single(b => b.Id == id); 68 | 69 | return View(bookToRemove); 70 | } 71 | 72 | [HttpPost] 73 | public ActionResult Delete(int id, FormCollection collection) 74 | { 75 | if (!ModelState.IsValid) 76 | { 77 | return View(); 78 | } 79 | 80 | var bookToRemove = _booksRepository.Single(b => b.Id == id); 81 | _booksRepository.Remove(bookToRemove); 82 | 83 | return RedirectToAction("Index"); 84 | } 85 | } 86 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Controllers/HomeController.cs.pp: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$.Controllers 2 | { 3 | using System.Web.Mvc; 4 | 5 | public class HomeController : Controller 6 | { 7 | public ActionResult Index() 8 | { 9 | ViewBag.Message = Resources.Language.Index_Title; 10 | 11 | return View(); 12 | } 13 | 14 | public ActionResult About() 15 | { 16 | ViewBag.Message = Resources.Language.About_Title; 17 | 18 | return View(); 19 | } 20 | 21 | public ActionResult Contact() 22 | { 23 | ViewBag.Message = Resources.Language.Contact_Title; 24 | 25 | return View(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Models/Accounts/ChangePasswordModel.cs.pp: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.Web.Mvc; 3 | 4 | namespace $rootnamespace$.Models.Accounts 5 | { 6 | public class ChangePasswordModel 7 | { 8 | [Required] 9 | [DataType(DataType.Password)] 10 | public string OldPassword { get; set; } 11 | 12 | [Required] 13 | [StringLength(100, MinimumLength = 6)] 14 | [DataType(DataType.Password)] 15 | public string NewPassword { get; set; } 16 | 17 | [DataType(DataType.Password)] 18 | [Compare("NewPassword")] 19 | public string ConfirmPassword { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Models/Accounts/LoginModel.cs.pp: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace $rootnamespace$.Models.Accounts 4 | { 5 | public class LoginModel 6 | { 7 | [Required] 8 | public string UserName { get; set; } 9 | 10 | [Required] 11 | [DataType(DataType.Password)] 12 | public string Password { get; set; } 13 | 14 | public bool RememberMe { get; set; } 15 | } 16 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Models/Accounts/RegisterModel.cs.pp: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.Web.Mvc; 3 | 4 | namespace $rootnamespace$.Models.Accounts 5 | { 6 | public class RegisterModel 7 | { 8 | [Required] 9 | public string UserName { get; set; } 10 | 11 | [Required] 12 | [DataType(DataType.EmailAddress)] 13 | public string Email { get; set; } 14 | 15 | [Required] 16 | [StringLength(100, MinimumLength = 6)] 17 | [DataType(DataType.Password)] 18 | public string Password { get; set; } 19 | 20 | [DataType(DataType.Password)] 21 | [Compare("Password")] 22 | public string ConfirmPassword { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Models/Book.cs.pp: -------------------------------------------------------------------------------- 1 | namespace $rootnamespace$.Models 2 | { 3 | using System.ComponentModel.DataAnnotations; 4 | using Resources; 5 | 6 | public class Book 7 | { 8 | public int Id { get; set; } 9 | 10 | [Required(ErrorMessageResourceType = typeof(Books))] 11 | [Display(ResourceType = typeof(Books))] 12 | public string Title { get; set; } 13 | 14 | [Required(ErrorMessageResourceType = typeof(Books))] 15 | [Display(ResourceType = typeof(Books))] 16 | public string Author { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Resources/Books.Designer.cs.pp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.225 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace $rootnamespace$.Resources { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | public class Books { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Books() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | public static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("$rootnamespace$.Resources.Books", typeof(Books).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | public static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Author. 65 | /// 66 | public static string Book_Author { 67 | get { 68 | return ResourceManager.GetString("Book_Author", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to The Author field is required. 74 | /// 75 | public static string Book_Author_Required { 76 | get { 77 | return ResourceManager.GetString("Book_Author_Required", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to Title. 83 | /// 84 | public static string Book_Title { 85 | get { 86 | return ResourceManager.GetString("Book_Title", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to The Title field is required. 92 | /// 93 | public static string Book_Title_Required { 94 | get { 95 | return ResourceManager.GetString("Book_Title_Required", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to Book. 101 | /// 102 | public static string Books_Book { 103 | get { 104 | return ResourceManager.GetString("Books_Book", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to Books. 110 | /// 111 | public static string Books_Books { 112 | get { 113 | return ResourceManager.GetString("Books_Books", resourceCulture); 114 | } 115 | } 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Resources/Books.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Book 122 | 123 | 124 | Books 125 | 126 | 127 | Author 128 | 129 | 130 | The Author field is required 131 | 132 | 133 | Title 134 | 135 | 136 | The Title field is required 137 | 138 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Resources/Language.Designer.cs.pp: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.261 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace $rootnamespace$.Resources { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | public class Language { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Language() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | public static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("$rootnamespace$.Resources.Language", typeof(Language).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | public static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | 63 | /// 64 | /// Looks up a localized string similar to Your quintessential app description page.. 65 | /// 66 | public static string About_Title { 67 | get { 68 | return ResourceManager.GetString("About_Title", resourceCulture); 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to Confirm new password. 74 | /// 75 | public static string ChangePasswordModel_ConfirmPassword { 76 | get { 77 | return ResourceManager.GetString("ChangePasswordModel_ConfirmPassword", resourceCulture); 78 | } 79 | } 80 | 81 | /// 82 | /// Looks up a localized string similar to The new password and confirmation password do not match.. 83 | /// 84 | public static string ChangePasswordModel_ConfirmPassword_Compare { 85 | get { 86 | return ResourceManager.GetString("ChangePasswordModel_ConfirmPassword_Compare", resourceCulture); 87 | } 88 | } 89 | 90 | /// 91 | /// Looks up a localized string similar to New password. 92 | /// 93 | public static string ChangePasswordModel_NewPassword { 94 | get { 95 | return ResourceManager.GetString("ChangePasswordModel_NewPassword", resourceCulture); 96 | } 97 | } 98 | 99 | /// 100 | /// Looks up a localized string similar to The {0} must be at least {2} characters long.. 101 | /// 102 | public static string ChangePasswordModel_NewPassword_StringLength { 103 | get { 104 | return ResourceManager.GetString("ChangePasswordModel_NewPassword_StringLength", resourceCulture); 105 | } 106 | } 107 | 108 | /// 109 | /// Looks up a localized string similar to Current password. 110 | /// 111 | public static string ChangePasswordModel_OldPassword { 112 | get { 113 | return ResourceManager.GetString("ChangePasswordModel_OldPassword", resourceCulture); 114 | } 115 | } 116 | 117 | /// 118 | /// Looks up a localized string similar to Your quintessential contact page.. 119 | /// 120 | public static string Contact_Title { 121 | get { 122 | return ResourceManager.GetString("Contact_Title", resourceCulture); 123 | } 124 | } 125 | 126 | /// 127 | /// Looks up a localized string similar to This text came from the resource file. how cool is that.. 128 | /// 129 | public static string Demonstration_Alert { 130 | get { 131 | return ResourceManager.GetString("Demonstration_Alert", resourceCulture); 132 | } 133 | } 134 | 135 | /// 136 | /// Looks up a localized string similar to Modify this template to jump-start your ASP.NET application. 137 | /// 138 | public static string Index_Title { 139 | get { 140 | return ResourceManager.GetString("Index_Title", resourceCulture); 141 | } 142 | } 143 | 144 | /// 145 | /// Looks up a localized string similar to Back to List. 146 | /// 147 | public static string Global_BackToList { 148 | get { 149 | return ResourceManager.GetString("Global_BackToList", resourceCulture); 150 | } 151 | } 152 | 153 | /// 154 | /// Looks up a localized string similar to Create. 155 | /// 156 | public static string Global_Create { 157 | get { 158 | return ResourceManager.GetString("Global_Create", resourceCulture); 159 | } 160 | } 161 | 162 | /// 163 | /// Looks up a localized string similar to Create New. 164 | /// 165 | public static string Global_CreateNew { 166 | get { 167 | return ResourceManager.GetString("Global_CreateNew", resourceCulture); 168 | } 169 | } 170 | 171 | /// 172 | /// Looks up a localized string similar to Delete. 173 | /// 174 | public static string Global_Delete { 175 | get { 176 | return ResourceManager.GetString("Global_Delete", resourceCulture); 177 | } 178 | } 179 | 180 | /// 181 | /// Looks up a localized string similar to Are you sure you want to delete this?. 182 | /// 183 | public static string Global_DeleteConfirm { 184 | get { 185 | return ResourceManager.GetString("Global_DeleteConfirm", resourceCulture); 186 | } 187 | } 188 | 189 | /// 190 | /// Looks up a localized string similar to Details. 191 | /// 192 | public static string Global_Details { 193 | get { 194 | return ResourceManager.GetString("Global_Details", resourceCulture); 195 | } 196 | } 197 | 198 | /// 199 | /// Looks up a localized string similar to Edit. 200 | /// 201 | public static string Global_Edit { 202 | get { 203 | return ResourceManager.GetString("Global_Edit", resourceCulture); 204 | } 205 | } 206 | 207 | /// 208 | /// Looks up a localized string similar to Save. 209 | /// 210 | public static string Global_Save { 211 | get { 212 | return ResourceManager.GetString("Global_Save", resourceCulture); 213 | } 214 | } 215 | 216 | /// 217 | /// Looks up a localized string similar to Password. 218 | /// 219 | public static string LoginModel_Password { 220 | get { 221 | return ResourceManager.GetString("LoginModel_Password", resourceCulture); 222 | } 223 | } 224 | 225 | /// 226 | /// Looks up a localized string similar to Remember me?. 227 | /// 228 | public static string LoginModel_RememberMe { 229 | get { 230 | return ResourceManager.GetString("LoginModel_RememberMe", resourceCulture); 231 | } 232 | } 233 | 234 | /// 235 | /// Looks up a localized string similar to User name foo bar baz. 236 | /// 237 | public static string LoginModel_UserName { 238 | get { 239 | return ResourceManager.GetString("LoginModel_UserName", resourceCulture); 240 | } 241 | } 242 | 243 | /// 244 | /// Looks up a localized string similar to Code52 i18n Demo site. 245 | /// 246 | public static string Logo_Title { 247 | get { 248 | return ResourceManager.GetString("Logo_Title", resourceCulture); 249 | } 250 | } 251 | 252 | /// 253 | /// Looks up a localized string similar to My ASP.NET MVC Application. 254 | /// 255 | public static string Master_SiteTitle { 256 | get { 257 | return ResourceManager.GetString("Master_SiteTitle", resourceCulture); 258 | } 259 | } 260 | 261 | /// 262 | /// Looks up a localized string similar to About. 263 | /// 264 | public static string Menu_About { 265 | get { 266 | return ResourceManager.GetString("Menu_About", resourceCulture); 267 | } 268 | } 269 | 270 | /// 271 | /// Looks up a localized string similar to Books. 272 | /// 273 | public static string Menu_Books { 274 | get { 275 | return ResourceManager.GetString("Menu_Books", resourceCulture); 276 | } 277 | } 278 | 279 | /// 280 | /// Looks up a localized string similar to Contact. 281 | /// 282 | public static string Menu_Contact { 283 | get { 284 | return ResourceManager.GetString("Menu_Contact", resourceCulture); 285 | } 286 | } 287 | 288 | /// 289 | /// Looks up a localized string similar to Home. 290 | /// 291 | public static string Menu_Home { 292 | get { 293 | return ResourceManager.GetString("Menu_Home", resourceCulture); 294 | } 295 | } 296 | 297 | /// 298 | /// Looks up a localized string similar to Confirm new password. 299 | /// 300 | public static string RegisterModel_ConfirmPassword { 301 | get { 302 | return ResourceManager.GetString("RegisterModel_ConfirmPassword", resourceCulture); 303 | } 304 | } 305 | 306 | /// 307 | /// Looks up a localized string similar to The new password and confirmation password do not match.. 308 | /// 309 | public static string RegisterModel_ConfirmPassword_Compare { 310 | get { 311 | return ResourceManager.GetString("RegisterModel_ConfirmPassword_Compare", resourceCulture); 312 | } 313 | } 314 | 315 | /// 316 | /// Looks up a localized string similar to Password. 317 | /// 318 | public static string RegisterModel_Password { 319 | get { 320 | return ResourceManager.GetString("RegisterModel_Password", resourceCulture); 321 | } 322 | } 323 | 324 | /// 325 | /// Looks up a localized string similar to The {0} must be at least {2} characters long.. 326 | /// 327 | public static string RegisterModel_Password_StringLength { 328 | get { 329 | return ResourceManager.GetString("RegisterModel_Password_StringLength", resourceCulture); 330 | } 331 | } 332 | 333 | /// 334 | /// Looks up a localized string similar to User name. 335 | /// 336 | public static string RegisterModel_UserName { 337 | get { 338 | return ResourceManager.GetString("RegisterModel_UserName", resourceCulture); 339 | } 340 | } 341 | 342 | /// 343 | /// Looks up a localized string similar to Facebook. 344 | /// 345 | public static string Social_Facebook { 346 | get { 347 | return ResourceManager.GetString("Social_Facebook", resourceCulture); 348 | } 349 | } 350 | 351 | /// 352 | /// Looks up a localized string similar to Twitter. 353 | /// 354 | public static string Social_Twitter { 355 | get { 356 | return ResourceManager.GetString("Social_Twitter", resourceCulture); 357 | } 358 | } 359 | } 360 | } 361 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Resources/Language.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | Your quintessential app description page. 122 | 123 | 124 | Create New 125 | 126 | 127 | Confirm new password 128 | 129 | 130 | The new password and confirmation password do not match. 131 | 132 | 133 | New password 134 | 135 | 136 | The {0} must be at least {2} characters long. 137 | 138 | 139 | Current password 140 | 141 | 142 | Your quintessential contact page. 143 | 144 | 145 | This text came from the resource file. how cool is that. 146 | 147 | 148 | Modify this template to jump-start your ASP.NET application 149 | 150 | 151 | Password 152 | 153 | 154 | Remember me? 155 | 156 | 157 | User name foo bar baz 158 | 159 | 160 | Code52 i18n Demo site 161 | 162 | 163 | My ASP.NET MVC Application 164 | The title displayed on _Layout.cshtml 165 | 166 | 167 | About 168 | Main menu - link text - About 169 | 170 | 171 | Contact 172 | Main menu - link text - Contact 173 | 174 | 175 | Home 176 | Main menu - link text - Home 177 | 178 | 179 | Confirm new password 180 | 181 | 182 | The new password and confirmation password do not match. 183 | 184 | 185 | Password 186 | 187 | 188 | The {0} must be at least {2} characters long. 189 | 190 | 191 | User name 192 | 193 | 194 | Facebook 195 | A link to Facebook - title reads Facebook 196 | 197 | 198 | Twitter 199 | A link to Twitter - title reads Twitter 200 | 201 | 202 | Back to List 203 | 204 | 205 | Create 206 | 207 | 208 | Delete 209 | 210 | 211 | Are you sure you want to delete this? 212 | 213 | 214 | Details 215 | 216 | 217 | Edit 218 | 219 | 220 | Save 221 | 222 | 223 | Books 224 | 225 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Views/Account/ChangePassword.cshtml.pp: -------------------------------------------------------------------------------- 1 | @model $rootnamespace$.Models.Accounts.ChangePasswordModel 2 | 3 | @{ 4 | ViewBag.Title = "Change Password"; 5 | } 6 | 7 |
8 |

@ViewBag.Title.

9 |

Use the form below to change your password.

10 |
11 | 12 |

13 | New passwords are required to be a minimum of @Membership.MinRequiredPasswordLength characters in length. 14 |

15 | 16 | 17 | 18 | 19 | @using (Html.BeginForm()) { 20 | @Html.ValidationSummary(true, "Password change was unsuccessful. Please correct the errors and try again.") 21 | 22 |
23 | Change Password Form 24 |
    25 |
  1. 26 | @Html.LabelFor(m => m.OldPassword) 27 | @Html.PasswordFor(m => m.OldPassword) 28 | @Html.ValidationMessageFor(m => m.OldPassword) 29 |
  2. 30 |
  3. 31 | @Html.LabelFor(m => m.NewPassword) 32 | @Html.PasswordFor(m => m.NewPassword) 33 | @Html.ValidationMessageFor(m => m.NewPassword) 34 |
  4. 35 |
  5. 36 | @Html.LabelFor(m => m.ConfirmPassword) 37 | @Html.PasswordFor(m => m.ConfirmPassword) 38 | @Html.ValidationMessageFor(m => m.ConfirmPassword) 39 |
  6. 40 |
41 | 42 |
43 | } 44 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Views/Account/ChangePasswordSuccess.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Change Password"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |

Your password has been changed successfully.

8 |
9 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Views/Account/Login.cshtml.pp: -------------------------------------------------------------------------------- 1 | @model $rootnamespace$.Models.Accounts.LoginModel 2 | 3 | @{ 4 | ViewBag.Title = "Log in"; 5 | } 6 | 7 |
8 |

@ViewBag.Title.

9 |

Enter your user name and password below.

10 |
11 | 12 | 13 | 14 | 15 | @using (Html.BeginForm((string)ViewBag.FormAction, "Account")) { 16 | @Html.ValidationSummary(true, "Log in was unsuccessful. Please correct the errors and try again.") 17 | 18 |
19 | Log in Form 20 |
    21 |
  1. 22 | @Html.LabelFor(m => m.UserName) 23 | @Html.TextBoxFor(m => m.UserName) 24 | @Html.ValidationMessageFor(m => m.UserName) 25 |
  2. 26 |
  3. 27 | @Html.LabelFor(m => m.Password) 28 | @Html.PasswordFor(m => m.Password) 29 | @Html.ValidationMessageFor(m => m.Password) 30 |
  4. 31 |
  5. 32 | @Html.CheckBoxFor(m => m.RememberMe) 33 | @Html.LabelFor(m => m.RememberMe, new { @class = "checkbox" }) 34 |
  6. 35 |
36 | 37 |
38 |

39 | @Html.ActionLink("Register", "Register") if you don't have an account. 40 |

41 | } 42 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Views/Account/Register.cshtml.pp: -------------------------------------------------------------------------------- 1 | @model $rootnamespace$.Models.Accounts.RegisterModel 2 | 3 | @{ 4 | ViewBag.Title = "Register"; 5 | } 6 | 7 |
8 |

@ViewBag.Title.

9 |

Use the form below to create a new account.

10 |
11 | 12 |

13 | Passwords are required to be a minimum of @Membership.MinRequiredPasswordLength characters in length. 14 |

15 | 16 | 17 | 18 | 19 | @using (Html.BeginForm((string)ViewBag.FormAction, "Account")) { 20 | @Html.ValidationSummary(true, "Account creation was unsuccessful. Please correct the errors and try again.") 21 | 22 |
23 | Registration Form 24 |
    25 |
  1. 26 | @Html.LabelFor(m => m.UserName) 27 | @Html.TextBoxFor(m => m.UserName) 28 | @Html.ValidationMessageFor(m => m.UserName) 29 |
  2. 30 |
  3. 31 | @Html.LabelFor(m => m.Email) 32 | @Html.TextBoxFor(m => m.Email) 33 | @Html.ValidationMessageFor(m => m.Email) 34 |
  4. 35 |
  5. 36 | @Html.LabelFor(m => m.Password) 37 | @Html.PasswordFor(m => m.Password) 38 | @Html.ValidationMessageFor(m => m.Password) 39 |
  6. 40 |
  7. 41 | @Html.LabelFor(m => m.ConfirmPassword) 42 | @Html.PasswordFor(m => m.ConfirmPassword) 43 | @Html.ValidationMessageFor(m => m.ConfirmPassword) 44 |
  8. 45 |
46 | 47 |
48 | } 49 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Views/Books/Create.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using $rootnamespace$.Resources 2 | 3 | @model $rootnamespace$.Models.Book 4 | 5 | @{ 6 | ViewBag.Title = "Create"; 7 | Layout = "~/Views/Shared/_Layout.cshtml"; 8 | } 9 | 10 |

@Language.Global_Create

11 | 12 | 13 | 14 | 15 | @using (Html.BeginForm()) { 16 | @Html.ValidationSummary(true) 17 | 18 |
19 | @Books.Books_Book 20 | 21 |
22 | @Html.LabelFor(model => model.Title) 23 |
24 |
25 | @Html.EditorFor(model => model.Title) 26 | @Html.ValidationMessageFor(model => model.Title) 27 |
28 | 29 |
30 | @Html.LabelFor(model => model.Author) 31 |
32 |
33 | @Html.EditorFor(model => model.Author) 34 | @Html.ValidationMessageFor(model => model.Author) 35 |
36 | 37 |

38 | 39 |

40 |
41 | } 42 | 43 |
44 | @Html.ActionLink(@Language.Global_BackToList, "Index") 45 |
46 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Views/Books/Delete.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using $rootnamespace$.Resources 2 | 3 | @model $rootnamespace$.Models.Book 4 | 5 | @{ 6 | ViewBag.Title = "Delete"; 7 | Layout = "~/Views/Shared/_Layout.cshtml"; 8 | } 9 | 10 |

@Language.Global_Delete

11 | 12 |

@Language.Global_DeleteConfirm

13 |
14 | @Books.Books_Book 15 | 16 |
17 | @Html.DisplayNameFor(model => model.Title) 18 |
19 |
20 | @Html.DisplayFor(model => model.Title) 21 |
22 | 23 |
24 | @Html.DisplayNameFor(model => model.Author) 25 |
26 |
27 | @Html.DisplayFor(model => model.Author) 28 |
29 |
30 | @using (Html.BeginForm()) { 31 |

32 | | 33 | @Html.ActionLink(@Language.Global_BackToList, "Index") 34 |

35 | } 36 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Views/Books/Details.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using $rootnamespace$.Resources 2 | 3 | @model $rootnamespace$.Models.Book 4 | 5 | @{ 6 | ViewBag.Title = "Details"; 7 | Layout = "~/Views/Shared/_Layout.cshtml"; 8 | } 9 | 10 |

@Language.Global_Details

11 | 12 |
13 | @Books.Books_Book 14 | 15 |
16 | @Html.DisplayNameFor(model => model.Title) 17 |
18 |
19 | @Html.DisplayFor(model => model.Title) 20 |
21 | 22 |
23 | @Html.DisplayNameFor(model => model.Author) 24 |
25 |
26 | @Html.DisplayFor(model => model.Author) 27 |
28 |
29 |

30 | @Html.ActionLink(@Language.Global_Edit, "Edit", new { id=Model.Id }) | 31 | @Html.ActionLink(@Language.Global_BackToList, "Index") 32 |

33 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Views/Books/Edit.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using $rootnamespace$.Resources 2 | 3 | @model $rootnamespace$.Models.Book 4 | 5 | @{ 6 | ViewBag.Title = "Edit"; 7 | Layout = "~/Views/Shared/_Layout.cshtml"; 8 | } 9 | 10 |

@Language.Global_Edit

11 | 12 | 13 | 14 | 15 | @using (Html.BeginForm()) { 16 | @Html.ValidationSummary(true) 17 | 18 |
19 | @Books.Books_Book 20 | 21 | @Html.HiddenFor(model => model.Id) 22 | 23 |
24 | @Html.LabelFor(model => model.Title) 25 |
26 |
27 | @Html.EditorFor(model => model.Title) 28 | @Html.ValidationMessageFor(model => model.Title) 29 |
30 | 31 |
32 | @Html.LabelFor(model => model.Author) 33 |
34 |
35 | @Html.EditorFor(model => model.Author) 36 | @Html.ValidationMessageFor(model => model.Author) 37 |
38 | 39 |

40 | 41 |

42 |
43 | } 44 | 45 |
46 | @Html.ActionLink(@Language.Global_BackToList, "Index") 47 |
48 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Views/Books/Index.cshtml.pp: -------------------------------------------------------------------------------- 1 | @using $rootnamespace$.Resources 2 | 3 | @model IEnumerable<$rootnamespace$.Models.Book> 4 | 5 | @{ 6 | ViewBag.Title = "Index"; 7 | Layout = "~/Views/Shared/_Layout.cshtml"; 8 | } 9 | 10 |

@Books.Books_Books

11 | 12 |

13 | @Html.ActionLink(Language.Global_CreateNew, "Create") 14 |

15 | 16 | 17 | 20 | 23 | 24 | 25 | 26 | @foreach (var item in Model) { 27 | 28 | 31 | 34 | 39 | 40 | } 41 | 42 |
18 | @Html.DisplayNameFor(model => model.Title) 19 | 21 | @Html.DisplayNameFor(model => model.Author) 22 |
29 | @Html.DisplayFor(modelItem => item.Title) 30 | 32 | @Html.DisplayFor(modelItem => item.Author) 33 | 35 | @Html.ActionLink(@Language.Global_Edit, "Edit", new { id=item.Id }) | 36 | @Html.ActionLink(@Language.Global_Details, "Details", new { id=item.Id }) | 37 | @Html.ActionLink(@Language.Global_Delete, "Delete", new { id=item.Id }) 38 |
43 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |

@ViewBag.Message

8 |
9 | 10 |
11 |

12 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin luctus tincidunt justo nec tempor. 13 | Aliquam erat volutpat. Fusce facilisis ullamcorper consequat. Vestibulum non sapien lectus. Nam 14 | mi augue, posuere at tempus vel, dignissim vitae nulla. Nullam at quam eu sapien mattis ultrices. 15 | Quisque quis leo mi, at lobortis dolor. Nullam scelerisque facilisis placerat. Fusce a augue 16 | erat, malesuada euismod dui. Duis iaculis risus id felis volutpat elementum. Fusce blandit iaculis 17 | quam a cursus. Cras varius tincidunt cursus. Morbi justo eros, adipiscing ac placerat sed, posuere 18 | et mi. Suspendisse vulputate viverra aliquet. Duis non enim a nibh consequat mollis ac tempor 19 | lorem. Phasellus elit leo, semper eu luctus et, suscipit at lacus. In hac habitasse platea 20 | dictumst. Duis dignissim justo sit amet nulla pulvinar sodales. 21 |

22 | 23 |

24 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin luctus tincidunt justo nec tempor. 25 | Aliquam erat volutpat. Fusce facilisis ullamcorper consequat. Vestibulum non sapien lectus. Nam 26 | mi augue, posuere at tempus vel, dignissim vitae nulla. Nullam at quam eu sapien mattis ultrices. 27 | Quisque quis leo mi, at lobortis dolor. Nullam scelerisque facilisis placerat. Fusce a augue 28 | erat, malesuada euismod dui. Duis iaculis risus id felis volutpat elementum. Fusce blandit iaculis 29 | quam a cursus. Cras varius tincidunt cursus. Morbi justo eros, adipiscing ac placerat sed, posuere 30 | et mi. Suspendisse vulputate viverra aliquet. Duis non enim a nibh consequat mollis ac tempor 31 | lorem. Phasellus elit leo, semper eu luctus et, suscipit at lacus. In hac habitasse platea 32 | dictumst. Duis dignissim justo sit amet nulla pulvinar sodales. 33 |

34 | 35 |

36 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin luctus tincidunt justo nec tempor. 37 | Aliquam erat volutpat. Fusce facilisis ullamcorper consequat. Vestibulum non sapien lectus. Nam 38 | mi augue, posuere at tempus vel, dignissim vitae nulla. Nullam at quam eu sapien mattis ultrices. 39 | Quisque quis leo mi, at lobortis dolor. Nullam scelerisque facilisis placerat. Fusce a augue 40 | erat, malesuada euismod dui. Duis iaculis risus id felis volutpat elementum. Fusce blandit iaculis 41 | quam a cursus. Cras varius tincidunt cursus. Morbi justo eros, adipiscing ac placerat sed, posuere 42 | et mi. Suspendisse vulputate viverra aliquet. Duis non enim a nibh consequat mollis ac tempor 43 | lorem. Phasellus elit leo, semper eu luctus et, suscipit at lacus. In hac habitasse platea 44 | dictumst. Duis dignissim justo sit amet nulla pulvinar sodales. 45 |

46 |
47 | 48 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |

@ViewBag.Message

8 |
9 | 10 |
11 |
12 |

Phone:

13 |
14 |

15 | Main: 16 | 425.555.0100 17 |

18 |

19 | After Hours: 20 | 425.555.0199 21 |

22 |
23 | 24 |
25 |
26 |

Email:

27 |
28 |

29 | Support: 30 | Support@example.com 31 |

32 |

33 | Marketing: 34 | Marketing@example.com 35 |

36 |

37 | General: 38 | General@example.com 39 |

40 |
41 | 42 |
43 |
44 |

Address:

45 |
46 |

47 | One Microsoft Way
48 | Redmond, WA 98052-6399 49 |

50 |
-------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Home Page"; 3 | } 4 | 15 | 26 | -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/Content/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @if (Request.IsAuthenticated) { 2 |

3 | Hello, @Html.ActionLink(User.Identity.Name, "ChangePassword", "Account", routeValues: null, htmlAttributes: new { @class = "username", title = "Change password" })! 4 | @Html.ActionLink("Log off", "LogOff", "Account") 5 |

6 | } else { 7 |
    8 |
  • @Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink", data_dialog_title = "Registration" })
  • 9 |
  • @Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink", data_dialog_title = "Identification" })
  • 10 |
11 | } -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/NuSpec/tools/install.ps1: -------------------------------------------------------------------------------- 1 | param($installPath, $toolsPath, $package, $project) 2 | #script to fix code-behind for resx 3 | set-alias Write-Host -Name whecho 4 | whecho "Restoring resource code-behinds (this may cause the project to be reloaded with a dialog) ..." 5 | $resitems = @{} 6 | foreach ($item in $project.ProjectItems) 7 | { 8 | if ($item.Name -eq "Resources") { 9 | $resources = $item 10 | foreach ($resitem in $resources.ProjectItems) { 11 | $codebehinditem = $NULL 12 | if ($resitem.Name.ToLower().EndsWith(".resx")) { 13 | $hasCodeBehind = $FALSE 14 | switch ($item.ProjectItems) { default { 15 | if ($_.Name.ToLower() -eq $resitem.Name.ToLower().Replace(".resx", ".designer.cs")) { 16 | $hasCodeBehind = $TRUE 17 | $codebehinditem = $_ 18 | } 19 | }} 20 | if ($hasCodeBehind -eq $TRUE) { 21 | $fn = $resitem.FileNames(0) 22 | $cbfn = $codebehinditem.FileNames(0) 23 | $codebehinditem.Remove() 24 | $cb2 = $resitem.ProjectItems.AddFromFile($cbfn) 25 | } 26 | $resitems.Add("Resources\" + $resitem.Name, $resitem.FileNames(0)) 27 | whecho $resitem.Name 28 | } 29 | } 30 | } 31 | } 32 | $project.Save($project.FullName) 33 | $projxml = [xml](get-content $project.FullName) 34 | $ns = New-Object System.Xml.XmlNamespaceManager $projxml.NameTable 35 | $defns = "http://schemas.microsoft.com/developer/msbuild/2003" 36 | $ns.AddNamespace("csproj", $defns) 37 | foreach ($item in $resitems.GetEnumerator()) { 38 | $xpath = "//csproj:Project/csproj:ItemGroup/csproj:Compile[@Include=`"" + $item.Name.Replace(".resx", ".Designer.cs") + "`"]" 39 | $resxDesignerNode = $projxml.SelectSingleNode($xpath, $ns) 40 | 41 | if ($resxDesignerNode -ne $NULL) { 42 | 43 | $autogen = $projxml.CreateElement('AutoGen', $defns) 44 | $autogen.InnerText = 'True' 45 | $resxDesignerNode.AppendChild($autogen) 46 | 47 | $designtime = $projxml.CreateElement('DesignTime', $defns) 48 | $designtime.InnerText = 'True' 49 | $resxDesignerNode.AppendChild($designtime) 50 | } 51 | 52 | $xpath = "//csproj:Project/csproj:ItemGroup/csproj:EmbeddedResource[@Include=`"" + $item.Name + "`"]" 53 | $resxNode = $projxml.SelectSingleNode($xpath, $ns) 54 | 55 | $generator = $projxml.CreateElement('Generator', $defns) 56 | $generator.InnerText = 'PublicResXFileCodeGenerator' 57 | $resxNode.AppendChild($generator) 58 | 59 | if ($resxDesignerNode -ne $NULL) { 60 | $lastGenOutput = $projxml.CreateElement('LastGenOutput', $defns) 61 | $lastGenOutput.InnerText = $item.Name.Replace("Resources\", "").Replace(".resx", ".Designer.cs") 62 | $resxNode.AppendChild($lastGenOutput) 63 | } 64 | } 65 | 66 | $projxml.Save($project.FullName) -------------------------------------------------------------------------------- /src/Code52.i18n.MVC4.Example/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Code52.i18n.MVC4")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Code52.i18n.MVC4")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("27360ed5-ec04-4429-8d1f-7d2044798665")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /src/Code52.i18n.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Code52.i18n.MVC", "Code52.i18n.MVC\Code52.i18n.MVC.csproj", "{EFA9A1CD-06FF-41EC-9B2B-BA5EE890D2A5}" 5 | EndProject 6 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{FCE44442-3448-49C2-925B-60A4940D7E60}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Code52.i18n.MVC3.Example", "Code52.i18n.MVC3.Example\Code52.i18n.MVC3.Example.csproj", "{AB508CF3-5988-4275-B29F-3E192836F166}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Code52.i18n.MVC4.Example", "Code52.i18n.MVC4.Example\Code52.i18n.MVC4.Example.csproj", "{1554DFF2-E628-47DE-B2F6-720F316A3298}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {EFA9A1CD-06FF-41EC-9B2B-BA5EE890D2A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {EFA9A1CD-06FF-41EC-9B2B-BA5EE890D2A5}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {EFA9A1CD-06FF-41EC-9B2B-BA5EE890D2A5}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {EFA9A1CD-06FF-41EC-9B2B-BA5EE890D2A5}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {AB508CF3-5988-4275-B29F-3E192836F166}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {AB508CF3-5988-4275-B29F-3E192836F166}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {AB508CF3-5988-4275-B29F-3E192836F166}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {AB508CF3-5988-4275-B29F-3E192836F166}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {1554DFF2-E628-47DE-B2F6-720F316A3298}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {1554DFF2-E628-47DE-B2F6-720F316A3298}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {1554DFF2-E628-47DE-B2F6-720F316A3298}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {1554DFF2-E628-47DE-B2F6-720F316A3298}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(NestedProjects) = preSolution 35 | {AB508CF3-5988-4275-B29F-3E192836F166} = {FCE44442-3448-49C2-925B-60A4940D7E60} 36 | {1554DFF2-E628-47DE-B2F6-720F316A3298} = {FCE44442-3448-49C2-925B-60A4940D7E60} 37 | EndGlobalSection 38 | EndGlobal 39 | -------------------------------------------------------------------------------- /src/Code52.i18n.zreproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <XtraSerializer version="1.0" application="View"> 5 | <property name="#LayoutVersion" /> 6 | <property name="ActiveFilterString" /> 7 | </XtraSerializer> 8 | <XtraSerializer version="1.0" application="View"> 9 | <property name="#LayoutVersion" /> 10 | </XtraSerializer> 11 | #### 12 | False 13 | -1 14 | 15 | 16 | False 17 | False 18 | 0 19 | True 20 | False 21 | True 22 | True 23 | True 24 | True 25 | [basename][optionaldefaulttypes].[extension] 26 | [basename][optionaldefaulttypes].[languagecode].[extension] 27 | 0 28 | .aspx;.ascx;.asmx;.master;.sitemap 29 | True 30 | True 31 | True 32 | #### 33 | False 34 | 0 35 | 180 36 | True 37 | False 38 | <?xml version='1.0' encoding='utf-8'?><items><item type="0" checksum="1495344443" /><item type="2" checksum="4824944858" /></items> 39 | C:\Projects\internationalization-mvc4\src\Code52.i18n.MVC4.Sample.CSharp\Resources 40 | 41 | 42 | C:\Projects\internationalization-mvc4\src\Code52.i18n.MVC4.Sample.CSharp\Resources\Language.resx;C:\Projects\internationalization-mvc4\src\Code52.i18n.MVC4.Sample.CSharp\Resources\Language.en-US.resx;C:\Projects\internationalization-mvc4\src\Code52.i18n.MVC4.Sample.CSharp\Resources\Language.fr.resx;C:\Projects\internationalization-mvc4\src\Code52.i18n.MVC4.Sample.CSharp\Resources\Language.pl.resx###***###C:\Projects\internationalization-mvc4\src\Code52.i18n.MVC4.Sample.CSharp\Resources\Language.resx;C:\Projects\internationalization-mvc4\src\Code52.i18n.MVC4.Sample.CSharp\Resources\Language.en-US.resx;C:\Projects\internationalization-mvc4\src\Code52.i18n.MVC4.Sample.CSharp\Resources\Language.fr.resx;C:\Projects\internationalization-mvc4\src\Code52.i18n.MVC4.Sample.CSharp\Resources\Language.pl.resx###***###C:\Projects\internationalization-mvc4\src\Code52.i18n.MVC4.Sample.CSharp\Resources\Language.resx;C:\Projects\internationalization-mvc4\src\Code52.i18n.MVC4.Sample.CSharp\Resources\Language.en-US.resx;C:\Projects\internationalization-mvc4\src\Code52.i18n.MVC4.Sample.CSharp\Resources\Language.fr.resx;C:\Projects\internationalization-mvc4\src\Code52.i18n.MVC4.Sample.CSharp\Resources\Language.pl.resx 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | --------------------------------------------------------------------------------