Dictionary additions (#6120)

* Cleanups

* Add text entries for dictionary pages

* Wording: Keep Clone title consistent with Payment Request cloning

* Dictionaries: List used one first; badge for marking In use
This commit is contained in:
d11n 2024-07-26 01:46:17 +02:00 committed by GitHub
parent 94760792af
commit 7878a4365c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 116 additions and 117 deletions

View File

@ -5,10 +5,8 @@ using System.Linq;
using System.Threading.Tasks;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Abstractions.Models;
using BTCPayServer.Client.Models;
using BTCPayServer.Lightning;
using BTCPayServer.Lightning.CLightning;
using BTCPayServer.Services;
using BTCPayServer.Views.Manage;
using BTCPayServer.Views.Server;
using BTCPayServer.Views.Stores;
@ -18,7 +16,6 @@ using NBitcoin;
using NBitcoin.RPC;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.Extensions;
using OpenQA.Selenium.Support.UI;
using Xunit;

View File

@ -6,7 +6,6 @@ using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
@ -28,7 +27,6 @@ using BTCPayServer.Views.Wallets;
using ExchangeSharp;
using LNURL;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc.Routing;
using Microsoft.EntityFrameworkCore;
using NBitcoin;
using NBitcoin.DataEncoders;

View File

@ -34,22 +34,22 @@
<li class="nav-item" permission="@Policies.CanModifyStoreSettings">
<a id="StoreNav-@(nameof(StoreNavPages.Dashboard))" asp-area="" asp-controller="UIStores" asp-action="Dashboard" asp-route-storeId="@Model.Store.Id" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Dashboard)">
<vc:icon symbol="nav-dashboard"/>
<span text-translate="true">Dashboard</span>
<span text-translate="true">Dashboard</span>
</a>
</li>
<li class="nav-item" permission="@Policies.CanViewStoreSettings">
<a id="StoreNav-@(nameof(StoreNavPages.General))" asp-area="" asp-controller="UIStores" asp-action="GeneralSettings" asp-route-storeId="@Model.Store.Id" class="nav-link @ViewData.ActivePageClass(StoreNavPages.General)">
<vc:icon symbol="nav-store-settings"/>
<span text-translate="true">Settings</span>
<span text-translate="true">Settings</span>
</a>
</li>
@if (ViewData.IsActivePage([StoreNavPages.General, StoreNavPages.Rates, StoreNavPages.CheckoutAppearance, StoreNavPages.Tokens, StoreNavPages.Users, StoreNavPages.Roles, StoreNavPages.Webhooks, StoreNavPages.PayoutProcessors, StoreNavPages.Emails, StoreNavPages.Forms]))
{
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyStoreSettings">
<a id="StoreNav-@(nameof(StoreNavPages.Rates))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Rates)" asp-controller="UIStores" asp-action="Rates" asp-route-storeId="@Model.Store.Id" text-translate="true">Rates</a>
<a id="StoreNav-@(nameof(StoreNavPages.Rates))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Rates)" asp-controller="UIStores" asp-action="Rates" asp-route-storeId="@Model.Store.Id" text-translate="true">Rates</a>
</li>
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyStoreSettings">
<a id="StoreNav-@(nameof(StoreNavPages.CheckoutAppearance))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.CheckoutAppearance)" asp-controller="UIStores" asp-action="CheckoutAppearance" asp-route-storeId="@Model.Store.Id" text-translate="true">Checkout Appearance</a>
<a id="StoreNav-@(nameof(StoreNavPages.CheckoutAppearance))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.CheckoutAppearance)" asp-controller="UIStores" asp-action="CheckoutAppearance" asp-route-storeId="@Model.Store.Id" text-translate="true">Checkout Appearance</a>
</li>
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyStoreSettings">
<a id="StoreNav-@(nameof(StoreNavPages.Tokens))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Tokens)" asp-controller="UIStores" asp-action="ListTokens" asp-route-storeId="@Model.Store.Id" text-translate="true">Access Tokens</a>
@ -58,19 +58,19 @@
<a id="StoreNav-@(nameof(StoreNavPages.Users))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Users)" asp-controller="UIStores" asp-action="StoreUsers" asp-route-storeId="@Model.Store.Id" text-translate="true">Users</a>
</li>
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyStoreSettings">
<a id="StoreNav-@(nameof(StoreNavPages.Roles))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Roles)" asp-controller="UIStores" asp-action="ListRoles" asp-route-storeId="@Model.Store.Id" text-translate="true">Roles</a>
<a id="StoreNav-@(nameof(StoreNavPages.Roles))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Roles)" asp-controller="UIStores" asp-action="ListRoles" asp-route-storeId="@Model.Store.Id" text-translate="true">Roles</a>
</li>
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyStoreSettings">
<a id="StoreNav-@(nameof(StoreNavPages.Webhooks))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Webhooks)" asp-controller="UIStores" asp-action="Webhooks" asp-route-storeId="@Model.Store.Id" text-translate="true">Webhooks</a>
<a id="StoreNav-@(nameof(StoreNavPages.Webhooks))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Webhooks)" asp-controller="UIStores" asp-action="Webhooks" asp-route-storeId="@Model.Store.Id" text-translate="true">Webhooks</a>
</li>
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyStoreSettings">
<a id="StoreNav-@(nameof(StoreNavPages.PayoutProcessors))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.PayoutProcessors)" asp-controller="UIPayoutProcessors" asp-action="ConfigureStorePayoutProcessors" asp-route-storeId="@Model.Store.Id" text-translate="true">Payout Processors</a>
<a id="StoreNav-@(nameof(StoreNavPages.PayoutProcessors))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.PayoutProcessors)" asp-controller="UIPayoutProcessors" asp-action="ConfigureStorePayoutProcessors" asp-route-storeId="@Model.Store.Id" text-translate="true">Payout Processors</a>
</li>
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyStoreSettings">
<a id="StoreNav-@(nameof(StoreNavPages.Emails))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Emails)" asp-controller="UIStores" asp-action="StoreEmailSettings" asp-route-storeId="@Model.Store.Id" text-translate="true">Emails</a>
<a id="StoreNav-@(nameof(StoreNavPages.Emails))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Emails)" asp-controller="UIStores" asp-action="StoreEmailSettings" asp-route-storeId="@Model.Store.Id" text-translate="true">Emails</a>
</li>
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyStoreSettings">
<a id="StoreNav-@(nameof(StoreNavPages.Forms))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Forms)" asp-controller="UIForms" asp-action="FormsList" asp-route-storeId="@Model.Store.Id" text-translate="true">Forms</a>
<a id="StoreNav-@(nameof(StoreNavPages.Forms))" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Forms)" asp-controller="UIForms" asp-action="FormsList" asp-route-storeId="@Model.Store.Id" text-translate="true">Forms</a>
</li>
}
<vc:ui-extension-point location="store-nav" model="@Model"/>
@ -79,7 +79,7 @@
</div>
<div class="accordion-item">
<header class="accordion-header" id="Nav-Wallets-Header" permission="@Policies.CanModifyStoreSettings">
<div text-translate="true" class="accordion-button">Wallets</div>
<div text-translate="true" class="accordion-button">Wallets</div>
</header>
<div id="Nav-Wallets" class="accordion-collapse" aria-labelledby="Nav-Wallets-Header" permission="@Policies.CanModifyStoreSettings">
<div class="accordion-body">
@ -129,14 +129,14 @@
: "pending";
<a asp-area="" asp-controller="UIStores" asp-action="Lightning" asp-route-cryptoCode="@scheme.CryptoCode" asp-route-storeId="@Model.Store.Id" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Lightning, $"{Model.Store.Id}-{scheme.CryptoCode}")" id="@($"StoreNav-Lightning{scheme.CryptoCode}")">
<span class="me-2 btcpay-status btcpay-status--@status"></span>
<span>@PrettyName.PrettyName(scheme.PaymentMethodId)</span>
<span>@PrettyName.PrettyName(scheme.PaymentMethodId)</span>
</a>
}
else
{
<a asp-area="" asp-controller="UIStores" asp-action="SetupLightningNode" asp-route-cryptoCode="@scheme.CryptoCode" asp-route-storeId="@Model.Store.Id" class="nav-link @ViewData.ActivePageClass(StoreNavPages.LightningSettings, $"{Model.Store.Id}-{scheme.CryptoCode}")" id="@($"StoreNav-Lightning{scheme.CryptoCode}")">
<span class="me-2 btcpay-status btcpay-status--@(scheme.Enabled ? "enabled" : "pending")"></span>
<span>@PrettyName.PrettyName(scheme.PaymentMethodId)</span>
<span>@PrettyName.PrettyName(scheme.PaymentMethodId)</span>
</a>
}
</li>
@ -155,7 +155,7 @@
<div class="accordion-item">
<header class="accordion-header" id="Nav-Payments-Header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#Nav-Payments" aria-expanded="true" aria-controls="Nav-Payments">
<span text-translate="true">Payments</span>
<span text-translate="true">Payments</span>
<vc:icon symbol="caret-down"/>
</button>
</header>
@ -165,25 +165,25 @@
<li class="nav-item" permission="@Policies.CanViewInvoices">
<a asp-area="" asp-controller="UIInvoice" asp-action="ListInvoices" asp-route-storeId="@Model.Store.Id" class="nav-link @ViewData.ActiveCategoryClass(typeof(InvoiceNavPages))" id="StoreNav-Invoices">
<vc:icon symbol="nav-invoices"/>
<span text-translate="true">Invoices</span>
<span text-translate="true">Invoices</span>
</a>
</li>
<li class="nav-item" permission="@Policies.CanViewReports">
<a asp-area="" asp-controller="UIReports" asp-action="StoreReports" asp-route-storeId="@Model.Store.Id" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Reporting)" id="SectionNav-Reporting">
<vc:icon symbol="nav-reporting" />
<span text-translate="true">Reporting</span>
<span text-translate="true">Reporting</span>
</a>
</li>
<li class="nav-item" permission="@Policies.CanViewPaymentRequests">
<a asp-area="" asp-controller="UIPaymentRequest" asp-action="GetPaymentRequests" asp-route-storeId="@Model.Store.Id" class="nav-link @ViewData.ActiveCategoryClass(typeof(PaymentRequestsNavPages))" id="StoreNav-PaymentRequests">
<vc:icon symbol="nav-payment-requests"/>
<span text-translate="true">Requests</span>
<span text-translate="true">Requests</span>
</a>
</li>
<li class="nav-item" permission="@Policies.CanViewPullPayments">
<a asp-area="" asp-controller="UIStorePullPayments" asp-action="PullPayments" asp-route-storeId="@Model.Store.Id" class="nav-link @ViewData.ActivePageClass(StoreNavPages.PullPayments)" id="StoreNav-PullPayments">
<vc:icon symbol="nav-pull-payments"/>
<span text-translate="true">Pull Payments</span>
<span text-translate="true">Pull Payments</span>
</a>
</li>
<li class="nav-item" permission="@Policies.CanViewPayouts">
@ -192,7 +192,7 @@
asp-route-pullPaymentId=""
asp-route-storeId="@Model.Store.Id" class="nav-link @ViewData.ActivePageClass(StoreNavPages.Payouts)" id="StoreNav-Payouts">
<vc:icon symbol="nav-payouts"/>
<span text-translate="true">Payouts</span>
<span text-translate="true">Payouts</span>
</a>
</li>
</ul>
@ -204,7 +204,7 @@
<div class="accordion-item">
<header class="accordion-header" id="Nav-Plugins-Header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#Nav-Plugins" aria-expanded="true" aria-controls="Nav-Plugins">
<span text-translate="true">Plugins</span>
<span text-translate="true">Plugins</span>
<vc:icon symbol="caret-down"/>
</button>
</header>
@ -228,7 +228,7 @@
{
<vc:icon symbol="nav-plugins-manage" />
}
<span text-translate="true">Manage Plugins</span>
<span text-translate="true">Manage Plugins</span>
</a>
</li>
@if (Model.Store != null && Model.ArchivedAppsCount > 0)
@ -272,11 +272,11 @@
@if (!PoliciesSettings.LockSubscription)
{
<li class="nav-item">
<a asp-area="" asp-controller="UIAccount" asp-action="Register" class="nav-link" id="Nav-Register" text-translate="true">Register</a>
<a asp-area="" asp-controller="UIAccount" asp-action="Register" class="nav-link" id="Nav-Register" text-translate="true">Register</a>
</li>
}
<li class="nav-item">
<a asp-area="" asp-controller="UIAccount" asp-action="Login" class="nav-link" id="Nav-Login" text-translate="true">Log in</a>
<a asp-area="" asp-controller="UIAccount" asp-action="Login" class="nav-link" id="Nav-Login" text-translate="true">Log in</a>
</li>
</ul>
}
@ -287,7 +287,7 @@
<li class="nav-item" permission="@Policies.CanModifyServerSettings">
<a asp-area="" asp-controller="UIServer" asp-action="Policies" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Policies)" id="Nav-ServerSettings">
<vc:icon symbol="nav-server-settings"/>
<span text-translate="true">Server Settings</span>
<span text-translate="true">Server Settings</span>
</a>
</li>
@if (ViewData.IsActiveCategory(typeof(ServerNavPages)) && !ViewData.IsActivePage([ServerNavPages.Plugins]))
@ -299,35 +299,35 @@
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Roles" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Roles)" asp-action="ListRoles" text-translate="true">Roles</a>
</li>
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyServerSettings">
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Emails" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Emails)" asp-action="Emails" text-translate="true">Email</a>
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Emails" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Emails)" asp-action="Emails" text-translate="true">Email</a>
</li>
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyServerSettings">
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Services" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Services)" asp-action="Services" text-translate="true">Services</a>
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Services" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Services)" asp-action="Services" text-translate="true">Services</a>
</li>
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyServerSettings">
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Branding" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Branding)" asp-action="Branding" text-translate="true">Branding</a>
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Branding" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Branding)" asp-action="Branding" text-translate="true">Branding</a>
</li>
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyServerSettings">
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Translations" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Translations)" asp-action="ListDictionaries" text-translate="true">Translations</a>
</li>
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyServerSettings">
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Translations" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Translations)" asp-action="ListDictionaries" text-translate="true">Translations</a>
</li>
@if (BtcPayServerOptions.DockerDeployment)
{
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyServerSettings">
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Maintenance" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Maintenance)" asp-action="Maintenance" text-translate="true">Maintenance</a>
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Maintenance" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Maintenance)" asp-action="Maintenance" text-translate="true">Maintenance</a>
</li>
}
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyServerSettings">
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Logs" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Logs)" asp-action="LogsView" text-translate="true">Logs</a>
</li>
<li class="nav-item nav-item-sub" permission="@Policies.CanModifyServerSettings">
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Files" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Files)" asp-action="Files" text-translate="true">Files</a>
<a asp-controller="UIServer" id="SectionNav-@ServerNavPages.Files" class="nav-link @ViewData.ActivePageClass(ServerNavPages.Files)" asp-action="Files" text-translate="true">Files</a>
</li>
}
<vc:ui-extension-point location="server-nav" model="@Model"/>
<li class="nav-item dropup">
<a class="nav-link @ViewData.ActivePageClass(ManageNavPages.Index)" role="button" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false" id="Nav-Account">
<vc:icon symbol="nav-account"/>
<span text-translate="true">Account</span>
<span text-translate="true">Account</span>
</a>
<ul class="dropdown-menu py-0 w-100" aria-labelledby="Nav-Account">
<li class="p-3 border-bottom d-flex align-items-center gap-2">
@ -348,7 +348,7 @@
</strong>
@if (User.IsInRole(Roles.ServerAdmin))
{
<div class="text-secondary" text-translate="true">Administrator</div>
<div class="text-secondary" text-translate="true">Administrator</div>
}
</div>
</li>
@ -360,7 +360,7 @@
}
<li class="py-1 px-3">
<label class="d-flex align-items-center justify-content-between gap-3 nav-link">
<span class="fw-semibold" text-translate="true">Hide Sensitive Info</span>
<span class="fw-semibold" text-translate="true">Hide Sensitive Info</span>
<input id="HideSensitiveInfo" name="HideSensitiveInfo" type="checkbox" class="btcpay-toggle" />
</label>
<script>
@ -369,12 +369,12 @@
</li>
<li class="border-top py-1 px-3">
<a asp-area="" asp-controller="UIManage" asp-action="Index" class="nav-link" id="Nav-ManageAccount">
<span text-translate="true">Manage Account</span>
<span text-translate="true">Manage Account</span>
</a>
</li>
<li class="border-top py-1 px-3">
<a asp-area="" asp-controller="UIAccount" asp-action="Logout" class="nav-link text-danger" id="Nav-Logout">
<span text-translate="true">Logout</span>
<span text-translate="true">Logout</span>
</a>
</li>
</ul>
@ -382,19 +382,19 @@
@if (ViewData.IsActiveCategory(typeof(ManageNavPages)) || ViewData.IsActivePage([ManageNavPages.ChangePassword]))
{
<li class="nav-item nav-item-sub">
<a id="SectionNav-@ManageNavPages.ChangePassword.ToString()" class="nav-link @ViewData.ActivePageClass(ManageNavPages.ChangePassword)" asp-controller="UIManage" asp-action="ChangePassword" text-translate="true">Password</a>
<a id="SectionNav-@ManageNavPages.ChangePassword.ToString()" class="nav-link @ViewData.ActivePageClass(ManageNavPages.ChangePassword)" asp-controller="UIManage" asp-action="ChangePassword" text-translate="true">Password</a>
</li>
<li class="nav-item nav-item-sub">
<a id="SectionNav-@ManageNavPages.TwoFactorAuthentication.ToString()" class="nav-link @ViewData.ActivePageClass(ManageNavPages.TwoFactorAuthentication)" asp-controller="UIManage" asp-action="TwoFactorAuthentication" text-translate="true">Two-Factor Authentication</a>
<a id="SectionNav-@ManageNavPages.TwoFactorAuthentication.ToString()" class="nav-link @ViewData.ActivePageClass(ManageNavPages.TwoFactorAuthentication)" asp-controller="UIManage" asp-action="TwoFactorAuthentication" text-translate="true">Two-Factor Authentication</a>
</li>
<li class="nav-item nav-item-sub">
<a id="SectionNav-@ManageNavPages.APIKeys.ToString()" class="nav-link @ViewData.ActivePageClass(ManageNavPages.APIKeys)" asp-controller="UIManage" asp-action="APIKeys" text-translate="true">API Keys</a>
</li>
<li class="nav-item nav-item-sub">
<a id="SectionNav-@ManageNavPages.Notifications.ToString()" class="nav-link @ViewData.ActivePageClass(ManageNavPages.Notifications)" asp-controller="UIManage" asp-action="NotificationSettings" text-translate="true">Notifications</a>
<a id="SectionNav-@ManageNavPages.Notifications.ToString()" class="nav-link @ViewData.ActivePageClass(ManageNavPages.Notifications)" asp-controller="UIManage" asp-action="NotificationSettings" text-translate="true">Notifications</a>
</li>
<li class="nav-item nav-item-sub">
<a id="SectionNav-@ManageNavPages.LoginCodes.ToString()" class="nav-link @ViewData.ActivePageClass(ManageNavPages.LoginCodes)" asp-controller="UIManage" asp-action="LoginCodes" text-translate="true">Login Codes</a>
<a id="SectionNav-@ManageNavPages.LoginCodes.ToString()" class="nav-link @ViewData.ActivePageClass(ManageNavPages.LoginCodes)" asp-controller="UIManage" asp-action="LoginCodes" text-translate="true">Login Codes</a>
</li>
<vc:ui-extension-point location="user-nav" model="@Model" />
}
@ -403,7 +403,7 @@
<li class="nav-item">
<a href="@Model.ContactUrl" class="nav-link" id="Nav-ContactUs">
<vc:icon symbol="nav-contact"/>
<span text-translate="true">Contact Us</span>
<span text-translate="true">Contact Us</span>
</a>
</li>
}

