Modifica traduzioni

This commit is contained in:
Annamaria Sassi
2026-08-14 14:44:29 +02:00
parent e3e4ddc4e3
commit 953a90fa62
7 changed files with 90 additions and 35 deletions
+10 -15
View File
@@ -322,24 +322,19 @@ namespace Test.UI.Components.Pages
}
private void Traduzione(List<string> args)
private async Task Traduzione(List<string> args)
{
if ((args != null && args.Count > 0))
{
if (!TradVocabulary.ContainsKey("CWFrame_Frame"))
TradVocabulary.Add("CWFrame_Frame", "Telaio");
if (!TradVocabulary.ContainsKey("CWFrame_Shape"))
TradVocabulary.Add("CWFrame_Shape", "Forma");
if (!TradVocabulary.ContainsKey("CWFrame_Dimension"))
TradVocabulary.Add("CWFrame_Dimension", "Dimensioni");
if (!TradVocabulary.ContainsKey("CWFrame_Threshold"))
TradVocabulary.Add("CWFrame_Threshold", "Soglia");
if (!TradVocabulary.ContainsKey("CW_Reset"))
TradVocabulary.Add("CW_Reset", "Reset");
if (!TradVocabulary.ContainsKey("CWTableC_Tree"))
TradVocabulary.Add("CWTableC_Tree", "Struttura");
if (!TradVocabulary.ContainsKey("CWAreaF_AreaFrame"))
TradVocabulary.Add("CWAreaF_AreaFrame", "Area Frame");
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Traduzioni", "Traduzione.json");
if (File.Exists(filePath))
{
string jsonText = await File.ReadAllTextAsync(filePath);
// Deserializza direttamente nel dizionario
TradVocabulary = JsonConvert.DeserializeObject<Dictionary<string,string>>(jsonText) ?? new();
}
}
}
+34
View File
@@ -0,0 +1,34 @@
{
"CWFrame_BottomRail":"Zoccolo",
"CWFrame_Dimension":"Dimensioni",
"CWFrame_Element":"Elementi",
"CWFrame_Frame":"Telaio",
"CWFrame_Joints":"Giunzioni",
"CWFrame_Quantity":"Quantità",
"CWFrame_Shape":"Forma",
"CWFrame_Threshold":"Soglia",
"CWFrame_Tipology":"Tipologia",
"CWAreaF_AreaFrame":"Area Telaio",
"CWAreaF_AggSash":"Aggiungi Ante",
"CWAreaF_AggSplit":"Aggiungi divisione",
"CWAreaF_AggInglesina":"Aggiungi ingesina",
"CWTableC_Reset":"Reset",
"CWTableC_Save":"Salva",
"CWTableC_Close":"Chiudi",
"CWTableC_MissingParam":"Parametri mancanti!",
"CWTableC_MissingJWD":"JWD mancante!",
"CWTableC_ValidError":"Errore validazione!",
"CWTableC_ConfigError":"Errore configurazione",
"CWTableC_MissingValue":"Mancata corrispondenza valori",
"CWTableC_Tree":"Struttura",
"CWTableC_General":"Generale",
"CWFill_AllFill":"Tutti riempimenti",
"CWFill_AllGlass":"Tutti vetro",
"CWFill_AllWood":"Tutti legno",
"CWTree_Remove":"Elimina",
"CWTree_Sash":"Ante",
"CWTree_Split":"Divisione",
"CWTree_AddInglesina":"Aggiungi Inglesina",
"CWTree_AddSash":"Aggiungi Ante",
"CWTree_CopySash":"Copia Anta"
}
+5 -3
View File
@@ -52,7 +52,7 @@ namespace WebWindowComplex.Compo
protected override async Task OnInitializedAsync()
{
Dictionary<string, string> AreaFDict = Vocabulary.Where(x => x.Key.Contains("CWAreaF_")).ToDictionary(x => x.Key, y => y.Value);
AreaFDict = Vocabulary.Where(x => x.Key.Contains("CWAreaF_")).ToDictionary(x => x.Key, y => y.Value);
if (AreaFDict == null || AreaFDict.Count != 4)
{
List<string> tradList = new List<string>() { "CWAreaF_AreaFrame", "CWAreaF_AggSash", "CWAreaF_AggSplit", "CWAreaF_AggInglesina"};
@@ -62,6 +62,8 @@ namespace WebWindowComplex.Compo
#endregion Protected Properties
private Dictionary<string, string> AreaFDict = new();
#region Private Methods
/// <summary>
@@ -99,9 +101,9 @@ namespace WebWindowComplex.Compo
private string Traduci(string lemma)
{
string ans = lemma;
if (Vocabulary != null && Vocabulary.ContainsKey(lemma))
if (AreaFDict != null && AreaFDict.ContainsKey(lemma))
{
ans = Vocabulary.GetValueOrDefault(lemma) ?? "";
ans = AreaFDict.GetValueOrDefault(lemma) ?? "";
}
return ans;
}
+5 -5
View File
@@ -10,7 +10,7 @@
<div class="d-flex flex-column">
<div class="card text-center shadow rounded">
<div class="col-md-12 d-grid gap-4 p-2 d-md-flex justify-content-end flex-wrap">
<button class="btn btn-lg btn-primary px-4" style="font-size: 1rem;" @onclick="DoClose">@Traduci("CW_Close")</button>
<button class="btn btn-lg btn-primary px-4" style="font-size: 1rem;" @onclick="DoClose">@Traduci("CWTableC_Close")</button>
</div>
<div class="alert alert-warning">
<div class="fs-3">@Traduci("CWTableC_MissingParam")</div>
@@ -23,7 +23,7 @@
<div class="d-flex flex-column">
<div class="card text-center shadow rounded">
<div class="col-md-12 d-grid gap-4 p-2 d-md-flex justify-content-end flex-wrap">
<button class="btn btn-lg btn-primary px-4" style="font-size: 1rem;" @onclick="DoClose">@Traduci("CW_Close")</button>
<button class="btn btn-lg btn-primary px-4" style="font-size: 1rem;" @onclick="DoClose">@Traduci("CWTableC_Close")</button>
</div>
<div class="alert alert-warning">
<div class="fs-3">@Traduci("CWTableC_MissingJWD")</div>
@@ -93,9 +93,9 @@
</ul>
</div>
<div class="col-md-12 col-lg-6 d-grid gap-4 px-4 d-md-flex justify-content-md-end align-items-center flex-wrap">
<button class="btn btn-lg btn-primary px-4" style="font-size: 1rem;" @onclick="DoReset">@Traduci("CW_Reset")</button>
<button class="btn btn-lg btn-primary px-4" style="font-size: 1rem;" @onclick="DoSave">@Traduci("CW_Save")</button>
<button class="btn btn-lg btn-primary px-4" style="font-size: 1rem;" @onclick="DoClose">@Traduci("CW_Close")</button>
<button class="btn btn-lg btn-primary px-4" style="font-size: 1rem;" @onclick="DoReset">@Traduci("CWTableC_Reset")</button>
<button class="btn btn-lg btn-primary px-4" style="font-size: 1rem;" @onclick="DoSave">@Traduci("CWTableC_Save")</button>
<button class="btn btn-lg btn-primary px-4" style="font-size: 1rem;" @onclick="DoClose">@Traduci("CWTableC_Close")</button>
</div>
</div>
</div>
+13 -10
View File
@@ -161,8 +161,6 @@ namespace WebWindowComplex
protected override async Task OnInitializedAsync()
{
// Ricava il percorso assoluto sul disco del server
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"Data", "Lemmi.json");
if (File.Exists(filePath))
@@ -174,12 +172,6 @@ namespace WebWindowComplex
await EC_ReqTraduzione.InvokeAsync(tradList);
}
}
//if (Vocabulary == null || Vocabulary.Count == 0)
//{
// List<string> tradList = new List<string>() { "ConfWind_MissingParam", "ConfWind_MissingJWD", "ConfWind_ValidError", "ConfWind_ConfigError", "ConfWind_Tree", "ConfWind_General", "ConfWind_Reset", "ConfWind_Save", "ConfWind_Close", "ConfWind_AllFill", "ConfWind_AllGlass", "ConfWind_AllWood" };
// await EC_ReqTraduzione.InvokeAsync(tradList);
//}
}
/// <summary>
@@ -325,12 +317,23 @@ namespace WebWindowComplex
//PendReq.Remove("Profile");
//await EC_PendantAction.InvokeAsync(PendReq);
}
if(Vocabulary != null)
{
TableCDict = Vocabulary.Where(x => x.Key.Contains("CWTableC_")).ToDictionary(x => x.Key, y => y.Value);
if (TableCDict == null || TableCDict.Count != 10)
{
List<string> tradList = new List<string>() { "CWTableC_Reset", "CWTableC_Save", "CWTableC_Close", "CWTableC_MissingParam", "CWTableC_MissingJWD", "CWTableC_ValidError", "CWTableC_ConfigError", "CWTableC_MissingValue", "CWTableC_Tree", "CWTableC_General" };
await EC_ReqTraduzione.InvokeAsync(tradList);
}
}
}
#endregion Protected Methods
#region Private Fields
private Dictionary<string, string> TableCDict = new();
private bool reqBool = false;
private bool waitShape = false;
@@ -2315,9 +2318,9 @@ namespace WebWindowComplex
private string Traduci(string lemma)
{
string ans = lemma;
if (Vocabulary != null && Vocabulary.ContainsKey(lemma))
if (TableCDict != null && TableCDict.ContainsKey(lemma))
{
ans = Vocabulary.GetValueOrDefault(lemma) ?? "";
ans = TableCDict.GetValueOrDefault(lemma) ?? "";
}
return ans;
}
+12 -1
View File
@@ -6,7 +6,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>3.1.8.1413</Version>
<Version>3.1.8.1414</Version>
<Authors>Annamaria Sassi</Authors>
<Company>Egalware</Company>
<Description>Componente gestione Configurazioni avanzate Window per LUX</Description>
@@ -218,6 +218,17 @@
@@ -6,7 +6,7 @@
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>3.1.8.1413</Version>
<Version>3.1.8.1414</Version>
<Authors>Annamaria Sassi</Authors>
<Company>Egalware</Company>
<Description>Componente gestione JWD per LUX</Description>
@@ -533,6 +533,16 @@