Localizing DisplayName and Description for when multiple content types share the same name.


I have a multisite solution where some block types are shared between sites but each site has it's own page types. Some page types are named the same but are located in different namespaces, for example I have a ProductPageType for each site. I would like both those types to share the same translations but since EPiServer names the second type ProductPageType(1) it can no longer fetch neither property localisations nor DisplayName and Description from my xml resource files but instead gives me the [Missing text '/contenttypes/ProductPageType(1)/description' for 'English'] error.

I thought that I could solve this by registering a UIDescriptor and setting the LanguageKey property. Both page types implements an interface IProductContent and my descriptor looks like this.

public class ProductContentTypeUIDescriptor : UIDescriptor<IProductContent>
	public ProductContentTypeUIDescriptor() : base()
		LanguageKey = "ProductPageType";

This makes the translations for the page type properties work for both page types, but the DisplayName and Description is still missing for the type registered as ProductPageType(1). I have also tried registering a descriptor for the failing page type only but this does not work for either DisplayName or properties. 

Why does EPiServer ignore the LanguageKey when fetching the DisplayName? Is there some way to solve this issue using localization or is hard coding the DisplayName in the ContentType attribute the only possible solution?

Mar 05, 2020 13:45

We had the same issue and were unable to solve it in an elegant fashion, so we prefixed the PageType-names with the site name. IE. "ThisSiteProductPage" and "ThatSiteProductPage". Then you can set the DisplayName and Description for each one seperately and use the IProductContent translations for the rest. 

I don't know why it's like that, but it could be that Episerver expects these two properties to be unique per content type?

Mar 06, 2020 20:02
* 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.