Skip to content

Commit

Permalink
update webfront translation strings
Browse files Browse the repository at this point in the history
  • Loading branch information
RaidMax committed Jul 5, 2022
1 parent b422e72 commit c8eb616
Show file tree
Hide file tree
Showing 38 changed files with 178 additions and 127 deletions.
8 changes: 4 additions & 4 deletions WebfrontCore/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task<IActionResult> Login(int clientId, string password)
{
if (clientId == 0 || string.IsNullOrEmpty(password))
{
return Unauthorized("Invalid credentials");
return Unauthorized(Localization["WEBFRONT_ACTION_LOGIN_ERROR"]);
}

try
Expand Down Expand Up @@ -73,16 +73,16 @@ public async Task<IActionResult> Login(int clientId, string password)
: HttpContext.Connection.RemoteIpAddress?.ToString()
});

return Ok($"Welcome {privilegedClient.Name}. You are now logged in");
return Ok(Localization["WEBFRONT_ACTION_LOGIN_SUCCESS"].FormatExt(privilegedClient.CleanedName));
}
}

catch (Exception)
{
return Unauthorized("Could not validate credentials");
return Unauthorized(Localization["WEBFRONT_ACTION_LOGIN_ERROR"]);
}

return Unauthorized("Invalid credentials");
return Unauthorized(Localization["WEBFRONT_ACTION_LOGIN_ERROR"]);
}

