Document Language Handling

Vote:
 

I uploaded a file to the site with English as a master languange. Then I created languange branches for the file.

When I have Englsih(master) language branch active, I can download the file. But when I have any other language branch active I can't download or preview the file by link.

Any ideas why that is happening?

#292025
Edited, Nov 21, 2022 14:43
Vote:
 

I didn't think media and assets were Globalizable, can you demonstrate how you made your file translatable 

 

#292066
Nov 21, 2022 23:37
Vote:
 

I have a custom doc type for my pdf files with ILocalizable interface implemented

 [ContentType(
        DisplayName = "PDF File", GUID = "C2C5C8F2-AB98-43D6-BDCA-679B3E712EFE",
        Description = "PDF file")]
[MediaDescriptor(ExtensionString = "pdf")]
public class DocumentFile : MediaData, ILocalizable
{
/* implementation */
}

so pdf files are handled with this type and has Language property

#292067
Nov 22, 2022 7:23
Vote:
 

Theirs some additional logic you will need to add alongside implementing ILocalizable 

Please see here : Localizable media assets - Grzegorz Wiecheć (gregwiechec.com) 

Hopefully the same concepts work for CMS12 

#292074
Nov 22, 2022 15:58
klappo - Nov 23, 2022 10:46
thanks a lot, the article helped a lot
Vote:
 

for any other viewer: custom localizable document type must also redirect master languange content data to other languange invariants of the content 

the code from the article:

public override Blob BinaryData
{
  get
  {
    if (ContentReference.IsNullOrEmpty(this.ContentLink))
    {
        return base.BinaryData;
    }
    if (this.Language.Name == this.MasterLanguage.Name)
    {
        return base.BinaryData;
    }
 
    var contentRepository = ServiceLocator.Current.GetInstance();
    var content = contentRepository.Get(this.ContentLink.ToReferenceWithoutVersion(), new LanguageSelector(this.MasterLanguage.Name));
    return content.BinaryData;
  }
  set
  {
    base.BinaryData = value;
  }
}

 the same approach works for Thumbnail property

#292122
Edited, Nov 23, 2022 10:47
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.