Skip to content

Commit

Permalink
more localization tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
RaidMax committed Jul 9, 2022
1 parent 61481f6 commit 1fc418c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
14 changes: 6 additions & 8 deletions SharedLibraryCore/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,23 +170,21 @@ public static string FixIW4ForwardSlash(this string str)
{
return str.Replace("//", "/ /");
}
public static string RemoveDiacritics(this string text)

public static string RemoveDiacritics(this string text)
{
var normalizedString = text.Normalize(NormalizationForm.FormD);
var stringBuilder = new StringBuilder(normalizedString.Length);
var stringBuilder = new StringBuilder();

foreach (var c in from c in normalizedString
let unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(c)
foreach (var c in from c in normalizedString.EnumerateRunes()
let unicodeCategory = Rune.GetUnicodeCategory(c)
where unicodeCategory != UnicodeCategory.NonSpacingMark
select c)
{
stringBuilder.Append(c);
}

return stringBuilder
.ToString()
.Normalize(NormalizationForm.FormC);
return stringBuilder.ToString().Normalize(NormalizationForm.FormC);
}

public static string FormatMessageForEngine(this string str, IRConParserConfiguration config)
Expand Down
8 changes: 4 additions & 4 deletions WebfrontCore/Controllers/ActionController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ public IActionResult DismissAlertForm(Guid id)
{
var info = new ActionInfo
{
ActionButtonLabel = "Dismiss",
ActionButtonLabel = Localization["WEBFRONT_ACTION_DISMISS_ALERT_FORM_SUBMIT"],
Name = Localization["WEBFRONT_ACTION_DISMISS_ALERT_SINGLE"],
Inputs = new List<InputInfo>
{
Expand Down Expand Up @@ -521,7 +521,7 @@ public IActionResult DismissAllAlertsForm()
{
var info = new ActionInfo
{
ActionButtonLabel = "Dismiss",
ActionButtonLabel = Localization["WEBFRONT_ACTION_DISMISS_ALERT_FORM_SUBMIT"],
Name = Localization["WEBFRONT_ACTION_DISMISS_ALERT_MANY"],
Inputs = new List<InputInfo>
{
Expand Down Expand Up @@ -555,14 +555,14 @@ public IActionResult OfflineMessageForm()
{
var info = new ActionInfo
{
ActionButtonLabel = "Send",
ActionButtonLabel = Localization["WEBFRONT_ACTION_OFFLINE_MESSAGE_FORM_SUBMIT"],
Name = Localization["WEBFRONT_ACTION_OFFLINE_MESSAGE_BUTTON_COMPOSE"],
Inputs = new List<InputInfo>
{
new()
{
Name = "message",
Label = "Message Content",
Label = Localization["WEBFRONT_ACTION_OFFLINE_MESSAGE_FORM_CONTENT"],
},
},
Action = "OfflineMessage",
Expand Down
8 changes: 4 additions & 4 deletions WebfrontCore/Views/Penalty/List.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@
{
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
{
<option value="@Convert.ToInt32(penaltyType)">@penaltyType.ToString()</option>
<option value="@Convert.ToInt32(penaltyType)">@loc[$"WEBFRONT_PENALTY_{penaltyType.ToString().ToUpper()}"]</option>
}
}
else
{
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
{
<option value="@Convert.ToInt32(penaltyType)">@penaltyType.ToString()</option>
<option value="@Convert.ToInt32(penaltyType)">@loc[$"WEBFRONT_PENALTY_{penaltyType.ToString().ToUpper()}"]</option>
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion WebfrontCore/Views/Penalty/_Penalty.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</a>
</td>
<td colspan="10%" class="penalties-color-@Model.PenaltyTypeText.ToLower()">
@Model.PenaltyType
@ViewBag.Localization[$"WEBFRONT_PENALTY_{Model.PenaltyType.ToString().ToUpper()}"]
</td>
<td colspan="35%">
<color-code value="@($"{Model.Offense}{(ViewBag.Authorized ? Model.AdditionalPenaltyInformation : "")}")"></color-code>
Expand Down

0 comments on commit 1fc418c

Please sign in to comment.