View File

@ -1,12 +1,9 @@
using System.Data.Common;
using System.Linq;
using System.Threading.Tasks;
using BTCPayServer.Abstractions.Constants;
using BTCPayServer.Abstractions.Extensions;
using BTCPayServer.Models.ServerViewModels;
using BTCPayServer.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Newtonsoft.Json.Linq;
namespace BTCPayServer.Controllers
@ -16,20 +13,24 @@ namespace BTCPayServer.Controllers
[HttpGet("server/dictionaries")]
public async Task<IActionResult> ListDictionaries()
{
var dictionaries = await this._localizer.GetDictionaries();
var dictionaries = await _localizer.GetDictionaries();
var vm = new ListDictionariesViewModel();
foreach (var dictionary in dictionaries)
{
vm.Dictionaries.Add(new()
var isSelected = _policiesSettings.LangDictionary == dictionary.DictionaryName ||
(_policiesSettings.LangDictionary is null && dictionary.Source == "Default");
var dict = new ListDictionariesViewModel.DictionaryViewModel
{
Editable = dictionary.Source == "Custom",
Source = dictionary.Source,
DictionaryName = dictionary.DictionaryName,
Fallback = dictionary.Fallback,
IsSelected =
_policiesSettings.LangDictionary == dictionary.DictionaryName ||
(_policiesSettings.LangDictionary is null && dictionary.Source == "Default")
});
IsSelected = isSelected
};
if (isSelected)
vm.Dictionaries.Insert(0, dict);
else
vm.Dictionaries.Add(dict);
}
return View(vm);
}
@ -40,7 +41,7 @@ namespace BTCPayServer.Controllers
var dictionaries = await this._localizer.GetDictionaries();
return View(new CreateDictionaryViewModel()
{
Name = fallback is not null ? $"{fallback} (Copy)" : "",
Name = fallback is not null ? $"Clone of {fallback}" : "",
Fallback = fallback ?? Translations.DefaultLanguage,
}.SetDictionaries(dictionaries));
}

