Referencing Sitefinity label from within a Widget Template
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
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
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" />
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
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:
Text="<%$Resources:PublicControlsResources,LogOutText %>"
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.