Is it possible to translate the names or descriptions of categories? I've found a blog post on how to do it in EPi 6 by putting the translations in a language file but I can't get the same thing to work in EPiServer 7. Is there a new better way to work with categories and globalization?
Dit you use this format?
<?xml version="1.0" encoding="utf-8" standalone="yes"?><languages> <language name="dutch" id="nl"> <categories> <category name="CategoryName"> <description>CategoryName translated</description> </category> </categories> </language></languages>
To do some shameless self promotion: You could also install a NuGet package I created, that allows you to create your translations within the content tree, also for categories.
Hope this helps.
Yes, that was the xml I tried earlier and I still can't get it to work.
In view mode I use the code below but it only lists the names of the categories.
And when I edit the page in forms mode the category descriptions are used but they are not translated.
I have translations of page types and properties so I know the language file works.
The property for displaying translated categories is LocalizedDescription, so maybe it should be: m.Category.LocalizedDescription ?
PagaData.Category don't seem to have LocalizedDescription. And view mode isn't really the problem because there I can translate them myself. I was hoping I would be able to translate them in edit mode as well, but maybe that's not possible?
Ah, must have been sleeping. PageData.Category is CategoryList, so it contains the categories, if any are selected. The LocalizedDescription is a property of a category not of the CategoryList (a.k.a. Category)
Thank you for all the help, I can get the translated descriptions from the language file by doing something like this:
But the translations are still not shown in edit mode though.
No prob. I think to show them in EditMode, you will need to switch the UI language.
Both the language file and the UI culture are "en". And property names are translated correctly in edit mode. I'm starting to think that this is a bug in episerver.
Could it be this bug?
No, i don't think that is the same bug. My site language is english.
I have started working on Localizing the EPiServer Categories, and Category.Find(x).LocalizedDescription works like a charm. Thank you for the suggestion. However while displaying the category description on an Html page , I had to do HttpUtility.HtmlDecode(Category.Find(@tag.Key).LocalizedDescription) as it was displaying & as &