View File

@ -1,21 +1,17 @@
using System;
using System.Collections.Generic;
using BTCPayServer.Services;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace BTCPayServer.Models.ServerViewModels
namespace BTCPayServer.Models.ServerViewModels;
public class ListDictionariesViewModel
{
public class ListDictionariesViewModel
public class DictionaryViewModel
{
public class DictionaryViewModel
{
public string DictionaryName { get; set; }
public string Fallback { get; set; }
public string Source { get; set; }
public bool Editable { get; set; }
public bool IsSelected { get; set; }
}
public List<DictionaryViewModel> Dictionaries = new List<DictionaryViewModel>();
public string DictionaryName { get; set; }
public string Fallback { get; set; }
public string Source { get; set; }
public bool Editable { get; set; }
public bool IsSelected { get; set; }
}
public List<DictionaryViewModel> Dictionaries = [];
}

View File

@ -60,6 +60,7 @@ Can use RPC import
Celebrate payment with confetti
Check releases on GitHub and notify when new BTCPay Server version is available
Checkout Appearance
Clone
Colors to rotate between with animation when a payment is made. One color per line.
Confirm new password
Confirm password
@ -72,6 +73,7 @@ Contribution Perks Template
Count all invoices created on the store as part of the goal
Create
Create a new app
Create a new dictionary
Create Account
Create Form
Create Invoice
@ -99,6 +101,9 @@ Derivation scheme format
Description
Description template of the lightning invoice
Destination Address
Dictionaries
Dictionaries enable you to translate the BTCPay Server backend into different languages.
Dictionary
Disable public user registration
Disable stores from using the server's email settings as backup
Discourage search engines from indexing this site
@ -137,6 +142,7 @@ Expiration Date
Export
Extends the BTCPay Server Dark theme
Extends the BTCPay Server Light theme
Fallback
Featured Image URL
Fee rate (sat/vB)
Files
@ -150,6 +156,7 @@ Generate Key
Google Cloud Storage
GRPC SSL Cipher suite (GRPC_SSL_CIPHER_SUITES)
Hide Sensitive Info
If a translation isnt available in the new dictionary, it will be searched in the fallback.
Image
Invoice currency
Invoice expires if the full amount has not been paid after
@ -177,6 +184,7 @@ Memo
Metadata
Min sats
Minimum acceptable expiration time for BOLT11 for refunds
Name
New password
Next
Non-admins can access the User Creation API Endpoint
@ -226,6 +234,7 @@ Regenerate code
Register
Remember me
Remember this machine
Remove
Reporting
Request contributor data on checkout
Request customer data on checkout
@ -240,6 +249,7 @@ Save
Scope
Search engines can index this site
Security device (FIDO2)
Select
Select the Default Currency during Store Creation
Select the payout method used for refund
Send test webhook

