Reputation: 1256
I felt it was easier to start a new thread here. In a previous thread (initial post) I was looking at dynamically adding a the open and close table tags in a repeater. As i'm working through the build in French, i'm struggling with using resource strings. Here's the code snippet:
<%# IsFirst() ? "<table class='sortable col-3'><thead><tr><th class=''>Date</th><th class='sorter-false'>Subject</th><th class='sorter-false'>From</th></tr></thead><tbody>" : "" %>
I want to replace the string 'Subject' with a resource key. I've tried a macro approach, and concatenation of the c#, but i'm stuck.
Upvotes: 1
Views: 933
Reputation: 756
<%# Localize("kff.CEODirect-FormLabel--Subject") %>
I believe that will work, assuming that is your resource string key.
Upvotes: 0
Reputation: 1256
I rewrote the if statement to this. So far so good.
<%
if (IsFirst()){
%>
<table class="sortable col-3">
<thead>
<tr>
<th class="">Date</th>
<th class='sorter-false'><%# CMS.Helpers.ResHelper.GetString("kff.CEODirect-FormLabel--Subject") %></th>
<th class='sorter-false'>From</th>
</tr>
</thead>
<tbody>
<%
}
%>
Upvotes: 0
Reputation: 1437
The resource string macro is {$ the.resource.string.code $}, so you add a localization string in the "Localize" module in Kentico, and use the macro above to place it.
If this is in an ASCX transformation, you may need to either use the CMS:LocalizedString control, or use a Literal control and then use the CMS.Helpers.ResHelper.GetString("stringKey");
https://docs.kentico.com/display/K9/Working+with+resource+strings
Upvotes: 1