Skip to content

Commit

Permalink
fix #642 - Add Content culture as avalible cultures no longer returns…
Browse files Browse the repository at this point in the history
… all cultures.
  • Loading branch information
KevinJump committed May 24, 2024
1 parent d152806 commit 0a5c784
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion uSync.Core/Serialization/Serializers/ContentSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,11 @@ protected override SyncAttempt<IContent> DeserializeCore(XElement node, SyncSeri
details.AddNotNull(HandleTrashedState(item, trashed, restoreParent));
}

details.AddNotNull(DeserializeTemplate(item, node));
// cultures...



details.AddNotNull(DeserializeTemplate(item, node));

var propertiesAttempt = DeserializeProperties(item, node, options);
if (!propertiesAttempt.Success)
Expand Down
10 changes: 7 additions & 3 deletions uSync.Core/Serialization/Serializers/ContentSerializerBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -460,11 +460,15 @@ protected IEnumerable<uSyncChange> DeserializeName(TObject item, XElement node,

if (activeCultures.IsValid(culture))
{
// v14: if the culture is missing we need to add it
if (item.CultureInfos?.TryGetValue(culture, out var cultureInfo) is false)
{
item.CultureInfos.Add(new ContentCultureInfos(culture));
}

var cultureName = cultureNode.ValueOrDefault(string.Empty);
var currentCultureName = item.GetCultureName(culture);
var cultureName = cultureNode.ValueOrDefault(string.Empty);
var currentCultureName = item.GetCultureName(culture) ?? "";
if (string.IsNullOrEmpty(cultureName) is false
&& string.IsNullOrEmpty(currentCultureName) is false
&& cultureName != currentCultureName)
{
changes.AddUpdate($"Name ({culture})", currentCultureName, cultureName);
Expand Down

0 comments on commit 0a5c784

Please sign in to comment.