From 20fc85709f6af9585f066aa62a5df31966af13a2 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Fri, 14 Aug 2026 12:51:18 +0200 Subject: [PATCH] Traduzioni --- Test.UI/Components/Pages/EditJWD.razor.cs | 2 + WebWindowComplex/Compo/AreaFrame.razor | 2 +- WebWindowComplex/Compo/AreaFrame.razor.cs | 20 ++++++++++ WebWindowComplex/Compo/CardFrame.razor.cs | 11 +----- WebWindowComplex/Compo/CardTree.razor | 14 +++---- WebWindowComplex/Compo/CardTree.razor.cs | 37 +++++++++++++++++++ WebWindowComplex/TableComp.razor | 6 ++- WebWindowComplex/TableComp.razor.cs | 8 ++++ WebWindowComplex/WebWindowComplex.csproj | 6 ++- .../WebWindowConfigurator.csproj | 6 ++- 10 files changed, 91 insertions(+), 21 deletions(-) diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index ef4a4c5..4742c2e 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -338,6 +338,8 @@ namespace Test.UI.Components.Pages 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"); } } diff --git a/WebWindowComplex/Compo/AreaFrame.razor b/WebWindowComplex/Compo/AreaFrame.razor index ac25596..5da40b9 100644 --- a/WebWindowComplex/Compo/AreaFrame.razor +++ b/WebWindowComplex/Compo/AreaFrame.razor @@ -2,7 +2,7 @@
-
@Traduci("CWFrame_AreaFrame")
+
@Traduci("CWAreaF_AreaFrame")
@if (SashGroupList.Count == 0 && SplitList.Count == 0) { diff --git a/WebWindowComplex/Compo/AreaFrame.razor.cs b/WebWindowComplex/Compo/AreaFrame.razor.cs index f5719c8..85db4ab 100644 --- a/WebWindowComplex/Compo/AreaFrame.razor.cs +++ b/WebWindowComplex/Compo/AreaFrame.razor.cs @@ -40,8 +40,28 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_AddInglesina { get; set; } + /// + /// Evento per richiesta traduzione + /// + [Parameter] + public EventCallback> EC_ReqTraduzione { get; set; } + #endregion Public Properties + #region Protected Properties + + protected override async Task OnInitializedAsync() + { + Dictionary AreaFDict = Vocabulary.Where(x => x.Key.Contains("CWAreaF_")).ToDictionary(x => x.Key, y => y.Value); + if (AreaFDict == null || AreaFDict.Count != 4) + { + List tradList = new List() { "CWAreaF_AreaFrame", "CWAreaF_AggSash", "CWAreaF_AggSplit", "CWAreaF_AggInglesina"}; + await EC_ReqTraduzione.InvokeAsync(tradList); + } + } + + #endregion Protected Properties + #region Private Methods /// diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index a38fc49..a909db1 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -1,7 +1,5 @@ using Egw.Window.Data; using Microsoft.AspNetCore.Components; -using System.Diagnostics; -using System.Text.RegularExpressions; using WebWindowComplex.Models; namespace WebWindowComplex.Compo @@ -82,17 +80,12 @@ namespace WebWindowComplex.Compo protected override async Task OnInitializedAsync() { - var FrameVocab = Vocabulary.Where(x => x.Key.Contains("CWFrame_")).ToDictionary(x=>x.Key, y=>y.Value); - if(FrameVocab == null || FrameVocab.Count != 9) + Dictionary FrameDict = Vocabulary.Where(x => x.Key.Contains("CWFrame_")).ToDictionary(x => x.Key, y => y.Value); + if(FrameDict == null || FrameDict.Count != 9) { List tradList = new List() { "CWFrame_Frame", "CWFrame_Shape", "CWFrame_Dimension", "CWFrame_Threshold", "CWFrame_Tipology", "CWFrame_BottomRail", "CWFrame_Quantity", "CWFrame_Joints", "CWFrame_Element" }; await EC_ReqTraduzione.InvokeAsync(tradList); } - //if (Vocabulary == null || Vocabulary.Count == 0) - //{ - // List tradList = new List() { "ConfWind_Frame", "ConfWind_Shape", "ConfWind_Dimension", "ConfWind_Threshold", "ConfWind_Tipology", "ConfWind_BottomRail", "ConfWind_Quantity", "ConfWind_Joints", "ConfWind_Element" }; - // await EC_ReqTraduzione.InvokeAsync(tradList); - //} } #endregion Protected Properties diff --git a/WebWindowComplex/Compo/CardTree.razor b/WebWindowComplex/Compo/CardTree.razor index 316490e..1d10cf1 100644 --- a/WebWindowComplex/Compo/CardTree.razor +++ b/WebWindowComplex/Compo/CardTree.razor @@ -76,7 +76,7 @@ ItemTableList[i].Type is Json.WindowConst.AreaTypes.SPLIT || ItemTableList[i].Type is Json.WindowConst.AreaTypes.INGLESINA) { - } @@ -90,11 +90,11 @@
@@ -109,7 +109,7 @@
} @@ -126,12 +126,12 @@ diff --git a/WebWindowComplex/Compo/CardTree.razor.cs b/WebWindowComplex/Compo/CardTree.razor.cs index 5ba7528..6337a21 100644 --- a/WebWindowComplex/Compo/CardTree.razor.cs +++ b/WebWindowComplex/Compo/CardTree.razor.cs @@ -66,6 +66,12 @@ namespace WebWindowComplex.Compo [Parameter] public bool BaseUser { get; set; } = false; + /// + /// Evento per richiesta traduzioni + /// + [Parameter] + public Dictionary Vocabulary { get; set; } = null!; + /// /// Evento richiesta prossimo step /// @@ -114,6 +120,21 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_UpdateSplitted { get; set; } + /// + /// Evento per richiesta traduzione + /// + [Parameter] + public EventCallback> EC_ReqTraduzione { get; set; } + + protected override async Task OnInitializedAsync() + { + if (Vocabulary == null || Vocabulary.Count != 6) + { + List tradList = new List() { "CWTree_Remove", "CWTree_Sash", "CWTree_Split", "CWTree_AddInglesina", "CWTree_AddSash", "CWTree_CopySash"}; + await EC_ReqTraduzione.InvokeAsync(tradList); + } + } + protected override void OnParametersSet() { for(int i = 0; i < FillList.Count; i++) @@ -285,6 +306,22 @@ namespace WebWindowComplex.Compo { isOpenFill[currIndexFill] = !isOpenFill.ElementAt(currIndexFill); } + + /// + /// Metodo per traduzione in lingua corrente + /// + /// + /// + private string Traduci(string lemma) + { + string ans = lemma; + if (Vocabulary != null && Vocabulary.ContainsKey(lemma)) + { + ans = Vocabulary.GetValueOrDefault(lemma) ?? ""; + } + return ans; + } + } /// diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index 0bec31e..a8f4029 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -114,6 +114,7 @@ FillList="FillList" FrameWindow="FrameWindow" BaseUser="BaseUser" + Vocabulary="@(RestrictDict(new List(){"CWTree_"}))" EC_NextStep="NextStepArgs" EC_Remove="RemoveArea" EC_Collapsed="CollapsedRowTree" @@ -121,7 +122,8 @@ EC_ReqOptionHw="UpdateHwOptionsFrame" EC_ReqElement="UpdateElementFrame" EC_UpdateFrame="UpdatePreviewFrame" - EC_UpdateSplitted="UpdatePreviewSplitted"> + EC_UpdateSplitted="UpdatePreviewSplitted" + EC_ReqTraduzione="DoReqTraduzione"> } else if (currStep == CompileStep.Frame) @@ -134,7 +136,7 @@ - + RestrictDict(List subComp) + { + Dictionary dict = new Dictionary(); + if(Vocabulary != null && Vocabulary.Count > 0) + dict = Vocabulary.Where(x => subComp.Any(sub => x.Key.Contains(sub))).ToDictionary(x => x.Key, y => y.Value); + return dict; + } + #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index e9fc68f..72998ba 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.8.1318 + 3.1.8.1412 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -218,6 +218,10 @@ + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 47688ed..011bff9 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.8.1318 + 3.1.8.1412 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -531,6 +531,10 @@ + + + +