[HttpGet]
Expand Down
26 changes: 13 additions & 13 deletions WebfrontCore/Controllers/ActionController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public IActionResult BanForm()
var info = new ActionInfo
{
ActionButtonLabel = Localization["WEBFRONT_ACTION_BAN_NAME"],
Name = "Ban",
Name = Localization["WEBFRONT_ACTION_BAN_NAME"],
Inputs = new List<InputInfo>
{
new()
Expand Down Expand Up @@ -152,7 +152,7 @@ public IActionResult UnbanForm(long? id)
var info = new ActionInfo
{
ActionButtonLabel = Localization["WEBFRONT_ACTION_UNBAN_NAME"],
Name = "Unban",
Name = Localization["WEBFRONT_ACTION_UNBAN_NAME"],
Inputs = new List<InputInfo>
{
new()
Expand Down Expand Up @@ -193,7 +193,7 @@ public IActionResult LoginForm()
var login = new ActionInfo
{
ActionButtonLabel = Localization["WEBFRONT_ACTION_LOGIN_NAME"],
Name = "Login",
Name = Localization["WEBFRONT_ACTION_LOGIN_NAME"],
Inputs = new List<InputInfo>
{
new()
Expand Down Expand Up @@ -226,7 +226,7 @@ public IActionResult EditForm()
var info = new ActionInfo
{
ActionButtonLabel = Localization["WEBFRONT_ACTION_LABEL_EDIT"],
Name = "Edit",
Name = Localization["WEBFRONT_ACTION_LABEL_EDIT"],
Inputs = new List<InputInfo>
{
new()
Expand Down Expand Up @@ -291,7 +291,7 @@ public IActionResult ChatForm(long id)
var info = new ActionInfo
{
ActionButtonLabel = Localization["WEBFRONT_ACTION_LABEL_SUBMIT_MESSAGE"],
Name = "Chat",
Name = Localization["WEBFRONT_ACTION_LABEL_SUBMIT_MESSAGE"],
Inputs = new List<InputInfo>
{
new()
Expand Down Expand Up @@ -367,7 +367,7 @@ public IActionResult FlagForm()
var info = new ActionInfo
{
ActionButtonLabel = Localization["WEBFRONT_ACTION_FLAG_NAME"],
Name = "Flag",
Name = Localization["WEBFRONT_ACTION_FLAG_NAME"],
Inputs = new List<InputInfo>
{
new()
Expand Down Expand Up @@ -406,7 +406,7 @@ public IActionResult UnflagForm()
var info = new ActionInfo
{
ActionButtonLabel = Localization["WEBFRONT_ACTION_UNFLAG_NAME"],
Name = "Unflag",
Name = Localization["WEBFRONT_ACTION_UNFLAG_NAME"],
Inputs = new List<InputInfo>
{
new()
Expand Down Expand Up @@ -438,7 +438,7 @@ public IActionResult KickForm(int id)
var info = new ActionInfo
{
ActionButtonLabel = Localization["WEBFRONT_ACTION_KICK_NAME"],
Name = "Kick",
Name = Localization["WEBFRONT_ACTION_KICK_NAME"],
Inputs = new List<InputInfo>
{
new()
Expand Down Expand Up @@ -488,7 +488,7 @@ public IActionResult DismissAlertForm(Guid id)
var info = new ActionInfo
{
ActionButtonLabel = "Dismiss",
Name = "Dismiss Alert?",
Name = Localization["WEBFRONT_ACTION_DISMISS_ALERT_SINGLE"],
Inputs = new List<InputInfo>
{
new()
Expand All @@ -512,7 +512,7 @@ public IActionResult DismissAlert(Guid alertId)
{
new CommandResponseInfo
{
Response = "Alert dismissed"
Response = Localization["WEBFRONT_ACTION_DISMISS_ALERT_SINGLE_RESPONSE"]
}
});
}
Expand All @@ -522,7 +522,7 @@ public IActionResult DismissAllAlertsForm()
var info = new ActionInfo
{
ActionButtonLabel = "Dismiss",
Name = "Dismiss All Alerts?",
Name = Localization["WEBFRONT_ACTION_DISMISS_ALERT_MANY"],
Inputs = new List<InputInfo>
{
new()
Expand All @@ -546,7 +546,7 @@ public IActionResult DismissAllAlerts(int targetId)
{
new CommandResponseInfo
{
Response = "Alerts dismissed"
Response = Localization["WEBFRONT_ACTION_DISMISS_ALERT_MANY_RESPONSE"]
}
});
}
Expand All @@ -556,7 +556,7 @@ public IActionResult OfflineMessageForm()
var info = new ActionInfo
{
ActionButtonLabel = "Send",
Name = "Compose Message",
Name = Localization["WEBFRONT_ACTION_OFFLINE_MESSAGE_BUTTON_COMPOSE"],
Inputs = new List<InputInfo>
{
new()
Expand Down
2 changes: 1 addition & 1 deletion WebfrontCore/Controllers/AdminController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public async Task<IActionResult> BanManagement([FromQuery] BanInfoRequest reques
ViewBag.ClientIP = request.ClientIP;
ViewBag.ClientGuid = request.ClientGuid;

ViewBag.Title = "Ban Management";
ViewBag.Title = Localization["WEBFRONT_NAV_TITLE_BAN_MANAGEMENT"];

return View(results.Results);
}
Expand Down
8 changes: 2 additions & 6 deletions WebfrontCore/Controllers/Client/ClientController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,8 @@ public async Task<IActionResult> Profile(int id, MetaType? metaFilterType, Cance
clientDto.Meta.AddRange(Authorized ? meta : meta.Where(m => !m.IsSensitive));

var strippedName = clientDto.Name.StripColors();
ViewBag.Title = strippedName.Substring(strippedName.Length - 1).ToLower()[0] == 's'
? strippedName + "'"
: strippedName + "'s";
ViewBag.Title += " " + Localization["WEBFRONT_CLIENT_PROFILE_TITLE"];
ViewBag.Description = $"Client information for {strippedName}";
ViewBag.Keywords = $"IW4MAdmin, client, profile, {strippedName}";
ViewBag.Title = $"{strippedName} | {Localization["WEBFRONT_CLIENT_PROFILE_TITLE"]}";
ViewBag.Description = Localization["WEBFRONT_PROFILE_DESCRIPTION"].FormatExt(strippedName);
ViewBag.UseNewStats = _config?.EnableAdvancedMetrics ?? true;

return View("Profile/Index", clientDto);
Expand Down
2 changes: 1 addition & 1 deletion WebfrontCore/Controllers/ConsoleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public async Task<IActionResult> Execute(long serverId, string command)
new CommandResponseInfo
{
ClientId = client.ClientId,
Response = Utilities.CurrentLocalization.LocalizationIndex["COMMADS_RESTART_SUCCESS"]
Response = Utilities.CurrentLocalization.LocalizationIndex["COMMANDS_RESTART_SUCCESS"]
}
};
}
Expand Down
4 changes: 2 additions & 2 deletions WebfrontCore/QueryHelpers/BanInfoResourceQueryHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public async Task<ResourceQueryHelperResult<BanInfo>> QueryResource(BanInfoReque
OffenderName = penalty.Penalty.Offender.CurrentAlias.Name,
Offense = string.IsNullOrEmpty(penalty.Penalty.AutomatedOffense)
? penalty.Penalty.Offense
: "Anticheat Detection",
: Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_BAN_INFO_AC_DETECTION"],
LinkId = penalty.Penalty.Offender.AliasLinkId,
penalty.Penalty.OffenderId,
penalty.Penalty.PunisherId,
Expand All @@ -113,7 +113,7 @@ public async Task<ResourceQueryHelperResult<BanInfo>> QueryResource(BanInfoReque
OffenderName = penalty.Offender.CurrentAlias.Name,
Offense = string.IsNullOrEmpty(penalty.AutomatedOffense)
? penalty.Offense
: "Anticheat Detection",
: Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_BAN_INFO_AC_DETECTION"],
LinkId = penalty.Offender.AliasLinkId,
penalty.OffenderId,
penalty.PunisherId,
Expand Down
2 changes: 1 addition & 1 deletion WebfrontCore/Views/Action/_ActionForm.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@
}
<div class="ml-auto">
<button type="submit" class="btn btn-primary">@Model.ActionButtonLabel</button>
<a href="#" class="btn mr-5 ml-5" role="button" onclick="halfmoon.toggleModal('actionModal');">Close</a>
<a href="#" class="btn mr-5 ml-5" role="button" onclick="halfmoon.toggleModal('actionModal');">@ViewBag.Localization["WEBFRONT_ACTION_MODAL_BUTTON_CLOSE"]</a>
</div>
</form>
8 changes: 4 additions & 4 deletions WebfrontCore/Views/Admin/BanManagement.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<form method="get" class="mt-10">
<div class="d-flex flex-column flex-md-row">
<div class="input-group">
<input type="text" class="form-control bg-dark-dm bg-light-ex-lm" id="clientNameInput" name="clientName" value="@ViewBag.ClientName" placeholder="Client Name">
<input type="text" class="form-control bg-dark-dm bg-light-ex-lm" id="clientNameInput" name="clientName" value="@ViewBag.ClientName" placeholder="@ViewBag.Localization["WEBFRONT_BAN_MGMT_FORM_NAME"]">
<div class="input-group-append">
<button class="btn bg-dark-dm bg-light-ex-lm" type="submit">
<i class="oi oi-magnifying-glass"></i>
Expand All @@ -18,23 +18,23 @@

</div>
<div class="input-group mr-md-5 ml-md-10 mt-10 mb-5 mt-md-0 mb-md-0">
<input type="text" class="form-control bg-dark-dm bg-light-ex-lm" id="clientGuidInput" name="clientGuid" value="@ViewBag.ClientGuid" placeholder="Client GUID">
<input type="text" class="form-control bg-dark-dm bg-light-ex-lm" id="clientGuidInput" name="clientGuid" value="@ViewBag.ClientGuid" placeholder="@ViewBag.Localization["WEBFRONT_BAN_MGMT_FORM_GUID"]">
<div class="input-group-append">
<button class="btn bg-dark-dm bg-light-ex-lm" type="submit">
<i class="oi oi-magnifying-glass"></i>
</button>
</div>
</div>
<div class="input-group mr-md-10 ml-md-5 mb-10 mt-5 mt-md-0 mb-md-0">
<input type="text" class="form-control bg-dark-dm bg-light-ex-lm" id="clientIPInput" name="clientIP" value="@ViewBag.ClientIP" placeholder="Client IP">
<input type="text" class="form-control bg-dark-dm bg-light-ex-lm" id="clientIPInput" name="clientIP" value="@ViewBag.ClientIP" placeholder="@ViewBag.Localization["WEBFRONT_BAN_MGMT_FORM_IP"]">
<div class="input-group-append">
<button class="btn bg-dark-dm bg-light-ex-lm" type="submit">
<i class="oi oi-magnifying-glass"></i>
</button>
</div>
</div>
<div class="input-group">
<input type="number" class="form-control bg-dark-dm bg-light-ex-lm" id="clientIdInput" name="clientId" value="@ViewBag.ClientId" placeholder="Client Id">
<input type="number" class="form-control bg-dark-dm bg-light-ex-lm" id="clientIdInput" name="clientId" value="@ViewBag.ClientId" placeholder="@ViewBag.Localization["WEBFRONT_BAN_MGMT_FORM_ID"]">
<div class="input-group-append">
<button class="btn bg-dark-dm bg-light-ex-lm" type="submit">
<i class="oi oi-magnifying-glass"></i>
Expand Down
8 changes: 4 additions & 4 deletions WebfrontCore/Views/Admin/_BanEntries.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
{
<div class="text-muted font-weight-light">@ban.AttachedPenalty.Offense.CapClientName(30)</div>
<div class="text-danger font-weight-light">@ban.AttachedPenalty.DateTime.ToStandardFormat()</div>
<div class="btn profile-action w-100" data-action="unban" data-action-id="@ban.ClientId">Unban</div>
<div class="btn profile-action w-100" data-action="unban" data-action-id="@ban.ClientId">@ViewBag.Localization["WEBFRONT_BAN_MGMT_ACTION_UNBAN"]</div>
}
else
{
<div class="align-self-end text-muted font-weight-light">
<span class="oi oi-warning font-size-12"></span>
<span>Link-Only Ban</span>
<span>@ViewBag.Localization["WEBFRONT_BAN_MGMT_LINK_ONLY"]</span>
</div>
}
</div>
Expand All @@ -43,7 +43,7 @@
@foreach (var associatedEntity in ban.AssociatedPenalties)
{
<div class="d-flex flex-wrap flex-column w-full w-md-200 p-10">
<div data-toggle="tooltip" data-title="Linked via shared IP" class="d-flex">
<div data-toggle="tooltip" data-title="@ViewBag.Localization["WEBFRONT_BAN_MGMT_TOOLTIP_LINKED"]" class="d-flex">
<i class="oi oi-link-intact align-self-center"></i>
<div class="text-truncate ml-5 mr-5">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@associatedEntity.OffenderInfo.ClientId" class="font-size-18 no-decoration">@associatedEntity.OffenderInfo.ClientName</a>
Expand All @@ -62,7 +62,7 @@
<br/>
<div class="text-muted font-weight-light">@associatedEntity.Offense.CapClientName(30)</div>
<div class="text-danger font-weight-light">@associatedEntity.DateTime.ToStandardFormat()</div>
<div class="btn profile-action mt-10 w-100" data-action="unban" data-action-id="@associatedEntity.OffenderInfo.ClientId">Unban</div>
<div class="btn profile-action mt-10 w-100" data-action="unban" data-action-id="@associatedEntity.OffenderInfo.ClientId">@ViewBag.Localization["WEBFRONT_BAN_MGMT_ACTION_UNBAN"]</div>
</div>
}
</div>
Expand Down
4 changes: 2 additions & 2 deletions WebfrontCore/Views/Admin/_ListAuditLog.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@info.NewValue
</td>
<td class="text-right">
@info.When.ToString()
@info.When.ToStandardFormat()
</td>
</tr>

Expand Down Expand Up @@ -65,7 +65,7 @@
}
<div class="mt-5 mb-5"> @info.Data</div>
<div class="mt-5 mb-5">@info.NewValue</div>
<div class="mt-5 mb-5">@info.When.ToString()</div>
<div class="mt-5 mb-5">@info.When</div>
</td>
</tr>
}
27 changes: 25 additions & 2 deletions WebfrontCore/Views/Client/Find/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,31 @@

<!-- desktop -->
<div class="content mt-0">
<h2 class="content-title mt-20 mb-0">Search Results</h2>
<div class="text-muted mb-15"><span class="badge">@ViewBag.SearchTerm</span> returned <span class="text-primary">@ViewBag.ResultCount</span> matche(s)</div>
<h2 class="content-title mt-20 mb-0">@ViewBag.Localization["WEBFRONT_SEARCH_RESULTS_TITLE"]</h2>
<div class="text-muted mb-15">

@foreach (var match in Utilities.SplitTranslationTokens("WEBFRONT_SEARCH_RESULTS_SUBTITLE_FORMAT"))
{
if (match.IsInterpolation)
{
if (match.MatchValue == "searchTerm")
{
<span class="badge">
@ViewBag.SearchTerm
</span>
}

else if (match.MatchValue == "searchCount")
{
<span class="text-primary">@ViewBag.ResultCount</span>
}
}
else
{
<span>@match.MatchValue</span>
}
}
</div>

<table class="table d-none d-md-table">
<thead>
Expand Down
2 changes: 1 addition & 1 deletion WebfrontCore/Views/Client/Message/Find.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

else
{
<h2 class="content-title mt-20 mb-0">Search Results</h2>
<h2 class="content-title mt-20 mb-0">@ViewBag.Localization["WEBFRONT_SEARCH_RESULTS_TITLE"]</h2>
<div class="text-muted mb-15">@Html.Raw(Utilities.FormatExt(ViewBag.Localization["WEBFRONT_STATS_MESSAGES_FOUND"], $"<span class=\"badge\">{Model.TotalResultCount.ToString("N0")}</span>"))</div>

<table class="table bg-dark-dm bg-light-lm rounded" style="table-layout: fixed">
Expand Down
3 changes: 1 addition & 2 deletions WebfrontCore/Views/Client/Message/_Item.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@
<div>
<color-code value="@(message.ServerName ?? "--")"></color-code>
</div>
<div> @message.When</div>

<div>@message.When</div>
</td>
</tr>
}
7 changes: 3 additions & 4 deletions WebfrontCore/Views/Client/Privileged/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<tr class="level-bgcolor-@((int)key)">
<th class="text-light">@key.ToLocalizedLevelName()</th>
<th>Game</th>
<th class="text-right font-weight-bold">Last Connected</th>
<th class="text-right font-weight-bold">@ViewBag.Localization["WEBFRONT_SEARCH_LAST_CONNECTED"]</th>
</tr>
</thead>
<tbody>
Expand All @@ -25,11 +25,11 @@
<td>
@if (client.IsMasked)
{
<span data-toggle="tooltip" data-title="Client is masked">
<span data-toggle="tooltip" data-title="@ViewBag.Localization["WEBFRONT_PRIVILEGED_TOOLTIP_MASKED"]">
<span class="oi oi-shield mr-5 font-size-12"></span>
</span>
}

<a asp-controller="Client" asp-action="Profile" asp-route-id="@client.ClientId">
<color-code value="@client.Name"></color-code>
</a>
Expand All @@ -46,5 +46,4 @@
</tbody>
</table>
}

</div>
Loading

0 comments on commit c8eb616

Please sign in to comment.