Skip to content

Commit

Permalink
From v13: Fix #609 Default language importing. (#614)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinJump committed Apr 17, 2024
1 parent 7315f61 commit e51f286
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions uSync.BackOffice/SyncHandlers/Handlers/LanguageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,21 @@ protected override string GetPath(string folder, ILanguage item, bool GuidNames,
protected override string GetItemPath(ILanguage item, bool useGuid, bool isFlat)
=> item.IsoCode.ToSafeFileName(shortStringHelper);


/// <summary>
/// ensure we import the 'default' language first, so we don't get errors doing it.
/// </summary>
protected override IEnumerable<string> GetImportFiles(string folder)
/// <summary>
/// order the merged items, making sure the default language is first.
/// </summary>
protected override IReadOnlyList<OrderedNodeInfo> GetMergedItems(string[] folders)
=> base.GetMergedItems(folders)
.OrderBy(x => x.Node.Element("IsDefault").ValueOrDefault(false) ? 0 : 1)
.ToList();

/// <summary>
/// ensure we import the 'default' language first, so we don't get errors doing it.
/// </summary>
/// <remarks>
/// prost v13.1 this method isn't used to determain the order for all options.
/// </remarks>
protected override IEnumerable<string> GetImportFiles(string folder)
{
var files = base.GetImportFiles(folder);

Expand Down

0 comments on commit e51f286

Please sign in to comment.