Try our conversational search powered by Generative AI!

Translate interface for IList<ContentReference> AllowedTypes

Vote:
 

Hello, is it possible to translate/change the name displayed when using the AllowedTypes with an interface?
It works for pages, but when using an interface it will print the interface namespace, can I change that?

#148145
May 04, 2016 16:51
Vote:
 

Hi,

It is simple to support pretty names and localized values as part of Episervers 'Allowed Types'. Be aware that below change will apply to all properties where Episerver internally uses the epi-cms/contentediting/AllowedTypesList - e.g. the ContentReferenceListEditor you are showing above.

First of all, you have to register a UIDescriptor for your interface.

[UIDescriptorRegistration]
public class ContentDetailPageDescriptor : IDescriptor<IContentDetailPage> { }


Next step is to add the localized name to a resource file available to the Localization System in Episerver.

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<languages>
  <language name="English" id="en">
    <contenttypes>
      <icontentdetailpage>
          <name>Content Detail Pages</name>
      </icontentdetailpage>
    </contenttypes>
  </language>
</languages>

Remember to adjust the language name and id to match your Swedish locale.

End result speaks for it self.

Hope it helped.

Casper Aagaard Rasmussen

#148254
Edited, May 07, 2016 15:18
Vote:
 

Nice, thank you. However, when I create a PageDescriptor that inherits from UIDescriptor<IContainable> I get an error when clikcing on the Browse button. Drag and drop works though.
Internal server error Method EPiServer.Core.DefaultContentRepository.GetChildren: type argument 'SthlmStad.AreaWebs.Lib.EPi.Containables.IContainable' violates the constraint of type parameter 'T'.
We are using version 9.0.3 of CMS and 9.2.0 of UI...

#148287
May 09, 2016 13:21
Vote:
 

Hi,

Your interface has to inherit from IContent. That is required due to Episerver's constaints in e.g. the ContentRepository interface.

Hope that helped you with the last detail.

Casper Aagaard Rasmussen

#148290
May 09, 2016 13:48
Vote:
 

aaah now it works, thanks man! Where did you find this information btw? It feels like I've looked everywhere... :)

#148294
May 09, 2016 15:07
Vote:
 

Hi.

Good news! :-)

I am not sure if its documented anywhere. I've been decompiling the Episerver libraries and widgets a lot through the years, which is where I have the information from.

Casper Aagaard Rasmussen 

#148295
May 09, 2016 15:13
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.