From 8a214b5181de2d481628ed439cc167c43d941c2a Mon Sep 17 00:00:00 2001 From: Tom Pipe Date: Thu, 20 Nov 2014 15:19:58 +0000 Subject: [PATCH] Correctly translate property label and description on ALL Tabs Fixes U4-4731 --- .../Mapping/TabsAndPropertiesResolver.cs | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs index 41153be8b8..74dbf4d406 100644 --- a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs @@ -167,14 +167,9 @@ namespace Umbraco.Web.Models.Mapping Mapper.Map, IEnumerable>( propsForGroup)); } - - // Not sure whether it's a good idea to add this to the ContentPropertyDisplay mapper - foreach (var prop in aggregateProperties) - { - prop.Label = TranslateItem(prop.Label); - prop.Description = TranslateItem(prop.Description); - } + TranslateProperties(aggregateProperties); + //then we'll just use the root group's data to make the composite tab var rootGroup = propertyGroups.Single(x => x.ParentId == null); aggregateTabs.Add(new Tab @@ -192,21 +187,33 @@ namespace Umbraco.Web.Models.Mapping .Where(x => IgnoreProperties.Contains(x.Alias) == false); //don't include ignored props //now add the generic properties tab + var genericproperties = Mapper.Map, IEnumerable>(orphanProperties).ToList(); + TranslateProperties(genericproperties); + aggregateTabs.Add(new Tab { Id = 0, Label = ui.Text("general", "properties"), Alias = "Generic properties", - Properties = Mapper.Map, IEnumerable>(orphanProperties) + Properties = genericproperties }); - //set the first tab to active aggregateTabs.First().IsActive = true; return aggregateTabs; } + private void TranslateProperties(IEnumerable properties) + { + // Not sure whether it's a good idea to add this to the ContentPropertyDisplay mapper + foreach (var prop in properties) + { + prop.Label = TranslateItem(prop.Label); + prop.Description = TranslateItem(prop.Description); + } + } + // TODO: This should really be centralized and used anywhere globalization applies. internal string TranslateItem(string text) {