diff --git a/uSync8.ContentEdition/Handlers/DictionaryHandler.cs b/uSync8.ContentEdition/Handlers/DictionaryHandler.cs index 972a131d..a483cd89 100644 --- a/uSync8.ContentEdition/Handlers/DictionaryHandler.cs +++ b/uSync8.ContentEdition/Handlers/DictionaryHandler.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Xml.Linq; @@ -168,7 +169,22 @@ protected override string GetItemName(IDictionaryItem item) => item.ItemKey; protected override string GetItemPath(IDictionaryItem item, bool useGuid, bool isFlat) - => item.ItemKey.ToSafeFileName(); + { + if (isFlat) return item.ItemKey.ToSafeFileName(); + return GetDictionaryPath(item); + } + + private string GetDictionaryPath(IDictionaryItem item) + { + if (item.ParentId.HasValue) + { + var parent = localizationService.GetDictionaryItemById(item.ParentId.Value); + if (parent != null) + return item.ItemKey.ToSafeFileName() + Path.DirectorySeparatorChar + GetDictionaryPath(parent); + } + + return item.ItemKey.ToSafeFileName(); + } protected override void InitializeEvents(HandlerSettings settings) {