fix(Extensions): update to add suffix

This commit is contained in:
tekh 2025-09-08 16:53:44 +02:00
parent 40697435ff
commit 876c5def56
2 changed files with 11 additions and 12 deletions

View File

@ -1,5 +1,4 @@
using Microsoft.Extensions.Localization;
using System.Runtime.CompilerServices;
namespace EnvelopeGenerator.Application.Resources;
@ -328,39 +327,39 @@ public static class Extensions
///
/// </summary>
/// <param name="localizer"></param>
/// <param name="arg0"></param>
/// <param name="suffix"></param>
/// <returns></returns>
public static string LockedTitle(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(Privacy)].Value, arg0);
public static string LockedTitle(this IStringLocalizer localizer, string suffix) => localizer[nameof(LockedTitle) + suffix].Value;
/// <summary>
///
/// </summary>
/// <param name="localizer"></param>
/// <param name="arg0"></param>
/// <param name="suffix"></param>
/// <returns></returns>
public static string LockedBody(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(LockedBody)].Value, arg0);
public static string LockedBody(this IStringLocalizer localizer, string suffix) => localizer[nameof(LockedBody) + suffix].Value;
/// <summary>
///
/// </summary>
/// <param name="localizer"></param>
/// <param name="arg0"></param>
/// <param name="suffix"></param>
/// <returns></returns>
public static string LockedCodeLabel(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(LockedCodeLabel)].Value, arg0);
public static string LockedCodeLabel(this IStringLocalizer localizer, string suffix) => localizer[nameof(LockedCodeLabel) + suffix].Value;
/// <summary>
///
/// </summary>
/// <param name="localizer"></param>
/// <param name="arg0"></param>
/// <param name="suffix"></param>
/// <returns></returns>
public static string LockedFooterTitle(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(LockedFooterTitle)].Value, arg0);
public static string LockedFooterTitle(this IStringLocalizer localizer, string suffix) => localizer[nameof(LockedFooterTitle) + suffix].Value;
/// <summary>
///
/// </summary>
/// <param name="localizer"></param>
/// <param name="arg0"></param>
/// <param name="suffix"></param>
/// <returns></returns>
public static string LockedFooterBody(this IStringLocalizer localizer, object? arg0) => string.Format(localizer[nameof(LockedFooterBody)].Value, arg0);
public static string LockedFooterBody(this IStringLocalizer localizer, string suffix) => localizer[nameof(LockedFooterBody) + suffix].Value;
}

View File

@ -6,9 +6,9 @@
//TODO: Create view model
var nonce = _accessor.HttpContext?.Items["csp-nonce"] as string;
var cImg = _cImgOpt.Value;
ViewData["Title"] = _localizer.DocProtected();
string codeType = ViewData["CodeType"] is string _codeType ? _codeType : "accessCode";
string codeKeyName = (char.ToUpper(codeType[0]) + codeType.Substring(1)).Replace("Code", "");
ViewData["Title"] = _localizer.LockedTitle(codeKeyName);
bool viaSms = codeType == "smsCode";
bool viaAuthenticator = codeType == "authenticatorCode";
bool viaTFA = viaSms || viaAuthenticator;