Reputation: 936
As the title suggests I am trying to resolve a localisation string inside a repeater. I have a wysiwyg editor to input some html on the form tab of the document type, so the source would look like this
Field1: "<a href="test.aspx" title="test">{$localstring$}</a>"
Then in the transformation I have
<li><%# Eval("Field1") %></li>
This outputs the string as
and doesn't resolve this as a macro and go lookup the localstring in the UI culture localisation.
I have tried different things including
<%# Eval(CMS.GlobalHelper.ResHelper.LocalizeString("Field1")) %>
and
<%# Eval(CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("Field1")) %>
all of which give the same output, can anyone point me in the right direction? I am sure it's the way Eval is being called.
Thanks in advance.
Upvotes: 0
Views: 2336
Reputation: 56
The correct syntax is following:
<%# CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros(Eval("Field1").ToString()) %>
Upvotes: 1
Reputation: 11227
in case somebody else searches for this: if you want to use localization string custom.my-string
in ASPX transformation, you should resolve it as follows:
<%# CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{$custom.my-string$}") %>
note: no spaces! if you add spaces like this: "{$ custom.my-string $}" - it WILL NOT work.
Upvotes: 2