Skip to content

Commit

Permalink
Merge branch 'v13/contrib' of https://github.com/umbraco/Umbraco-CMS
Browse files Browse the repository at this point in the history
…into v13/contrib
  • Loading branch information
nul800sebastiaan committed Sep 17, 2024
2 parents 9300d86 + d64bf5d commit ff9903b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/Umbraco.Core/EmbeddedResources/Lang/sv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
<name>The Umbraco community</name>
<link>https://docs.umbraco.com/umbraco-cms/extending/language-files</link>
</creator>
<area alias="apps">
<key alias="umbContent">Innehåll</key>
</area>
<area alias="actions">
<key alias="assigndomain">Hantera domännamn</key>
<key alias="auditTrail">Hantera versioner</key>
Expand Down
25 changes: 17 additions & 8 deletions src/Umbraco.Core/Services/LocalizedTextService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,13 @@ private IDictionary<string, IDictionary<string, string>> GetAreaStoredTranslatio
IEnumerable<XElement> areas = xmlSource[cult].Value.XPathSelectElements("//area");
foreach (XElement area in areas)
{
var result = new Dictionary<string, string>(StringComparer.InvariantCulture);
var areaAlias = area.Attribute("alias")!.Value;

if (!overallResult.TryGetValue(areaAlias, out IDictionary<string, string>? result))
{
result = new Dictionary<string, string>(StringComparer.InvariantCulture);
}

IEnumerable<XElement> keys = area.XPathSelectElements("./key");
foreach (XElement key in keys)
{
Expand All @@ -364,7 +370,10 @@ private IDictionary<string, IDictionary<string, string>> GetAreaStoredTranslatio
}
}

overallResult.Add(area.Attribute("alias")!.Value, result);
if (!overallResult.ContainsKey(areaAlias))
{
overallResult.Add(areaAlias, result);
}
}

// Merge English Dictionary
Expand All @@ -374,11 +383,11 @@ private IDictionary<string, IDictionary<string, string>> GetAreaStoredTranslatio
IEnumerable<XElement> enUS = xmlSource[englishCulture].Value.XPathSelectElements("//area");
foreach (XElement area in enUS)
{
IDictionary<string, string>
result = new Dictionary<string, string>(StringComparer.InvariantCulture);
if (overallResult.ContainsKey(area.Attribute("alias")!.Value))
var areaAlias = area.Attribute("alias")!.Value;

if (!overallResult.TryGetValue(areaAlias, out IDictionary<string, string>? result))
{
result = overallResult[area.Attribute("alias")!.Value];
result = new Dictionary<string, string>(StringComparer.InvariantCulture);
}

IEnumerable<XElement> keys = area.XPathSelectElements("./key");
Expand All @@ -394,9 +403,9 @@ private IDictionary<string, IDictionary<string, string>> GetAreaStoredTranslatio
}
}

if (!overallResult.ContainsKey(area.Attribute("alias")!.Value))
if (!overallResult.ContainsKey(areaAlias))
{
overallResult.Add(area.Attribute("alias")!.Value, result);
overallResult.Add(areaAlias, result);
}
}
}
Expand Down

0 comments on commit ff9903b

Please sign in to comment.