You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
related to #7386 and #7352.
As discussed with @sebastienros, I am opening an issue about the methods from ILocalizationService.
Method: GetLocalizedContentItem(IContent content, string culture, VersionOptions versionOptions)
(versionOptions is optional because there is a version of the method without that parameter) Expected behaviour: Call a "LocalizationSet" the set of all contents that are localizations one of the other. I would expect this method to return the item from content's LocalizationSet whose Culture property matches the one given in the string culture. Actual behaviour: That only happens if content is the MasterContentItem for its set. If that's not the case the method returns:
null if content's Culture does not match culture.
content otherwise.
This is all down to the query used in this method:
return _contentManager
.Query<LocalizationPart>(versionOptions, content.ContentItem.ContentType)
.Where<LocalizationPartRecord>(l =>
(l.Id == content.ContentItem.Id || l.MasterContentItemId == content.ContentItem.Id) // <-- I THINK THE ISSUE IS HERE
&& l.CultureId == cultureRecord.Id)
.Slice(1)
.FirstOrDefault();
As things are now (with #7386), given var localized = content.As<LocalizationPart>();, I would change the line I marked above to something like:
I think that change would allow to at least look into the set of items that share content's MasterContentItem.
Method: GetContentCulture(IContent content) Actual behaviour: This method returns content's culture if content has a LocalizationPart. It returns the Site's culture otherwise (which is debatable).
Method: SetContentCulture(IContent content, string culture) Actual behaviour: This method is fine. If content has a LocalizationPart, it will wet its culture.
Method: GetLocalizations(IContent content, VersionOptions versionOptions)
(versionOptions is optional because there is a version of the method without that parameter) Expected behaviour: I would expect this method to return what we called "LocalizationSet" above. Actual behaviour: This mostly works as expected. However, because of #7386, LocalizationSets are fragmented whenever some localizations are not created directly starting from a common MasterContentItem.
The text was updated successfully, but these errors were encountered:
related to #7386 and #7352.
As discussed with @sebastienros, I am opening an issue about the methods from ILocalizationService.
Method:
GetLocalizedContentItem(IContent content, string culture, VersionOptions versionOptions)
(
versionOptions
is optional because there is a version of the method without that parameter)Expected behaviour: Call a "LocalizationSet" the set of all contents that are localizations one of the other. I would expect this method to return the item from
content
's LocalizationSet whose Culture property matches the one given in the stringculture
.Actual behaviour: That only happens if
content
is the MasterContentItem for its set. If that's not the case the method returns:null
ifcontent
's Culture does not matchculture
.content
otherwise.This is all down to the query used in this method:
As things are now (with #7386), given
var localized = content.As<LocalizationPart>();
, I would change the line I marked above to something like:I think that change would allow to at least look into the set of items that share
content
's MasterContentItem.Method:
GetContentCulture(IContent content)
Actual behaviour: This method returns
content
's culture ifcontent
has aLocalizationPart
. It returns the Site's culture otherwise (which is debatable).Method:
SetContentCulture(IContent content, string culture)
Actual behaviour: This method is fine. If
content
has aLocalizationPart
, it will wet its culture.Method:
GetLocalizations(IContent content, VersionOptions versionOptions)
(
versionOptions
is optional because there is a version of the method without that parameter)Expected behaviour: I would expect this method to return what we called "LocalizationSet" above.
Actual behaviour: This mostly works as expected. However, because of #7386, LocalizationSets are fragmented whenever some localizations are not created directly starting from a common MasterContentItem.
The text was updated successfully, but these errors were encountered: