diff --git a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ComponentResources.resx b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ComponentResources.resx
index f932064455..610c13afcf 100644
--- a/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ComponentResources.resx
+++ b/src/Razor/Microsoft.AspNetCore.Razor.Language/src/ComponentResources.resx
@@ -129,6 +129,9 @@
Binds the provided expression to the '{0}' property and a change event delegate to the '{1}' property of the component.
+
+ Specifies the culture to use for conversions.
+
Binds the provided expression to the '{0}' attribute and a change event delegate to the '{1}' attribute.
diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs
index 8ad405c6b5..8b1ba0a7a9 100644
--- a/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs
+++ b/src/Razor/Microsoft.CodeAnalysis.Razor/src/BindTagHelperDescriptorProvider.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.Linq;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.Language.Components;
@@ -177,6 +178,15 @@ namespace Microsoft.CodeAnalysis.Razor
parameter.SetPropertyName("Event");
});
+
+ attribute.BindAttributeParameter(parameter =>
+ {
+ parameter.Name = "culture";
+ parameter.TypeName = typeof(CultureInfo).FullName;
+ parameter.Documentation = ComponentResources.BindTagHelper_Element_Culture_Documentation;
+
+ parameter.SetPropertyName("Culture");
+ });
});
// This is no longer supported. This is just here so we can add a diagnostic later on when this matches.
@@ -381,6 +391,15 @@ namespace Microsoft.CodeAnalysis.Razor
parameter.SetPropertyName(eventName);
});
+
+ a.BindAttributeParameter(parameter =>
+ {
+ parameter.Name = "culture";
+ parameter.TypeName = typeof(CultureInfo).FullName;
+ parameter.Documentation = ComponentResources.BindTagHelper_Element_Culture_Documentation;
+
+ parameter.SetPropertyName("Culture");
+ });
});
// This is no longer supported. This is just here so we can add a diagnostic later on when this matches.
diff --git a/src/Razor/Microsoft.CodeAnalysis.Razor/test/BindTagHelperDescriptorProviderTest.cs b/src/Razor/Microsoft.CodeAnalysis.Razor/test/BindTagHelperDescriptorProviderTest.cs
index e037ab2fd1..dc8b6605ba 100644
--- a/src/Razor/Microsoft.CodeAnalysis.Razor/test/BindTagHelperDescriptorProviderTest.cs
+++ b/src/Razor/Microsoft.CodeAnalysis.Razor/test/BindTagHelperDescriptorProviderTest.cs
@@ -432,6 +432,28 @@ namespace Test
Assert.True(parameter.IsStringProperty);
Assert.False(parameter.IsBooleanProperty);
Assert.False(parameter.IsEnum);
+
+ parameter = Assert.Single(attribute.BoundAttributeParameters, a => a.Name.Equals("culture"));
+
+ // Invariants
+ Assert.Empty(parameter.Diagnostics);
+ Assert.False(parameter.HasErrors);
+ Assert.Equal(ComponentMetadata.Bind.TagHelperKind, parameter.Kind);
+ Assert.False(parameter.IsDefaultKind());
+
+ Assert.Equal(
+ "Specifies the culture to use for conversions.",
+ parameter.Documentation);
+
+ Assert.Equal("culture", parameter.Name);
+ Assert.Equal("Culture", parameter.GetPropertyName());
+ Assert.Equal(":culture", parameter.DisplayName);
+
+ // Defined from the property type
+ Assert.Equal("System.Globalization.CultureInfo", parameter.TypeName);
+ Assert.False(parameter.IsStringProperty);
+ Assert.False(parameter.IsBooleanProperty);
+ Assert.False(parameter.IsEnum);
}
[Fact]
@@ -847,8 +869,29 @@ namespace Test
Assert.True(parameter.IsStringProperty);
Assert.False(parameter.IsBooleanProperty);
Assert.False(parameter.IsEnum);
- }
+ parameter = Assert.Single(attribute.BoundAttributeParameters, a => a.Name.Equals("culture"));
+
+ // Invariants
+ Assert.Empty(parameter.Diagnostics);
+ Assert.False(parameter.HasErrors);
+ Assert.Equal(ComponentMetadata.Bind.TagHelperKind, parameter.Kind);
+ Assert.False(parameter.IsDefaultKind());
+
+ Assert.Equal(
+ "Specifies the culture to use for conversions.",
+ parameter.Documentation);
+
+ Assert.Equal("culture", parameter.Name);
+ Assert.Equal("Culture", parameter.GetPropertyName());
+ Assert.Equal(":culture", parameter.DisplayName);
+
+ // Defined from the property type
+ Assert.Equal("System.Globalization.CultureInfo", parameter.TypeName);
+ Assert.False(parameter.IsStringProperty);
+ Assert.False(parameter.IsBooleanProperty);
+ Assert.False(parameter.IsEnum);
+ }
private static TagHelperDescriptor[] GetBindTagHelpers(TagHelperDescriptorProviderContext context)
{