diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 4742c2e..c510d92 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -322,24 +322,19 @@ namespace Test.UI.Components.Pages } - private void Traduzione(List args) + private async Task Traduzione(List 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>(jsonText) ?? new(); + } } } diff --git a/Test.UI/Traduzioni/Traduzione.json b/Test.UI/Traduzioni/Traduzione.json new file mode 100644 index 0000000..ff0016d --- /dev/null +++ b/Test.UI/Traduzioni/Traduzione.json @@ -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" +} \ No newline at end of file diff --git a/WebWindowComplex/Compo/AreaFrame.razor.cs b/WebWindowComplex/Compo/AreaFrame.razor.cs index 85db4ab..9f6d701 100644 --- a/WebWindowComplex/Compo/AreaFrame.razor.cs +++ b/WebWindowComplex/Compo/AreaFrame.razor.cs @@ -52,7 +52,7 @@ namespace WebWindowComplex.Compo protected override async Task OnInitializedAsync() { - Dictionary 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 tradList = new List() { "CWAreaF_AreaFrame", "CWAreaF_AggSash", "CWAreaF_AggSplit", "CWAreaF_AggInglesina"}; @@ -62,6 +62,8 @@ namespace WebWindowComplex.Compo #endregion Protected Properties + private Dictionary AreaFDict = new(); + #region Private Methods /// @@ -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; } diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index a8f4029..eb10b68 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -10,7 +10,7 @@
- +
@Traduci("CWTableC_MissingParam")
@@ -23,7 +23,7 @@
- +
@Traduci("CWTableC_MissingJWD")
@@ -93,9 +93,9 @@
- - - + + +
diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 9515297..76ec5a8 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -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 tradList = new List() { "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); - //} } /// @@ -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 tradList = new List() { "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 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; } diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index bed1888..9a89d91 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.8.1413 + 3.1.8.1414 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -218,6 +218,17 @@ + + + + + + + + + + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 0beb9aa..ad29d1a 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.8.1413 + 3.1.8.1414 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -533,6 +533,16 @@ + + + + + + + + + +