kentico 10 language data source with flags

hassan kalach asked on September 25, 2017 13:42

i am i am able to use kentico language data source but how can i add the flag next to each section ?!

Correct Answer

Suneel Jhangiani answered on September 25, 2017 15:06

Here is a transformation I use which get's the images from the Kentico supplied Images.Zip

{%
    cultureLocalizedName = GetResourceString(CurrentSite.SiteName + "." + CultureCode);
    return;
#%}
<li>
  <a title="{% cultureLocalizedName %}" href="{% HTMLEncode(URL) %}">
  <img src="/CMSPages/GetResource.ashx?image=%5bImages.zip%5d%2fFlags%2f16x16%2f{% CultureCode %}.png" alt="{% cultureLocalizedName %}" />{% cultureLocalizedName %}
  </a>
</li>
1 votesVote for this answer Unmark Correct answer

Recent Answers


Amit Srivastava answered on September 25, 2017 14:25

Hi Hassan,

{%
    cultureLocalizedName = GetResourceString(" " + CultureCode, (CultureCode == "de-de") ? "German" : ((CultureCode == "nl-nl") ? "Dutch" : "Englich"));
    return;
%}

<li>
   <a title="{% cultureLocalizedName %}" href="{%HTMLEncode(URL)%}">{% cultureName %}</a><img src="/Root/media/Folder/{%cultureName%}.png" />
</li>

use above code in transformation with XML transformation type and add your flag icon in media libraries using file name cultureName.png like Dutch.png. I have used it and it's working fine for me.

Thanks,

2 votesVote for this answer Mark as a Correct answer

hassan kalach answered on September 25, 2017 14:45

okay great thank i taught there's an automated way for it

0 votesVote for this answer Mark as a Correct answer

Amit Srivastava answered on September 25, 2017 14:52

I also checked for other way but finally i got that In the Language data source we can use only 3 fields- CultureCode,CultureName and URL. So, this is the only way to display flag with language.

Thanks

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.