From dfc89e442e56f7664dc4b17a3f43e369221d471f Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Thu, 20 Aug 2026 16:30:29 +0200 Subject: [PATCH] Aggiunte nuove traduzioni --- Test.UI/Traduzioni/Traduzione.json | 65 +++- WebWindowComplex/Compo/AreaFrame.razor.cs | 4 + WebWindowComplex/Compo/AreaHwOption.razor | 2 +- WebWindowComplex/Compo/AreaHwOption.razor.cs | 65 +++- WebWindowComplex/Compo/AreaSash.razor | 32 +- WebWindowComplex/Compo/AreaSash.razor.cs | 44 ++- WebWindowComplex/Compo/AreaSplit.razor | 52 ++- WebWindowComplex/Compo/AreaSplit.razor.cs | 43 +++ WebWindowComplex/Compo/BottomRail.razor | 12 +- WebWindowComplex/Compo/BottomRail.razor.cs | 36 ++ WebWindowComplex/Compo/CardFill.razor | 2 +- WebWindowComplex/Compo/CardFrame.razor.cs | 2 +- WebWindowComplex/Compo/CardSashGroup.razor | 36 +- WebWindowComplex/Compo/CardSashGroup.razor.cs | 34 +- WebWindowComplex/Compo/CardSplit.razor | 34 +- WebWindowComplex/Compo/CardSplit.razor.cs | 341 +++++++++--------- WebWindowComplex/Compo/EditElement.razor | 2 +- WebWindowComplex/Compo/EditElement.razor.cs | 78 +++- .../Compo/EditSplitDimensions.razor | 3 +- .../Compo/EditSplitDimensions.razor.cs | 39 ++ WebWindowComplex/Compo/EditSplitElement.razor | 2 +- .../Compo/EditSplitElement.razor.cs | 53 ++- WebWindowComplex/Compo/General.razor | 22 +- WebWindowComplex/Compo/General.razor.cs | 85 +++-- WebWindowComplex/Data/Lemmi.json | 65 +++- WebWindowComplex/TableComp.razor | 45 +-- WebWindowComplex/TableComp.razor.cs | 2 +- WebWindowComplex/WebWindowComplex.csproj | 5 +- .../WebWindowConfigurator.csproj | 37 +- 29 files changed, 887 insertions(+), 355 deletions(-) diff --git a/Test.UI/Traduzioni/Traduzione.json b/Test.UI/Traduzioni/Traduzione.json index 410f5c2..7840b99 100644 --- a/Test.UI/Traduzioni/Traduzione.json +++ b/Test.UI/Traduzioni/Traduzione.json @@ -33,5 +33,68 @@ "CWTree_CopySash": "Copia Anta", "CWFill_Fill": "Riempimento", "CWFill_Glass": "Vetro", - "CWFill_Wood": "Legno" + "CWFill_Wood": "Legno", + "CWSash_SashGoup": "Gruppo di ante", + "CWSash_RemoveSash": "Elimina gruppo ante", + "CWSash_Tipology": "Tipologia", + "CWSash_Vertical": "Verticale", + "CWSash_Horizontal": "Orizzontale", + "CWSash_QtySash": "Qtà ante", + "CWSash_QtyBottomR": "Qtà zoccoli", + "CWSash_Hardware": "Ferramenta", + "CWSash_Family": "Famiglia", + "CWSash_Type": "Tipologia", + "CWSash_Absolute": "Assoluta", + "CWSash_Proportional": "Proporzionale", + "CWSash_Percentage": "Percentuale", + "CWSash_SashMeasure": "Anta", + "CWSash_GlassMeasure": "Vetro", + "CWBottomR_BottomR": "Zoccolo", + "CWElem_Bottom": "Inferiore", + "CWElem_Right": "Destra", + "CWElem_Top": "Superiore", + "CWElem_Left": "Sinistra", + "CWHwOpt_HwOption": "Opzioni ferramenta", + "CWAreaS_Sash": "Anta", + "CWAreaS_CopyContent": "Copia contenuto", + "CWAreaS_Dimension": "Dimensione", + "CWAreaS_Handle": "Maniglia", + "CWAreaS_AddSplit": "Divisione", + "CWAreaS_AddInglesina": "Inglesina", + "CWAreaS_Element": "Elementi", + "CWAreaS_Joints": "Giunzioni", + "CWSplit_Sash": "Anta", + "CWSplit_SashGroup": "Ante", + "CWSplit_Split": "Divisione", + "CWSplit_SwapAree": "Scambia aree", + "CWSplit_RemoveSplit": "Elimina divisione", + "CWSplit_Absolute": "Assoluta", + "CWSplit_Proportional": "Proporzionale", + "CWSplit_Percentage": "Percentuale", + "CWSplit_Glass": "Vetro", + "CWSplit_Shape": "Forma", + "CWSplit_Horizontal": "Orizzontale", + "CWSplit_Vertical": "Verticale", + "CWSplit_Grid": "Griglia", + "CWSplit_Custom": "Personalizzato", + "CWSplit_StartVert": "Inizia verticale", + "CWSplit_HorizSplit": "Divisione orizzontale", + "CWSplit_QtySplit": "Qtà", + "CWSplit_VertSplit": "Divisione verticale", + "CWSplitElem_Height": "Altezza elemento", + "CWSplitElem_Width": "Larghezza elemento", + "CWSplitDim_Height": "Altezza area", + "CWSplitDim_Width": "Larghezza area", + "CWGeneral_General": "Generale", + "CWGeneral_Wood": "Legno", + "CWGeneral_Profile": "Profilo", + "CWGeneral_Fill": "Riempimento", + "CWGeneral_Glass": "Vetro", + "CWGeneral_Color": "Colore", + "CWGeneral_Window": "Finestra", + "CWAreaSp_AreaSp": "Area divisione", + "CWAreaSp_AddSash": "Aggiungi anta", + "CWAreaSp_CopySash": "Copia anta", + "CWAreaSp_AddInglesina": "Aggiungi inglesina", + "CWAreaSp_Sash": "Anta" } \ No newline at end of file diff --git a/WebWindowComplex/Compo/AreaFrame.razor.cs b/WebWindowComplex/Compo/AreaFrame.razor.cs index 9aaf5d7..e6f97e4 100644 --- a/WebWindowComplex/Compo/AreaFrame.razor.cs +++ b/WebWindowComplex/Compo/AreaFrame.razor.cs @@ -67,8 +67,12 @@ namespace WebWindowComplex.Compo #endregion Protected Properties + #region Private Fields + private Dictionary AreaFDict = new(); + #endregion Private Fields + #region Private Methods /// diff --git a/WebWindowComplex/Compo/AreaHwOption.razor b/WebWindowComplex/Compo/AreaHwOption.razor index 3f0d6c6..4a863b5 100644 --- a/WebWindowComplex/Compo/AreaHwOption.razor +++ b/WebWindowComplex/Compo/AreaHwOption.razor @@ -2,7 +2,7 @@
-
Hardware option
+
@Traduci("CWHwOpt_HwOption")
diff --git a/WebWindowComplex/Compo/AreaHwOption.razor.cs b/WebWindowComplex/Compo/AreaHwOption.razor.cs index e478947..eb13598 100644 --- a/WebWindowComplex/Compo/AreaHwOption.razor.cs +++ b/WebWindowComplex/Compo/AreaHwOption.razor.cs @@ -8,12 +8,20 @@ namespace WebWindowComplex.Compo { public partial class AreaHwOption { + #region Public Properties + /// /// Sash corrente rispetto alla lista Sash /// [CascadingParameter(Name = "CurrSashGroup")] public Sash CurrSashGroup { get; set; } = null!; + /// + /// Vocabolario con traduzione lingua corrente + /// + [CascadingParameter(Name = "Vocabulary")] + public Dictionary Vocabulary { get; set; } = null!; + /// /// Evento per aggiornare gli hardware option /// @@ -28,8 +36,15 @@ namespace WebWindowComplex.Compo [CascadingParameter(Name = "IsLoading")] public List IsLoading { get; set; } = new List(); - - private bool hwOptCollapsed { get; set; } = true; + + #endregion Public Properties + + #region Protected Methods + + protected override void OnParametersSet() + { + HwOptDict = Vocabulary.Where(x => x.Key.Contains("CWHwOpt_")).ToDictionary(x => x.Key, y => y.Value); + } protected override void OnAfterRender(bool firstRender) { @@ -39,6 +54,31 @@ namespace WebWindowComplex.Compo } } + #endregion Protected Methods + + #region Private Fields + + private Dictionary HwOptDict = new(); + + #endregion Private Fields + + #region Private Properties + + private bool hwOptCollapsed { get; set; } = true; + private bool IsLoadingHwOpt + { + get => IsLoading != null && IsLoading.Count > 0 && IsLoading.Contains("LoadHwOpt"); + } + + private string hwIcon + { + get => hwOptCollapsed ? "fa-solid fa-chevron-down" : "fa-solid fa-chevron-up"; + } + + #endregion Private Properties + + #region Private Methods + /// /// Metodo per aprire/chiudere area per hw option /// @@ -52,11 +92,6 @@ namespace WebWindowComplex.Compo } } - private string hwIcon - { - get => hwOptCollapsed ? "fa-solid fa-chevron-down" : "fa-solid fa-chevron-up"; - } - /// /// Report aggiornamento Option Combo /// @@ -85,10 +120,22 @@ namespace WebWindowComplex.Compo return EC_UpdateHwOpt.InvokeAsync(args); } - private bool IsLoadingHwOpt + /// + /// Metodo per traduzione in lingua corrente + /// + /// + /// + private string Traduci(string lemma) { - get => IsLoading != null && IsLoading.Count > 0 && IsLoading.Contains("LoadHwOpt"); + string ans = lemma; + if (HwOptDict != null && HwOptDict.ContainsKey(lemma)) + { + ans = HwOptDict.GetValueOrDefault(lemma) ?? ""; + } + return ans; } + + #endregion Private Methods } /// diff --git a/WebWindowComplex/Compo/AreaSash.razor b/WebWindowComplex/Compo/AreaSash.razor index 45c6187..9490e10 100644 --- a/WebWindowComplex/Compo/AreaSash.razor +++ b/WebWindowComplex/Compo/AreaSash.razor @@ -4,7 +4,7 @@ {
-
Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))
+
@Traduci("CWAreaS_Sash") @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))
@if(!BaseUser && CurrSashGroup.SashList.Count > 1) @@ -14,7 +14,7 @@ type="button" @onclick="ToggleDropdown" aria-expanded="@isOpen"> - Copy content + @Traduci("CWAreaS_CopyContent")
- Dimension + @Traduci("CWAreaS_Dimension") @if(BaseUser) { @@ -158,7 +158,7 @@
}
- +
@@ -168,13 +168,13 @@ {
-
Sash @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))
+
@Traduci("CWAreaS_Sash") @(CurrSashGroup.SashList.Count == 1 ? "" : (IndexSash + 1))
@if (!BaseUser && !(CurrAnta.AreaList[0] is Split)) {
- +
}
@@ -182,7 +182,7 @@ @if (!BaseUser && CurrAnta.AreaList[0].AreaList.Count == 0) {
- +
}
@@ -236,7 +236,7 @@
- Dimension + @Traduci("CWAreaS_Dimension") @if(BaseUser) { @@ -305,7 +305,7 @@
}
- +
@@ -314,7 +314,7 @@
-
Joints
+
@Traduci("CWAreaS_Joints")
@if (BaseUser) { @@ -323,10 +323,10 @@
} @@ -337,10 +337,10 @@
} @@ -365,7 +365,7 @@
-
Element
+
@Traduci("CWAreaS_Element")
diff --git a/WebWindowComplex/Compo/AreaSash.razor.cs b/WebWindowComplex/Compo/AreaSash.razor.cs index 7b20447..16c4719 100644 --- a/WebWindowComplex/Compo/AreaSash.razor.cs +++ b/WebWindowComplex/Compo/AreaSash.razor.cs @@ -59,6 +59,12 @@ namespace WebWindowComplex.Compo [Parameter] public int IndexSash { get; set; } = 0; + /// + /// Vocabolario con traduzione lingua corrente + /// + [CascadingParameter(Name = "Vocabulary")] + public Dictionary Vocabulary { get; set; } = null!; + /// /// Evento per aggiornare sash dimension /// @@ -86,6 +92,15 @@ namespace WebWindowComplex.Compo #endregion Public Properties + #region Protected Methods + + protected override void OnParametersSet() + { + AreaSDict = Vocabulary.Where(x => x.Key.Contains("CWAreaS_")).ToDictionary(x => x.Key, y => y.Value); + } + + #endregion Protected Methods + #region Private Fields private enum ModeView @@ -95,22 +110,16 @@ namespace WebWindowComplex.Compo Edit = 2 } - private bool ForceChangeAll = false; - private bool isOpen = false; private bool isOpenDropdown = false; - //private string currOpening = ""; + private Dictionary AreaSDict = new(); #endregion Private Fields #region Private Properties - private string GetImageOpeningPath(string fileName) => $"_content/Egw.Lux.WebWindowComplex/icone/sash/opening/{fileName}.svg"; - - private string GetImageJointShapePath(string fileName) => $"_content/Egw.Lux.WebWindowComplex/icone/joint/shape/All/{fileName}.svg"; - /// /// Anta corrente /// @@ -177,6 +186,10 @@ namespace WebWindowComplex.Compo #region Private Methods + private string GetImageOpeningPath(string fileName) => $"_content/Egw.Lux.WebWindowComplex/icone/sash/opening/{fileName}.svg"; + + private string GetImageJointShapePath(string fileName) => $"_content/Egw.Lux.WebWindowComplex/icone/joint/shape/All/{fileName}.svg"; + /// /// Metodo per avere il numero di decimali da usare nella form-input /// @@ -465,7 +478,7 @@ namespace WebWindowComplex.Compo { isOpenDropdown = !isOpenDropdown; } - + /// /// Chiude il dropdown quando l'utente clicca all'esterno dell'elemento /// @@ -477,6 +490,21 @@ namespace WebWindowComplex.Compo isOpen = false; } + /// + /// Metodo per traduzione in lingua corrente + /// + /// + /// + private string Traduci(string lemma) + { + string ans = lemma; + if (AreaSDict != null && AreaSDict.ContainsKey(lemma)) + { + ans = AreaSDict.GetValueOrDefault(lemma) ?? ""; + } + return ans; + } + #endregion Private Methods } diff --git a/WebWindowComplex/Compo/AreaSplit.razor b/WebWindowComplex/Compo/AreaSplit.razor index 21d3707..5a0fd28 100644 --- a/WebWindowComplex/Compo/AreaSplit.razor +++ b/WebWindowComplex/Compo/AreaSplit.razor @@ -2,25 +2,57 @@
-
Area split @(SplittedList.Count > 1 ? (SplittedList.IndexOf(CurrSplitted) + 1) : "")
+
@Traduci("CWAreaSp_AreaSp") @(SplittedList.Count > 1 ? (SplittedList.IndexOf(CurrSplitted) + 1) : "")
- +
-
- @for (int j = 0; j < SashGroupList.Count; j++) - { - int Index = j; + @if (SashGroupList.Count == 1) + { +
- +
- } -
+
+ } + else if (SashGroupList.Count > 1) + { + + } + @* @for (int j = 0; j < SashGroupList.Count; j++) + { + + int Index = j; +
+
+ +
+
+ } *@
- +
diff --git a/WebWindowComplex/Compo/AreaSplit.razor.cs b/WebWindowComplex/Compo/AreaSplit.razor.cs index bc86baf..6a43079 100644 --- a/WebWindowComplex/Compo/AreaSplit.razor.cs +++ b/WebWindowComplex/Compo/AreaSplit.razor.cs @@ -26,6 +26,12 @@ namespace WebWindowComplex.Compo [Parameter] public List SplittedList { get; set; } = null!; + /// + /// Vocabolario con traduzione lingua corrente + /// + [Parameter] + public Dictionary Vocabulary { get; set; } = null!; + /// /// Evento per aggiungere Sash /// @@ -34,6 +40,23 @@ namespace WebWindowComplex.Compo #endregion Public Properties + #region Protected Methods + + protected override void OnParametersSet() + { + AreaSpDict = Vocabulary.Where(x => x.Key.Contains("CWAreaSp_")).ToDictionary(x => x.Key, y => y.Value); + } + + #endregion Protected Methods + + #region Private Fields + + private bool isOpen = false; + + private Dictionary AreaSpDict = new(); + + #endregion Private Fields + #region Private Methods /// @@ -70,6 +93,26 @@ namespace WebWindowComplex.Compo return EC_UpdateSplitted.InvokeAsync(CurrSplitted); } + /// + /// Metodo per traduzione in lingua corrente + /// + /// + /// + private string Traduci(string lemma) + { + string ans = lemma; + if (AreaSpDict != null && AreaSpDict.ContainsKey(lemma)) + { + ans = AreaSpDict.GetValueOrDefault(lemma) ?? ""; + } + return ans; + } + + private void ToggleDropdown() + { + isOpen = !isOpen; + } + #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/BottomRail.razor b/WebWindowComplex/Compo/BottomRail.razor index 4d649d6..3162c91 100644 --- a/WebWindowComplex/Compo/BottomRail.razor +++ b/WebWindowComplex/Compo/BottomRail.razor @@ -6,7 +6,7 @@ /// /// - protected async Task UpdateDimension(DataUpdateSplitDimension updRec) + private async Task UpdateDimension(DataUpdateSplitDimension updRec) { SplitDimension currSplitDim = updRec.currSplit; SplitDimension currRec = new SplitDimension(0, MeasureTypes.NULL, false, updRec.currSplit.Parent, false); @@ -289,27 +354,12 @@ namespace WebWindowComplex.Compo } } - //protected async Task UpdateSplit(DataUpdateSplit updRec) - //{ - // if (updRec.currSplit != null) - // { - // CurrSplit = updRec.currSplit; - // var args = new DataUpdateSplit() - // { - // currSplit = CurrSplit, - // noSvg = updRec.noSvg - // }; - // //await EC_ReqResetDict.InvokeAsync(new DataUpdateRes { req = DataAction.ResetDictShape }); - // await EC_UpdateSplit.InvokeAsync(args); - // } - //} - /// /// Metodo per cambiare la dimensione principale /// /// /// - protected async Task ChangeStartVert(ChangeEventArgs e) + private async Task ChangeStartVert(ChangeEventArgs e) { foreach (Split s in SplitList) { @@ -327,12 +377,11 @@ namespace WebWindowComplex.Compo await EC_ReqElement.InvokeAsync(CurrSplit); await EC_UpdateSplit.InvokeAsync(args); } - - /// + /// /// Metodo per determinare la descrizione del parent dello split corrente /// /// - protected string descParentSplit() + private string descParentSplit() { if ((CurrSplit.ParentArea is Splitted || CurrSplit.ParentArea is Sash) && SashGroupList.Count > 0) { @@ -340,7 +389,7 @@ namespace WebWindowComplex.Compo { if (SashGroupList[j].Equals(CurrSplit.ParentArea)) { - return "Sash " + (j + 1); + return @Traduci("CWSplit_Sash") + " " + (j + 1); } else if (SashGroupList[j].Equals(CurrSplit.ParentArea.ParentArea)) { @@ -348,7 +397,7 @@ namespace WebWindowComplex.Compo { if (SashGroupList[j].AreaList[k].AreaList[0].Equals(CurrSplit)) { - return "Sash group " + (j + 1) + " - sash " + (k + 1); + return @Traduci("CWSplit_SashGroup") + " " + (j + 1) + " - sash " + (k + 1); } } } @@ -369,107 +418,26 @@ namespace WebWindowComplex.Compo _ = EC_ReqClose.InvokeAsync(true); } - private bool isOpen = false; - private void ToggleDropdown() - { - isOpen = !isOpen; - } - - protected MeasureTypes MeasureType - { - get - { - MeasureTypes type = MeasureTypes.NULL; - if (CurrSplit.SplitVertList.Count > 0) - type = CurrSplit.SplitVertList.First().SelMeasureType; - else - type = CurrSplit.SplitHorizList.First().SelMeasureType; - for (int i = 1; i < CurrSplit.SplitVertList.Count; i++) - { - if (CurrSplit.SplitVertList.ElementAt(i).SelMeasureType != type) - return MeasureTypes.NULL; - } - for (int i = 1; i < CurrSplit.SplitHorizList.Count; i++) - { - if (CurrSplit.SplitHorizList.ElementAt(i).SelMeasureType != type) - return MeasureTypes.NULL; - } - return type; - } - set - { - foreach (var item in CurrSplit.SplitVertList) - { - item.SelMeasureTypeIndex = (int)value; - //item.SetSelMeasureType(value); - } - foreach (var item in CurrSplit.SplitHorizList) - { - item.SelMeasureTypeIndex = (int)value; - //item.SetSelMeasureType(value); - } - var args = new DataUpdateSplit() - { - currSplit = CurrSplit, - noSvg = true - }; - _ = EC_UpdateSplit.InvokeAsync(args); - } - } - /// - /// Metodo per cambiare il tipo di misura di tutti gli SplitDimension + /// Metodo per recuparare la lista degli split orizzontali /// - /// nuovo tipo /// - protected Task SetMeasureType(MeasureTypes type) - { - isOpen = !isOpen; - foreach (var item in CurrSplit.SplitVertList) - { - item.SelMeasureTypeIndex = (int)type; - //item.SetSelMeasureType(type); - } - foreach (var item in CurrSplit.SplitHorizList) - { - item.SelMeasureTypeIndex = (int)type; - //item.SetSelMeasureType(type); - } - var args = new DataUpdateSplit() - { - currSplit = CurrSplit, - noSvg = true - }; - return EC_UpdateSplit.InvokeAsync(args); - } - private List horizList() { int subAreaMin = CurrSplit.ElemDimHorizList.Min(x => x.nSubArea); return CurrSplit.ElemDimHorizList.Where(x => x.nSubArea == subAreaMin).ToList(); } + /// + /// Metodo per recuparare la lista degli split verticali + /// + /// private List vertList() { int subAreaMin = CurrSplit.ElemDimVertList.Min(x => x.nSubArea); return CurrSplit.ElemDimVertList.Where(x => x.nSubArea == subAreaMin).ToList(); } - private string MeasureTypeCss(MeasureTypes type) - { - for (int i = 0; i < CurrSplit.SplitVertList.Count; i++) - { - if (!CurrSplit.SplitVertList.ElementAt(i).MeasureType.Equals(type)) - return "btn btn-outline-secondary"; - } - for (int i = 0; i < CurrSplit.SplitHorizList.Count; i++) - { - if (!CurrSplit.SplitHorizList.ElementAt(i).MeasureType.Equals(type)) - return "btn btn-outline-secondary"; - } - return "btn btn-secondary"; - } - /// /// Metodo per la visualizzazione dei pulsanti shape /// @@ -482,6 +450,23 @@ namespace WebWindowComplex.Compo ans = "active"; return ans; } + + /// + /// Metodo per traduzione in lingua corrente + /// + /// + /// + private string Traduci(string lemma) + { + string ans = lemma; + if (SplitDict != null && SplitDict.ContainsKey(lemma)) + { + ans = SplitDict.GetValueOrDefault(lemma) ?? ""; + } + return ans; + } + + #endregion Private Methods } /// diff --git a/WebWindowComplex/Compo/EditElement.razor b/WebWindowComplex/Compo/EditElement.razor index 14d8dcc..b66c219 100644 --- a/WebWindowComplex/Compo/EditElement.razor +++ b/WebWindowComplex/Compo/EditElement.razor @@ -2,7 +2,7 @@
@* @(name()) *@ @if (BaseUser) { diff --git a/WebWindowComplex/Compo/EditElement.razor.cs b/WebWindowComplex/Compo/EditElement.razor.cs index e615080..e5b702b 100644 --- a/WebWindowComplex/Compo/EditElement.razor.cs +++ b/WebWindowComplex/Compo/EditElement.razor.cs @@ -13,6 +13,12 @@ namespace WebWindowComplex.Compo [Parameter] public ElementDimension CurrRec { get; set; } = null!; + /// + /// Vocabolario con traduzione lingua corrente + /// + [CascadingParameter(Name = "Vocabulary")] + public Dictionary Vocabulary { get; set; } = null!; + [Parameter] public EventCallback EC_Update { get; set; } @@ -28,8 +34,43 @@ namespace WebWindowComplex.Compo #endregion Public Properties + #region Protected Methods + + protected override void OnParametersSet() + { + ElementDict = Vocabulary.Where(x => x.Key.Contains("CWElem_")).ToDictionary(x => x.Key, y => y.Value); + } + + #endregion Protected Methods + + #region Private Fields + + private Dictionary ElementDict = new(); + + #endregion Private Fields + #region Private Properties + /// + /// Metodo per aggiornare element corrente + /// + private double updateVal + { + get => CurrRec.dDimension; + set + { + if (CurrRec.dDimension != value) + { + CurrRec.dDimension = value; + _ = EC_Update.InvokeAsync(CurrRec); + } + } + } + + #endregion Private Properties + + #region Private Methods + private string GetImageElementPath(string fileName) => $"_content/Egw.Lux.WebWindowComplex/icone/element/{fileName}.svg"; /// @@ -39,14 +80,14 @@ namespace WebWindowComplex.Compo { if (IsBottomRail) { - return CurrRec.nIndex.ToString(); + return CurrRec.nIndex.ToString(); } else { int nElement = 0; if (CurrRec.ParentArea is Frame frame) nElement = frame.ElementDimensionList.Count; - else if(CurrRec.ParentArea is Sash sash) + else if (CurrRec.ParentArea is Sash sash) nElement = sash.SashList.FirstOrDefault()!.ElementDimensionList.Count; switch (CurrRec.nIndex) { @@ -74,26 +115,29 @@ namespace WebWindowComplex.Compo } /// - /// Metodo per aggiornare element corrente + /// Metodo per determinare il titolo /// - private double updateVal - { - get => CurrRec.dDimension; - set - { - if (CurrRec.dDimension != value) - { - CurrRec.dDimension = value; - _ = EC_Update.InvokeAsync(CurrRec); - } - } - } - + /// private string Title() { return "Min: " + CurrRec.dMinDim + ", Max: " + CurrRec.dMaxDim; } - #endregion Private Properties + /// + /// Metodo per traduzione in lingua corrente + /// + /// + /// + private string Traduci(string lemma) + { + string ans = lemma; + if (ElementDict != null && ElementDict.ContainsKey(lemma)) + { + ans = ElementDict.GetValueOrDefault(lemma) ?? ""; + } + return ans; + } + + #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/EditSplitDimensions.razor b/WebWindowComplex/Compo/EditSplitDimensions.razor index e256a0e..ff561e6 100644 --- a/WebWindowComplex/Compo/EditSplitDimensions.razor +++ b/WebWindowComplex/Compo/EditSplitDimensions.razor @@ -4,7 +4,8 @@
@* @(Name + " " + (Index+ 1)) *@ - + + @(Index + 1) @if(BaseUser) { diff --git a/WebWindowComplex/Compo/EditSplitDimensions.razor.cs b/WebWindowComplex/Compo/EditSplitDimensions.razor.cs index e478496..5d4b33b 100644 --- a/WebWindowComplex/Compo/EditSplitDimensions.razor.cs +++ b/WebWindowComplex/Compo/EditSplitDimensions.razor.cs @@ -37,11 +37,32 @@ namespace WebWindowComplex.Compo [CascadingParameter(Name = "User")] public bool BaseUser { get; set; } = false!; + /// + /// Vocabolario con traduzione lingua corrente + /// + [CascadingParameter(Name = "Vocabulary")] + public Dictionary Vocabulary { get; set; } = null!; + [Parameter] public EventCallback EC_Update { get; set; } #endregion Public Properties + #region Protected Properties + + protected override void OnParametersSet() + { + SplitDict = Vocabulary.Where(x => x.Key.Contains("CWSplitDim_")).ToDictionary(x => x.Key, y => y.Value); + } + + #endregion Protected Properties + + #region Private Fields + + private Dictionary SplitDict = new(); + + #endregion Private Fields + #region Private Properties /// @@ -137,6 +158,10 @@ namespace WebWindowComplex.Compo return 0; } + /// + /// Metodo per path immagine delle dimensioni + /// + /// private string GetImageDimensionPath() { string nameFile = Name; @@ -155,6 +180,20 @@ namespace WebWindowComplex.Compo return $"_content/Egw.Lux.WebWindowComplex/icone/split/dimension/{nameFile}.svg"; } + /// + /// Metodo per traduzione in lingua corrente + /// + /// + /// + private string Traduci(string lemma) + { + string ans = lemma; + if (SplitDict != null && SplitDict.ContainsKey(lemma)) + { + ans = SplitDict.GetValueOrDefault(lemma) ?? ""; + } + return ans; + } } diff --git a/WebWindowComplex/Compo/EditSplitElement.razor b/WebWindowComplex/Compo/EditSplitElement.razor index e0da414..5d04513 100644 --- a/WebWindowComplex/Compo/EditSplitElement.razor +++ b/WebWindowComplex/Compo/EditSplitElement.razor @@ -1,7 +1,7 @@ @using static WebWindowComplex.LayoutConst
- + @CurrRec.nIndex @* @CurrRec.nIndex *@ diff --git a/WebWindowComplex/Compo/EditSplitElement.razor.cs b/WebWindowComplex/Compo/EditSplitElement.razor.cs index 0d728d0..30cbde2 100644 --- a/WebWindowComplex/Compo/EditSplitElement.razor.cs +++ b/WebWindowComplex/Compo/EditSplitElement.razor.cs @@ -19,7 +19,9 @@ namespace WebWindowComplex.Compo [Parameter] public string Type { get; set; } = null!; - + /// + /// Aggiornamento element + /// [Parameter] public EventCallback EC_Update { get; set; } @@ -29,13 +31,28 @@ namespace WebWindowComplex.Compo [CascadingParameter(Name = "User")] public bool BaseUser { get; set; } = false!; + /// + /// Vocabolario con traduzione lingua corrente + /// + [CascadingParameter(Name = "Vocabulary")] + public Dictionary Vocabulary { get; set; } = null!; + #endregion Public Properties - #region Private Properties + #region Protected Properties - private string GetImageElemPath() => $"_content/Egw.Lux.WebWindowComplex/icone/split/element/{Type}.svg"; + protected override void OnParametersSet() + { + SplitElemDict = Vocabulary.Where(x => x.Key.Contains("CWSplitElem_")).ToDictionary(x => x.Key, y => y.Value); + } - #endregion Private Properties + #endregion Protected Properties + + #region Private Fields + + private Dictionary SplitElemDict = new(); + + #endregion Private Fields #region Private Properties @@ -55,11 +72,37 @@ namespace WebWindowComplex.Compo } } + #endregion Private Properties + + #region Private Methods + + private string GetImageElemPath() => $"_content/Egw.Lux.WebWindowComplex/icone/split/element/{Type}.svg"; + private string Title() { return "Min: " + CurrRec.dMinDim + ", Max: " + CurrRec.dMaxDim; } - #endregion Private Properties + /// + /// Metodo per traduzione in lingua corrente + /// + /// + /// + private string Traduci(string lemma) + { + string ans = ""; + string totalLemma = "CWSplitElem_Height"; + if (lemma.Equals("Vertical")) + { + totalLemma = "CWSplitElem_Width"; + } + if (SplitElemDict != null && SplitElemDict.ContainsKey(totalLemma)) + { + ans = SplitElemDict.GetValueOrDefault(totalLemma) ?? ""; + } + return ans; + } + + #endregion Private Methods } } \ No newline at end of file diff --git a/WebWindowComplex/Compo/General.razor b/WebWindowComplex/Compo/General.razor index 0dfa4e1..4c25e15 100644 --- a/WebWindowComplex/Compo/General.razor +++ b/WebWindowComplex/Compo/General.razor @@ -3,7 +3,7 @@
-
General
+
@Traduci("CWGeneral_General")
@@ -16,12 +16,12 @@
@if (BaseUser) { - Wood + @Traduci("CWGeneral_Wood") } else { - + } else { - + } else { - + } else { - +