View File

@ -1,37 +1,34 @@
@using BTCPayServer.Abstractions.Models
@model CreateDictionaryViewModel
@{
ViewData.SetActivePage(ServerNavPages.Translations);
ViewData["Title"] = "Create a new dictionary";
ViewData.SetActivePage(ServerNavPages.Translations, "Create a new dictionary");
}
<form method="post" class="d-flex flex-column">
<div class="form-group">
<div class="sticky-header">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a asp-action="ListDictionaries">Dictionaries</a>
</li>
<li class="breadcrumb-item active" aria-current="page">@ViewData["Title"]</li>
</ol>
<h2 text-translate="true">@ViewData["Title"]</h2>
</nav>
<input id="page-primary" type="submit" value="Create" class="btn btn-primary" />
</div>
<form method="post">
<div class="sticky-header">
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a asp-action="ListDictionaries" text-translate="true">Dictionaries</a>
</li>
<li class="breadcrumb-item active" aria-current="page" text-translate="true">@ViewData["Title"]</li>
</ol>
<h2 text-translate="true">@ViewData["Title"]</h2>
</nav>
<input id="page-primary" type="submit" value="Create" class="btn btn-primary" />
</div>
<div class="row">
<div class="col-xl-8 col-xxl-constrain">
<div class="form-group">
<label asp-for="Name" class="form-label"></label>
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name" class="text-danger"></span>
</div>
<label asp-for="Fallback" class="form-label"></label>
<div class="row">
<div class="col-xl-8 col-xxl-constrain">
<div class="form-group">
<label asp-for="Name" class="form-label" text-translate="true"></label>
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Fallback" class="form-label" text-translate="true"></label>
<select asp-for="Fallback" class="form-select w-auto" asp-items="@Model.DictionariesListItems"></select>
<span asp-validation-for="Fallback" class="text-danger"></span>
<div class="form-text">If a translation isnt available in the new dictionary, it will be searched in the fallback.</div>
</div>
<div class="form-text" text-translate="true">If a translation isnt available in the new dictionary, it will be searched in the fallback.</div>
</div>
</div>
</div>
</form>

