Localization in user controls
Hello,
My website is multilingual. To display my specific content, I used user controls. In these user controls, I have some labels that need to be translated. How can I achieve this? Can I use asp.net resources file or does Sitefinity provide a way to do this?
Thanks
Jocelyn
Hello,
Can someone bring me an answer?
Jocelyn
Hello jocelyn,
You can use ASP.NET Local resources. You can create a custom resource class. You can take a look at this post.For properties,if you want to have them in multilingual mode you have to mark the property with MultilingualProperty attribute (Telerik.Sitefinity.Modules.Pages.PropertyPersisters.MultilingualPropertyAttribute).
Note that this should be a string property.
You can use Administration >> Interfaces and Labels to add a new key which you can access in your control as shown below
var res = Res.Get("Labels", "MyKey");
We recommend creating a separate classes for your custom keys and not mix them with the default one. Thus, you can separate the built-in and custom logic easily and this will ensure that there would not be a problem if you import or export a language pack.
All the best,
Ivan Dimitrov
the Telerik team
Hello Ivan,
Thanks for your reply. Where can I create my custom resources class and register it in sitefinity?
Jocelyn
Hi Julien,
You can take a look at this post that explains how to do this.
Greetings,
Ivan Dimitrov
the Telerik team
Hello,
I create my resources class and register it.
When i go to "Administration" > "Interface and labels", I see my Resources class but when I click it to filter the labels, I still see all labels. My resources class name in "Filter by type" side bar appears in grey.
Thanks for your help!
Jocelyn
Hi Julien,
This is a bug related to the custom localization resources. It has been logged with ID 390410 and it is related to bug 100991 added in the initial post. The current status of bug 100991 is not done.
Kind regards,
Ivan Dimitrov
the Telerik team
Hello Ivan,
When this bug will be treated? However, I think this bug does not block us to use the back end to translate my labels of my custom resources class. Is is true?
Regards,
Hi Julien,
This bug is scheduled for fixing for the Q1 release in the begining of April.
It doesn't block you to use the back end to translate your labels of your custom resources class.
All the best,
Kalina
the Telerik team