diff --git a/samples/MvcSample.Web/Startup.cs b/samples/MvcSample.Web/Startup.cs index 7106abd18c..d71c36852d 100644 --- a/samples/MvcSample.Web/Startup.cs +++ b/samples/MvcSample.Web/Startup.cs @@ -46,7 +46,7 @@ namespace MvcSample.Web options.Filters.Add(new FormatFilterAttribute()); }); - services.AddMvcLocalization(LanguageViewLocationExpanderOption.SubFolder); + services.AddMvcLocalization(LanguageViewLocationExpanderFormat.SubFolder); #if DNX451 // Fully-qualify configuration path to avoid issues in functional tests. Just "config.json" would be fine diff --git a/src/Microsoft.AspNet.Mvc.Razor/LanguageViewLocationExpander.cs b/src/Microsoft.AspNet.Mvc.Razor/LanguageViewLocationExpander.cs index 3fcc576e6d..2e9ecdc692 100644 --- a/src/Microsoft.AspNet.Mvc.Razor/LanguageViewLocationExpander.cs +++ b/src/Microsoft.AspNet.Mvc.Razor/LanguageViewLocationExpander.cs @@ -25,23 +25,23 @@ namespace Microsoft.AspNet.Mvc.Razor public class LanguageViewLocationExpander : IViewLocationExpander { private const string ValueKey = "language"; - private LanguageViewLocationExpanderOption _option; + private LanguageViewLocationExpanderFormat _format; /// /// Instantiates a new instance. /// public LanguageViewLocationExpander() - : this(LanguageViewLocationExpanderOption.Suffix) + : this(LanguageViewLocationExpanderFormat.Suffix) { } /// /// Instantiates a new instance. /// - /// The . - public LanguageViewLocationExpander(LanguageViewLocationExpanderOption option) + /// The . + public LanguageViewLocationExpander(LanguageViewLocationExpanderFormat format) { - _option = option; + _format = format; } /// @@ -89,7 +89,7 @@ namespace Microsoft.AspNet.Mvc.Razor while (temporaryCultureInfo != temporaryCultureInfo.Parent) { - if (_option == LanguageViewLocationExpanderOption.SubFolder) + if (_format == LanguageViewLocationExpanderFormat.SubFolder) { yield return location.Replace("{0}", temporaryCultureInfo.Name + "/{0}"); } diff --git a/src/Microsoft.AspNet.Mvc.Razor/LanguageViewLocationExpanderOption.cs b/src/Microsoft.AspNet.Mvc.Razor/LanguageViewLocationExpanderFormat.cs similarity index 86% rename from src/Microsoft.AspNet.Mvc.Razor/LanguageViewLocationExpanderOption.cs rename to src/Microsoft.AspNet.Mvc.Razor/LanguageViewLocationExpanderFormat.cs index 71f663e959..57c13145f7 100644 --- a/src/Microsoft.AspNet.Mvc.Razor/LanguageViewLocationExpanderOption.cs +++ b/src/Microsoft.AspNet.Mvc.Razor/LanguageViewLocationExpanderFormat.cs @@ -6,10 +6,10 @@ namespace Microsoft.AspNet.Mvc.Razor /// /// Specifies the localized view format for . /// - public enum LanguageViewLocationExpanderOption + public enum LanguageViewLocationExpanderFormat { /// - /// Locale is a subfolder under which the view exisits. + /// Locale is a subfolder under which the view exists. /// /// /// Home/Views/en-US/Index.chtml diff --git a/src/Microsoft.AspNet.Mvc/MvcServiceCollectionExtensions.cs b/src/Microsoft.AspNet.Mvc/MvcServiceCollectionExtensions.cs index 206478cc81..8381251f0e 100644 --- a/src/Microsoft.AspNet.Mvc/MvcServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNet.Mvc/MvcServiceCollectionExtensions.cs @@ -108,22 +108,22 @@ namespace Microsoft.Framework.DependencyInjection /// The . public static IServiceCollection AddMvcLocalization([NotNull] this IServiceCollection services) { - return AddMvcLocalization(services, LanguageViewLocationExpanderOption.Suffix); + return AddMvcLocalization(services, LanguageViewLocationExpanderFormat.Suffix); } /// /// Adds Mvc localization to the application. /// /// The . - /// The view format for localized views. + /// The view format for localized views. /// The . public static IServiceCollection AddMvcLocalization( [NotNull] this IServiceCollection services, - LanguageViewLocationExpanderOption option) + LanguageViewLocationExpanderFormat format) { services.ConfigureRazorViewEngine(options => { - options.ViewLocationExpanders.Add(new LanguageViewLocationExpander(option)); + options.ViewLocationExpanders.Add(new LanguageViewLocationExpander(format)); }); return services; diff --git a/test/Microsoft.AspNet.Mvc.Razor.Test/LanguageViewLocationExpanderTest.cs b/test/Microsoft.AspNet.Mvc.Razor.Test/LanguageViewLocationExpanderTest.cs index 807b54f6f9..3b039c94d5 100644 --- a/test/Microsoft.AspNet.Mvc.Razor.Test/LanguageViewLocationExpanderTest.cs +++ b/test/Microsoft.AspNet.Mvc.Razor.Test/LanguageViewLocationExpanderTest.cs @@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Mvc.Razor { yield return new object[] { - LanguageViewLocationExpanderOption.Suffix, + LanguageViewLocationExpanderFormat.Suffix, new[] { "/Views/{1}/{0}.cshtml", @@ -33,7 +33,7 @@ namespace Microsoft.AspNet.Mvc.Razor yield return new object[] { - LanguageViewLocationExpanderOption.SubFolder, + LanguageViewLocationExpanderFormat.SubFolder, new[] { "/Views/{1}/{0}.cshtml", @@ -52,7 +52,7 @@ namespace Microsoft.AspNet.Mvc.Razor yield return new object[] { - LanguageViewLocationExpanderOption.Suffix, + LanguageViewLocationExpanderFormat.Suffix, new[] { "/Areas/{2}/Views/{1}/{0}.cshtml", @@ -75,7 +75,7 @@ namespace Microsoft.AspNet.Mvc.Razor yield return new object[] { - LanguageViewLocationExpanderOption.SubFolder, + LanguageViewLocationExpanderFormat.SubFolder, new[] { "/Areas/{2}/Views/{1}/{0}.cshtml", @@ -126,13 +126,13 @@ namespace Microsoft.AspNet.Mvc.Razor [Theory] [MemberData(nameof(ViewLocationExpanderTestDataWithExpectedValues))] public void ExpandViewLocations_SpecificLocale( - LanguageViewLocationExpanderOption option, + LanguageViewLocationExpanderFormat format, IEnumerable viewLocations, IEnumerable expectedViewLocations) { // Arrange var viewLocationExpanderContext = new ViewLocationExpanderContext(new ActionContext(),"testView", false); - var languageViewLocationExpander = new LanguageViewLocationExpander(option); + var languageViewLocationExpander = new LanguageViewLocationExpander(format); viewLocationExpanderContext.Values = new Dictionary(); viewLocationExpanderContext.Values["language"] = "en-GB"; diff --git a/test/WebSites/RazorWebSite/Startup.cs b/test/WebSites/RazorWebSite/Startup.cs index cd417a9e6e..582e35c42c 100644 --- a/test/WebSites/RazorWebSite/Startup.cs +++ b/test/WebSites/RazorWebSite/Startup.cs @@ -32,7 +32,7 @@ namespace RazorWebSite options.HtmlHelperOptions.ValidationMessageElement = "validationMessageElement"; options.HtmlHelperOptions.ValidationSummaryMessageElement = "validationSummaryElement"; }); - services.AddMvcLocalization(LanguageViewLocationExpanderOption.SubFolder); + services.AddMvcLocalization(LanguageViewLocationExpanderFormat.SubFolder); } public void Configure(IApplicationBuilder app)