mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-04 14:44:30 +01:00
Allow translations of BTCPay Server Backend by admins (#5662)
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using BTCPayServer.Services;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace BTCPayServer.Models.ServerViewModels;
|
||||
public class CreateDictionaryViewModel
|
||||
{
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string Name { get; set; }
|
||||
public string Fallback { get; set; }
|
||||
public SelectListItem[] DictionariesListItems { get; set; }
|
||||
|
||||
internal CreateDictionaryViewModel SetDictionaries(LocalizerService.Dictionary[] dictionaries)
|
||||
{
|
||||
var items = dictionaries.Select(d => new SelectListItem(d.DictionaryName, d.DictionaryName, d.DictionaryName == Fallback)).ToArray();
|
||||
DictionariesListItems = items;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using BTCPayServer.Services;
|
||||
|
||||
namespace BTCPayServer.Models.ServerViewModels;
|
||||
|
||||
public class EditDictionaryViewModel
|
||||
{
|
||||
public string Translations { get; set; }
|
||||
public int Lines { get; set; }
|
||||
|
||||
internal EditDictionaryViewModel SetTranslations(Translations translations)
|
||||
{
|
||||
Translations = translations.ToTextFormat();
|
||||
Lines = translations.Records.Count;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BTCPayServer.Services;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
|
||||
namespace BTCPayServer.Models.ServerViewModels
|
||||
{
|
||||
public class ListDictionariesViewModel
|
||||
{
|
||||
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>();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user