fixing 2704 -- Rename LanguageViewLocationExpanderOption to LanguageViewLocationExpanderFormat

This commit is contained in:
Mugdha Kulkarni 2015-07-08 14:24:29 -07:00
parent 2d62553122
commit 8cb2aae4f5
6 changed files with 20 additions and 20 deletions

View File

@ -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

View File

@ -25,23 +25,23 @@ namespace Microsoft.AspNet.Mvc.Razor
public class LanguageViewLocationExpander : IViewLocationExpander
{
private const string ValueKey = "language";
private LanguageViewLocationExpanderOption _option;
private LanguageViewLocationExpanderFormat _format;
/// <summary>
/// Instantiates a new <see cref="LanguageViewLocationExpander"/> instance.
/// </summary>
public LanguageViewLocationExpander()
: this(LanguageViewLocationExpanderOption.Suffix)
: this(LanguageViewLocationExpanderFormat.Suffix)
{
}
/// <summary>
/// Instantiates a new <see cref="DefaultTagHelperActivator"/> instance.
/// </summary>
/// <param name="option">The <see cref="LanguageViewLocationExpanderOption"/>.</param>
public LanguageViewLocationExpander(LanguageViewLocationExpanderOption option)
/// <param name="format">The <see cref="LanguageViewLocationExpanderFormat"/>.</param>
public LanguageViewLocationExpander(LanguageViewLocationExpanderFormat format)
{
_option = option;
_format = format;
}
/// <inheritdoc />
@ -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}");
}

View File

@ -6,10 +6,10 @@ namespace Microsoft.AspNet.Mvc.Razor
/// <summary>
/// Specifies the localized view format for <see cref="LanguageViewLocationExpander"/>.
/// </summary>
public enum LanguageViewLocationExpanderOption
public enum LanguageViewLocationExpanderFormat
{
/// <summary>
/// Locale is a subfolder under which the view exisits.
/// Locale is a subfolder under which the view exists.
/// </summary>
/// <example>
/// Home/Views/en-US/Index.chtml

View File

@ -108,22 +108,22 @@ namespace Microsoft.Framework.DependencyInjection
/// <returns>The <see cref="IServiceCollection"/>.</returns>
public static IServiceCollection AddMvcLocalization([NotNull] this IServiceCollection services)
{
return AddMvcLocalization(services, LanguageViewLocationExpanderOption.Suffix);
return AddMvcLocalization(services, LanguageViewLocationExpanderFormat.Suffix);
}
/// <summary>
/// Adds Mvc localization to the application.
/// </summary>
/// <param name="services">The <see cref="IServiceCollection"/>.</param>
/// <param name="option">The view format for localized views.</param>
/// <param name="format">The view format for localized views.</param>
/// <returns>The <see cref="IServiceCollection"/>.</returns>
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;

View File

@ -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<string> viewLocations,
IEnumerable<string> expectedViewLocations)
{
// Arrange
var viewLocationExpanderContext = new ViewLocationExpanderContext(new ActionContext(),"testView", false);
var languageViewLocationExpander = new LanguageViewLocationExpander(option);
var languageViewLocationExpander = new LanguageViewLocationExpander(format);
viewLocationExpanderContext.Values = new Dictionary<string, string>();
viewLocationExpanderContext.Values["language"] = "en-GB";

View File

@ -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)