Override display name for Category on page data

Vote:
 

hi Guys, 

For one of my project, I want to use the default multiple category picker from EPiServer for my tags. However, in order to attempt to override the display name of the property, I have tried the following :

 [EditorDescriptorRegistration(TargetType = typeof(CategoryList))]
    public class HideCategoryEditorDescriptor : EditorDescriptor
    {
        public override void ModifyMetadata(
           ExtendedMetadata metadata,
           IEnumerable attributes)
        {
            base.ModifyMetadata(metadata, attributes);

            var contentMetadata = (ContentDataMetadata)metadata;
            var ownerContent = contentMetadata.OwnerContent;
            if (ownerContent is NewsDetailPage
                && metadata.PropertyName == "icategorizable_category")
            {
                metadata.DisplayName="Tags";
                //metadata.ShortDisplayName = "Tags";
                //metadata.GroupName = SystemTabNames.Settings;
                //metadata.GroupSettings.Name = "Tags";


            }
        }
    }

This doesn't change the name, but works when I change the tab of the property. 

I also tried override the property, and added property name to the language file but no luck.

Have anyone tried this before, do you know any other way to work around this ?

Thanks very much.

#88954
Aug 05, 2014 6:21
Vote:
 

Have you found any solutions?

#113757
Nov 27, 2014 12:43
Vote:
 

I guess you can change the name by translating it instead.

<contenttypes>
     <icontentdata>
          <properties>
               <PageCategory>
                    <caption>Tags</caption>
               </PageCategory>
          <properties>
     <icontentdata>
<contenttypes>

Haven't tried this though.

#113768
Nov 27, 2014 14:22
Vote:
 

Well, i don't want to change it's name in whole application.

I want to override it in my application but it doesn't seem to work.

(Ex: i have my blogs in two languages and i have my categories in English foe en-GB. but i want to change categories in same page with chinese language and

Episerver7.5 doesn't allow me to update category in other language.)

Any solution to update category in different laguages?

Thanks.

#113773
Nov 27, 2014 14:59
Vote:
 

Ok, the first post is about changing the display name of the property. If I'm understanding you correctly, you want to translate individual categories? If so:

<languages>
	<language name="German" id="de">
		<categories>
			<category name="CategoryName">
				<description>Description in German</description>
			</category>
		<categories>
	</language>
</languages>
#113775
Nov 27, 2014 15:05
Vote:
 

I have the same issue.
I just want to change when creating a special block

Any suggestions?

dynamic contentMetadata = metadata;
var ownerContent = contentMetadata.OwnerContent as IContent;
var ownerType = ownerContent.GetType().BaseType;

if (ownerType != null && ownerType.Name == "SpecialBlock")
{
var categoryService = ServiceLocator.Current.GetInstance<ICategoryService>();
var category = categoryService.GetCategoryStartNode(Categories.Industry);
if (category != null)
EditorConfiguration["root"] = category.ID;

base.ModifyMetadata(metadata, attributes);
if (metadata.PropertyName == "icategorizable_category")
{
metadata.DisplayName = "MyOwnName";
metadata.ShortDisplayName = "MyOwnName";
}
}

#116387
Jan 29, 2015 13:37
* 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.