View File

@ -1,8 +1,7 @@
@using BTCPayServer.Abstractions.Models
@model ListDictionariesViewModel
@{
ViewData.SetActivePage(ServerNavPages.Translations);
ViewData["Title"] = "Dictionaries";
ViewData.SetActivePage(ServerNavPages.Translations, "Dictionaries");
}
<div class="sticky-header">
@ -13,21 +12,16 @@
</div>
<partial name="_StatusMessage" />
<div class="d-flex mb-4">
<div class="flex-fill">
<p class="mb-0">
Dictionaries enable you to translate the BTCPay Server backend into different languages.
</p>
</div>
</div>
<p class="mb-0" text-translate="true">
Dictionaries enable you to translate the BTCPay Server backend into different languages.
</p>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Dictionary</th>
<th>Fallback</th>
<th text-translate="true">Dictionary</th>
<th text-translate="true">Fallback</th>
<th class="actions-col"></th>
</tr>
</thead>
@ -35,27 +29,33 @@
@foreach (var v in Model.Dictionaries)
{
<tr>
<td>
<td class="d-flex flex-wrap align-items-center gap-2">
@if (!v.Editable)
{
<span class="@(v.IsSelected? "fw-bold" : "")">@v.DictionaryName</span>
<span >@v.DictionaryName</span>
}
else
{
<a class="@(v.IsSelected? "fw-bold" : "")" asp-action="EditDictionary" asp-route-dictionary="@v.DictionaryName">@v.DictionaryName</a>
<a asp-action="EditDictionary" asp-route-dictionary="@v.DictionaryName">@v.DictionaryName</a>
}
@if (v.IsSelected)
{
<span class="badge bg-info">
In use
</span>
}
</td>
<td>@v.Fallback</td>
<td class="actions-col">
<div class="d-inline-flex align-items-center gap-3">
<a asp-action="CreateDictionary" asp-route-fallback="@v.DictionaryName">Clone</a>
<a asp-action="CreateDictionary" asp-route-fallback="@v.DictionaryName" text-translate="true">Clone</a>
@if (!v.IsSelected)
{
<a id="Select-@v.DictionaryName" asp-action="SelectDictionary" asp-route-dictionary="@v.DictionaryName">Select</a>
<a id="Select-@v.DictionaryName" asp-action="SelectDictionary" asp-route-dictionary="@v.DictionaryName" text-translate="true">Select</a>
}
@if (v.Editable && !v.IsSelected)
{
<a id="Delete-@v.DictionaryName" asp-action="DeleteDictionary" asp-route-dictionary="@v.DictionaryName" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-description="The dictionary <b>@Html.Encode(v.DictionaryName)</b> will be removed from this server." data-confirm-input="DELETE">Remove</a>
<a id="Delete-@v.DictionaryName" asp-action="DeleteDictionary" asp-route-dictionary="@v.DictionaryName" data-bs-toggle="modal" data-bs-target="#ConfirmModal" data-description="The dictionary <b>@Html.Encode(v.DictionaryName)</b> will be removed from this server." data-confirm-input="DELETE" text-translate="true">Remove</a>
}
</div>
</td>