Referencing Sitefinity label from within a Widget Template

Posted by Community Admin on 04-Aug-2018 12:04

Referencing Sitefinity label from within a Widget Template

All Replies

Posted by Community Admin on 18-Feb-2015 00:00

HI

I have a normal widget template, but since this is multilingual, I would like to have a Click Here link in different languages.

 I am trying to call the label like this:

<asp:Literal ID="Literal3" Text='<%$ Resources:Labels,InThePress-ClickHere%>' runat="server" />

but no luck.

The link shows an error saying: #ResourceNotFound#:Labels:InThePress-ClickHere

Any help please?

thank you

Ian

Posted by Community Admin on 19-Feb-2015 00:00

Hi Ian,

 

is the label defined in all languages? All labels can be found under Administration/Labels & Messages. Just search for "InThePress-ClickHere". You should find your label.

If so, please check wether your ResourceFiles are available in folder ~/App_Data/Sitefinity/GlobalResources.

Best regards,

Eric

_______________________________
netmedia - the Social Workplace Experts
http://www.netmedia.de
twitter.com/netmedianer

www.facebook.com/netmedianer

Posted by Community Admin on 19-Feb-2015 00:00

Hi Eric

Yes all of them are there.

Is it maybe becuase I am missing something related to the Type. in the labels section it says (This is the "class-id" value used in the code)?

 

Remember that currently I am trying to call a sitefinity label like this:

<asp:Literal ID="Literal3" Text='<%$ Resources:Labels,InThePress-ClickHere%>' runat="server" />

Posted by Community Admin on 19-Feb-2015 00:00

Is your Label contained in the Label-Type-Section Labels or in a other one? You can see it by editing your label. On the right side there is Type. e.g. When you are editing a label for blogs, the type is 'BlogResources'. Then your code should look like

<asp:Literal ID="Literal3" Text='<%$ Resources:BlogResources,InThePress-ClickHere%>' runat="server" />

Or the '-' sign isn't allowed in a key name. All other label keys aren't using the '-' sign. Try to use a underscore '_'.

Hope that helps.

Best regards

Eric

Posted by Community Admin on 23-Feb-2015 00:00

Hello,

We have resolved the issue in the Ian support ticket. You can find information about the labels usage bellow, since it might be useful for others interested in this thread:
In order to use the labels, you should specify the type of the resource and the key of the resource of that type. For instance:

Copy Code
Text="<%$Resources:PublicControlsResources,LogOutText %>"
The Log out text label is registered under the PublicControlsResources type (the resource class) and has a key LogOutText.Note that after adding the label, you should restart the application whether the resource you are editing is not alredy edited - there is already a resource file (.resx) in the App_Data -> Sitefinity -> Global Resources. The resources are also being cached, so an immediate change to take effect, a restart is required, as well.
You are free to share further information with the community.

Regards,
Nikola Zagorchev
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed