Skip to content

Commit

Permalink
chore: More culture debugging stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
vyruz1986 committed Oct 7, 2023
1 parent 22df7a5 commit b6f92a0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Web/Pages/Public/About.razor
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
</p>

<h2>Culture info</h2>

<p>Available cultures:</p>
<select T="System.Globalization.CultureInfo" @bind="Culture" AnchorOrigin="Origin.BottomCenter">
@foreach (var culture in _supportedCultures)
{
<option Value="@culture">@culture.DisplayName</option>
}
</select>
<p>Amount test: @TestAmount.ToString("C", Culture)</p>

<p>Current UI culture: @CultureInfo.CurrentUICulture.DisplayName</p>
<p>Amount test: @TestAmount.ToString("C", CultureInfo.CurrentUICulture)</p>

Expand All @@ -40,6 +50,8 @@
private IEnumerable<Claim> claims = Enumerable.Empty<Claim>();

private decimal TestAmount = 123.56M;
private CultureInfo[] _supportedCultures = Array.Empty<CultureInfo>();
private CultureInfo Culture { get; set; }

private string _version
{
Expand All @@ -66,5 +78,11 @@
{
authMessage = "The user is NOT authenticated.";
}

_supportedCultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures)
.Where(cul => !string.IsNullOrEmpty(cul.Name))
.ToArray();

Culture = CultureInfo.CurrentUICulture;
}
}

0 comments on commit b6f92a0

Please sign in to comment.