more localization tweaks

This commit is contained in:
RaidMax 2022-07-08 20:40:27 -05:00
parent 052eeb0615
commit 61df873bb1
4 changed files with 15 additions and 17 deletions

View File

@ -174,19 +174,17 @@ namespace SharedLibraryCore
public static string RemoveDiacritics(this string text) public static string RemoveDiacritics(this string text)
{ {
var normalizedString = text.Normalize(NormalizationForm.FormD); var normalizedString = text.Normalize(NormalizationForm.FormD);
var stringBuilder = new StringBuilder(normalizedString.Length); var stringBuilder = new StringBuilder();
foreach (var c in from c in normalizedString foreach (var c in from c in normalizedString.EnumerateRunes()
let unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(c) let unicodeCategory = Rune.GetUnicodeCategory(c)
where unicodeCategory != UnicodeCategory.NonSpacingMark where unicodeCategory != UnicodeCategory.NonSpacingMark
select c) select c)
{ {
stringBuilder.Append(c); stringBuilder.Append(c);
} }
return stringBuilder return stringBuilder.ToString().Normalize(NormalizationForm.FormC);
.ToString()
.Normalize(NormalizationForm.FormC);
} }
public static string FormatMessageForEngine(this string str, IRConParserConfiguration config) public static string FormatMessageForEngine(this string str, IRConParserConfiguration config)

View File

@ -487,7 +487,7 @@ namespace WebfrontCore.Controllers
{ {
var info = new ActionInfo var info = new ActionInfo
{ {
ActionButtonLabel = "Dismiss", ActionButtonLabel = Localization["WEBFRONT_ACTION_DISMISS_ALERT_FORM_SUBMIT"],
Name = Localization["WEBFRONT_ACTION_DISMISS_ALERT_SINGLE"], Name = Localization["WEBFRONT_ACTION_DISMISS_ALERT_SINGLE"],
Inputs = new List<InputInfo> Inputs = new List<InputInfo>
{ {
@ -521,7 +521,7 @@ namespace WebfrontCore.Controllers
{ {
var info = new ActionInfo var info = new ActionInfo
{ {
ActionButtonLabel = "Dismiss", ActionButtonLabel = Localization["WEBFRONT_ACTION_DISMISS_ALERT_FORM_SUBMIT"],
Name = Localization["WEBFRONT_ACTION_DISMISS_ALERT_MANY"], Name = Localization["WEBFRONT_ACTION_DISMISS_ALERT_MANY"],
Inputs = new List<InputInfo> Inputs = new List<InputInfo>
{ {
@ -555,14 +555,14 @@ namespace WebfrontCore.Controllers
{ {
var info = new ActionInfo var info = new ActionInfo
{ {
ActionButtonLabel = "Send", ActionButtonLabel = Localization["WEBFRONT_ACTION_OFFLINE_MESSAGE_FORM_SUBMIT"],
Name = Localization["WEBFRONT_ACTION_OFFLINE_MESSAGE_BUTTON_COMPOSE"], Name = Localization["WEBFRONT_ACTION_OFFLINE_MESSAGE_BUTTON_COMPOSE"],
Inputs = new List<InputInfo> Inputs = new List<InputInfo>
{ {
new() new()
{ {
Name = "message", Name = "message",
Label = "Message Content", Label = Localization["WEBFRONT_ACTION_OFFLINE_MESSAGE_FORM_CONTENT"],
}, },
}, },
Action = "OfflineMessage", Action = "OfflineMessage",

View File

@ -43,22 +43,22 @@
{ {
if (Model == EFPenalty.PenaltyType.Any) if (Model == EFPenalty.PenaltyType.Any)
{ {
<option value="@Convert.ToInt32(penaltyType)" selected="selected">@penaltyType.ToString()</option> <option value="@Convert.ToInt32(penaltyType)" selected="selected">@loc[$"WEBFRONT_PENALTY_{penaltyType.ToString().ToUpper()}"]</option>
} }
else else
{ {
<option value="@Convert.ToInt32(penaltyType)">@penaltyType.ToString()</option> <option value="@Convert.ToInt32(penaltyType)">@loc[$"WEBFRONT_PENALTY_{penaltyType.ToString().ToUpper()}"]</option>
} }
} }
else else
{ {
if (penaltyType == Model) if (penaltyType == Model)
{ {
<option value="@Convert.ToInt32(penaltyType)" selected="selected">@penaltyType.ToString()</option> <option value="@Convert.ToInt32(penaltyType)" selected="selected">@loc[$"WEBFRONT_PENALTY_{penaltyType.ToString().ToUpper()}"]</option>
} }
else else
{ {
<option value="@Convert.ToInt32(penaltyType)">@penaltyType.ToString()</option> <option value="@Convert.ToInt32(penaltyType)">@loc[$"WEBFRONT_PENALTY_{penaltyType.ToString().ToUpper()}"]</option>
} }
} }
} }

View File

@ -17,7 +17,7 @@
</a> </a>
</td> </td>
<td colspan="10%" class="penalties-color-@Model.PenaltyTypeText.ToLower()"> <td colspan="10%" class="penalties-color-@Model.PenaltyTypeText.ToLower()">
@Model.PenaltyType @ViewBag.Localization[$"WEBFRONT_PENALTY_{Model.PenaltyType.ToString().ToUpper()}"]
</td> </td>
<td colspan="35%"> <td colspan="35%">
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")"></color-code> <color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")"></color-code>