From 6cb04fd803219e1eba6fea8c5067041bf7a40675 Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Fri, 14 Aug 2026 16:07:43 +0200 Subject: [PATCH] Traduzioni --- Test.UI/Traduzioni/Traduzione.json | 67 ++++++++++--------- WebWindowComplex/Compo/AreaFrame.razor.cs | 2 +- WebWindowComplex/Compo/CardFill.razor | 10 +-- WebWindowComplex/Compo/CardFill.razor.cs | 47 +++++++++++-- WebWindowComplex/Compo/CardFrame.razor.cs | 2 +- WebWindowComplex/TableComp.razor | 18 ++--- WebWindowComplex/WebWindowComplex.csproj | 3 + .../WebWindowConfigurator.csproj | 8 +++ 8 files changed, 104 insertions(+), 53 deletions(-) diff --git a/Test.UI/Traduzioni/Traduzione.json b/Test.UI/Traduzioni/Traduzione.json index ff0016d..410f5c2 100644 --- a/Test.UI/Traduzioni/Traduzione.json +++ b/Test.UI/Traduzioni/Traduzione.json @@ -1,34 +1,37 @@ { - "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" + "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", + "CWTableC_AllFill": "Tutti riempimenti", + "CWTableC_AllGlass": "Tutti vetro", + "CWTableC_AllWood": "Tutti legno", + "CWTree_Remove": "Elimina", + "CWTree_Sash": "Ante", + "CWTree_Split": "Divisione", + "CWTree_AddInglesina": "Aggiungi Inglesina", + "CWTree_AddSash": "Aggiungi Ante", + "CWTree_CopySash": "Copia Anta", + "CWFill_Fill": "Riempimento", + "CWFill_Glass": "Vetro", + "CWFill_Wood": "Legno" } \ No newline at end of file diff --git a/WebWindowComplex/Compo/AreaFrame.razor.cs b/WebWindowComplex/Compo/AreaFrame.razor.cs index 9f6d701..bd2b64a 100644 --- a/WebWindowComplex/Compo/AreaFrame.razor.cs +++ b/WebWindowComplex/Compo/AreaFrame.razor.cs @@ -26,7 +26,7 @@ namespace WebWindowComplex.Compo public List SplitList { get; set; } = null!; /// - /// Evento per richiesta traduzioni + /// Vocabolario con traduzione lingua corrente /// [CascadingParameter(Name = "Vocabulary")] public Dictionary Vocabulary { get; set; } = null!; diff --git a/WebWindowComplex/Compo/CardFill.razor b/WebWindowComplex/Compo/CardFill.razor index 655d384..4e9e8fa 100644 --- a/WebWindowComplex/Compo/CardFill.razor +++ b/WebWindowComplex/Compo/CardFill.razor @@ -3,7 +3,7 @@
-
Fill @(CurrIndex + 1)
+
@Traduci("CWFill_Fill") @(CurrIndex + 1)
@@ -19,11 +19,11 @@
@if (BaseUser) { - + } else { - + }
@@ -31,11 +31,11 @@
@if (BaseUser) { - + } else { - + }
diff --git a/WebWindowComplex/Compo/CardFill.razor.cs b/WebWindowComplex/Compo/CardFill.razor.cs index a3d71ee..402294b 100644 --- a/WebWindowComplex/Compo/CardFill.razor.cs +++ b/WebWindowComplex/Compo/CardFill.razor.cs @@ -26,6 +26,12 @@ namespace WebWindowComplex.Compo [Parameter] public bool BaseUser { get; set; } = false!; + /// + /// Vocabolario con traduzione lingua corrente + /// + [Parameter] + public Dictionary Vocabulary { get; set; } = null!; + /// /// Evento per cambiare tutti i fill /// @@ -38,25 +44,39 @@ namespace WebWindowComplex.Compo [Parameter] public EventCallback EC_ReqClose { get; set; } + /// + /// Evento per richiesta traduzione + /// + [Parameter] + public EventCallback> EC_ReqTraduzione { get; set; } + #endregion Public Properties - #region Protected Methods + #region Protected Properties + protected override async Task OnInitializedAsync() + { + Dictionary FillDict = Vocabulary.Where(x => x.Key.Contains("CWFill_")).ToDictionary(x => x.Key, y => y.Value); + if (FillDict == null || FillDict.Count != 3) + { + List tradList = new List() { "CWFill_Fill", "CWFill_Glass", "CWFill_Wood"}; + await EC_ReqTraduzione.InvokeAsync(tradList); + } + } + #endregion Protected Properties + + #region Private Methods /// /// Metodo per cambiare solo il Fill corrente /// /// Tipo di fill richiesto /// - protected Task ChangeOneFill(FillTypes reqFillType) + private Task ChangeOneFill(FillTypes reqFillType) { CurrFill.SelFillType = reqFillType; return EC_UpdateFill.InvokeAsync(CurrFill); } - #endregion Protected Methods - - #region Private Methods - /// /// Metodo per tornare alla pagina Tree /// @@ -74,6 +94,21 @@ namespace WebWindowComplex.Compo return (CurrFill.SelFillType == reqFillTypes) ? "btn btn-secondary btn-sm" : "btn btn-outline-secondary btn-sm"; } + /// + /// 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; + } + #endregion Private Methods } diff --git a/WebWindowComplex/Compo/CardFrame.razor.cs b/WebWindowComplex/Compo/CardFrame.razor.cs index a909db1..acfccc8 100644 --- a/WebWindowComplex/Compo/CardFrame.razor.cs +++ b/WebWindowComplex/Compo/CardFrame.razor.cs @@ -69,7 +69,7 @@ namespace WebWindowComplex.Compo public bool BaseUser { get; set; } = false!; /// - /// Evento per richiesta traduzioni + /// Vocabolario con traduzione lingua corrente /// [CascadingParameter(Name = "Vocabulary")] public Dictionary Vocabulary { get; set; } = null!; diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index eb10b68..a6ca8ac 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -136,7 +136,7 @@ - + + EC_ReqClose="ReturnTree" + EC_ReqTraduzione="DoReqTraduzione">
-
@Traduci("CWFill_AllFill")
+
@Traduci("CWTableC_AllFill")
@if (BaseUser) { - + } else { - + }
@if (BaseUser) { - + } else { - + }
diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 90488c3..206eb04 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -244,6 +244,9 @@ + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 0cd714e..2db8e85 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -551,6 +551,14 @@ + + + + + + + +