Skip to content

Commit

Permalink
fix!: Set also UICulture (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtrion authored Feb 16, 2024
1 parent 5be5581 commit fa02134
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@ IAttributeInfo traitAttribute

var culture = GetNamedArgument(traitAttribute, Internals.Culture);
yield return new KeyValuePair<string, string>(category!, culture!);

if (category!.Equals("SetCulture", System.StringComparison.Ordinal))
{
yield return new KeyValuePair<string, string>("SetUICulture", culture!);
}
}
}
2 changes: 1 addition & 1 deletion src/NetEvolve.Extensions.XUnit/SetCultureAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public SetCultureAttribute()
/// </summary>
/// <param name="culture">Culture to use.</param>
public SetCultureAttribute(string culture)
: this(culture, string.Empty) { }
: this(culture, culture) { }

/// <summary>
/// Initializes a new instance of the <see cref="SetCultureAttribute"/> class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class SetCultureAttributeTests : AttributeTestsBase
{
[Test]
[SetCulture("en")]
[SetUICulture("en")]
public async Task Execute_English()
{
var properties = GetProperties();
Expand All @@ -25,6 +26,7 @@ public async Task Execute_English()

[Test]
[SetCulture("")]
[SetUICulture("")]
public async Task Execute_Invariant()
{
var properties = GetProperties();
Expand All @@ -38,6 +40,7 @@ public async Task Execute_Invariant()

[Test]
[SetCulture("de")]
[SetUICulture("de")]
public async Task Execute_German()
{
var properties = GetProperties();
Expand All @@ -51,6 +54,7 @@ public async Task Execute_German()

[Test]
[SetCulture("de-DE")]
[SetUICulture("de-DE")]
public async Task Execute_German_Germany()
{
var properties = GetProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
{
SetCulture: en
},
{
SetUICulture: en
},
{
Translation: Hello World!
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
SetCulture: de
},
{
Translation: Hello World!
SetUICulture: de
},
{
Translation: Hallo Welt!
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
SetCulture: de-DE
},
{
Translation: Hello World!
SetUICulture: de-DE
},
{
Translation: Hallo Welt!
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
{
SetCulture:
},
{
SetUICulture:
},
{
Translation: Hello World!
}
Expand Down

0 comments on commit fa02134

Please sign in to comment.