Skip to content

Commit

Permalink
Pull language fix into dev branch (#34)
Browse files Browse the repository at this point in the history
* Fix Typo (#32)

Dictionary was spelled Dicrionary.

* Fix: Check Language Retuned by Umbraco is the one we asked for.

* v8.1.1 release files (real 8.1.1 this time)
  • Loading branch information
KevinJump authored Jul 19, 2019
1 parent e34a925 commit 1f7fe8a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
Binary file added Dist/8.1.1/uSync.ContentEdition_8.1.1.zip
Binary file not shown.
Binary file added Dist/8.1.1/uSync_8.1.1.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion Dist/package.ContentEdition.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<readme>
<![CDATA[
<p>
Adds Content/Media/Dicrionary Items/and Domains to uSync Process
Adds Content/Media/Dictionary Items/and Domains to uSync Process
</p>]]>
</readme>
</info>
Expand Down
14 changes: 12 additions & 2 deletions uSync8.Core/Serialization/Serializers/LanguageSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,18 @@ protected override SyncAttempt<XElement> SerializeCore(ILanguage item)
public override bool IsValid(XElement node)
=> (base.IsValid(node) && node.Element("CultureName") != null && node.Element("IsoCode") != null);

protected override ILanguage FindItem(string alias) =>
localizationService.GetLanguageByIsoCode(alias);
protected override ILanguage FindItem(string alias)
{
// GetLanguageByIsoCode - doesn't only return the language of the code you specify
// it will fallback to the primary one (e.g en-US might return en),
//
// based on that we need to check that the language we get back actually has the
// code we asked for from the api.
var item = localizationService.GetLanguageByIsoCode(alias);
if (item == null || !item.CultureInfo.Name.InvariantEquals(alias)) return null;
return item;
}


protected override ILanguage FindItem(Guid key) => default(ILanguage);

Expand Down

0 comments on commit 1f7fe8a

Please sign in to comment.