Reputation: 1256
I want to change the text of a text link based on culture. The site is en-ca or fr-ca. This transformation is renders the html pieces for an Accordion based on Bootstraps collapse JS. At this point it functions as planned, and now i'm trying to avoid a another transformation for French.
One portion of this is to show a transcript for a video or audio file. The label for that link should be Transcript or Transciption.
I've only been able to find this reference (http://devnet.kentico.com/questions/how-to-get-the-culture-of-the-current-page-document) but i'm unsure how to procede.
Here's my full transformation
<script runat="server">
protected string GetID()
{
Control parent = this;
while ( (!(parent is CMSWebParts_Viewers_Documents_cmsrepeater)) &&
(parent != null))
{
parent = parent.Parent;
}
return (parent as CMSWebParts_Viewers_Documents_cmsrepeater).WebPartID;
}
</script>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a href="#accordionPanel<%# DataItemIndex + 1 %>" class="panel-title-link collapsed" data-toggle="collapse" data-parent="#<%# GetID() %>"><span class="count"><%# DataItemIndex + 1 %>.</span><span class="title"><%# Eval("Heading") %></span></a>
</h4>
</div>
<div id="accordionPanel<%# DataItemIndex + 1 %>" class="panel-collaspe collapse" role="tabpanel" aria-labeledby="panel<%# DataItemIndex + 1 %>">
<div class="panel-body">
<div class="row">
<asp:PlaceHolder runat="server" id="webinarVideo" visible='<%# IfEmpty(Eval("WebinarVideo"), false, true) %>'>
<div class="col-xs-12 col-md-4 col-md-push-8 synopsis">
<section class="webinarSynopsis">
<h1><%# Eval("Heading") %></h1>
<p><%# Eval("WebinarSynopsis") %></p>
<p><%# FormatDateTime(Eval("WebinarDate"),"dddd, MMMM d, yyyy") %></p>
<p><a href="<%# Eval(" WebinarPDF ") %>" target="_blank"><%# Eval("Heading") %></a></p>
</section>
</div>
<div class="col-xs-12 col-md-8 col-md-pull-4 video">
<video controls>
<source src="<%# Eval(" WebinarVideo ") %>" type='video/mp4'>
</video>
</div>
</asp:PlaceHolder>
<asp:PlaceHolder runat="server" id="webinarAudio" visible='<%# IfEmpty(Eval("WebinarAudio"), false, true) %>'>
<div class="col-xs-12 audio">
<section class="webinarSynopsis">
<!-- <h1><%# Eval("Heading") %></h1> -->
<p><%# Eval("WebinarSynopsis") %></p>
<audio controls>
<source src="<%# Eval(" WebinarAudio ") %>" type="audio/mpeg">
</audio>
<p><%# FormatDateTime(Eval("WebinarDate"),"dddd, MMMM d, yyyy") %></p>
<p><a href="<%# Eval(" WebinarPDF ") %>" target="_blank"><%# Eval("Heading") %></a></p>
</section>
</div>
</asp:PlaceHolder>
</div>
</div>
</div>
</div>
Upvotes: 0
Views: 1012
Reputation: 911
I see three links in your transformations. All have as content <%# Eval("Heading") %>.
<p><a href="<%# Eval(" WebinarPDF ") %>" target="_blank"><%# Eval("Heading") %></a></p>
If your website is configured to be multilingual as described in this link https://docs.kentico.com/display/K9/Setting+up+multilingual+websites you don't need to have a different transformation to translate content. All you have to do is to put different content in "Heading" field, Form tab, of each culture of the page. And you can have different link of the PDF, audio or video file for each language version.
Here is a link that explain how to edit content of multilingual websites: https://docs.kentico.com/display/K9/Editing+the+content+of+multilingual+websites
If the text that you want to translate is not in the page content (Form tab) you can use Localization application as described here https://docs.kentico.com/display/K9/Working+with+resource+strings and use the key in the tranformation like this:
<%# CMS.Helpers.ResHelper.GetString("custom.transciption") %>
Upvotes: 3
Reputation: 756
Create a resource string using the localization application. Then use use localize method in your transformation. I believe it is <%# Localize(key) %>
Upvotes: 0
Reputation: 1549
Mark, use either UI Culters to specify link text in different cultures and localization methods to get its value, or simply localization macro like this:
{$=Hello|de-de=Hallo|it-it=Ciao$}
Upvotes: 1