Language skin object

Return to previous page

  • 4/7/2015
  • 2741 Views

Comments

2741 Views

Language skin object

Last updated 5 years ago

Comments

Common

(Enter the content of this article below)

Advanced

 
Note: this page is based on the blog created by Erik van Ballegoij.

In DotNetNuke 04.06.00 the language skinobject was beefed up to be much more versatile. Apart from just a dropdown menu, it can also display links to languages. Even though Lorraine blogged about the new appearance, there is much more to the skinobject than meets the eyes!

The skinobject supports 2 display modes: dropdown menu and template based repeater (you can even use both at the same time). Apart from that, there is a common header and a common footer available (both templatable).

All templates of the skinobject use the DNN core TokenReplace functionality as template engine. This means that you can control visible appearance of the language skin object to a great extent.

First, let us look at all attributes of the skinobject:












































































Attribute Name



Functionality



Allowed values



Default Value


CssClass

String attribute, used to style the language dropdown list



Any valid CSS Class name



empty



ShowMenu



Boolean attribute, used to either display or hide the dropdown menu



Tue, False



True



ShowLinks



Boolean attribute, used to either display or hide the language links repeater



True, False



False



CommonHeaderTemplate



String attribute for template to be used as common header



Any valid string



empty



HeaderTemplate



String attribute for template to be used as repeater header



Any valid string



 



ItemTemplate



String attribute for template to be used as repeater item



Any valid string



<a href="[URL]" class="Language" title="[CULTURE:NATIVENAME]"><img src="[I][FLAGSRC]" alt="[CULTURE:NATIVENAME]" border="0" ></a>



AlternateTemplate



String attribute for template to be used as alternate repeater item



Any valid string



empty



SelectedItemTemplate



String attribute for template to be used for the active item



Any valid string



empty



SeparatorTemplate



String attribute for template to be used as repeater separator item



Any valid string



 



FooterTemplate



String attribute for template to be used as repeater footer item



Any valid string



empty



CommonFooterTemplate



String attribute for template to be used as common footer



Any valid string



empty



In order to facilitate the display of cultures, a CulturePropertyAccess class was created,

which is used to render the name of a culture based on the different display attributes of the .NET CultureInfo  class.

Inside the different template you can use the following CULTURE token properties to display the name of a culture:


































[CULTURE:DISPLAYNAME]



Gets the culture name in the format "<languagefull> (<country/regionfull>)" in the language of the localized version of .NET Framework.



[CULTURE:ENGLISHNAME]



Gets the culture name in the format "<languagefull> (<country/regionfull>)" in English.



[CULTURE:LCID]



Gets the culture identifier for the current CultureInfo



[CULTURE:NAME]



Gets the culture name in the format "<languagecode2>-<country/regioncode2>".



[CULTURE:NATIVENAME]



Gets the culture name, consisting of the language, the country/region, and the optional script, that the culture is set to display.



[CULTURE:TWOLETTERISOCODE]



Gets the ISO 639-1 two-letter code for the language of the current CultureInfo<

[CULTURE:THREELETTERISOCODE]


Gets the ISO 639-2 three-letter code for the language of the current CultureInfo

(Descriptions copied from http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo_members.aspx)


By the way: the CULTURE token is available throughout DotNetNuke in every module that supports TokenReplace


The following tokens are also supported inside the Language skinobject template:






































[URL]



This will generate the correct URL for the current page in a specific culture



[FLAGSRC]



The name of a flag image (.gif only) for a specific culture, in the format "<languagecode2>-<country/regioncode2>.gif".



[SELECTED]



Returns “True” if a specific culture  is the current culture.



[LABEL]



Inserts the Label text from the resource file.



[I]



Returns the directory that holds the core country flag images (/images/Flags)



[P]



Returns the portal directory



[S]



Returns the directory of the current skin



[G]



Returns the global (host) skin folder



 


Some samples:































Display



Code (ascx)



Description


Sample 1

<dnn:LANGUAGE runat="server" ID="dnnLANGUAGE" ShowMenu="False" ShowLinks="True" />



Default configuration in default DotNetNuke skin.


Sample 2

<dnn:LANGUAGE runat="server" ID="dnnLANGUAGE" ShowLinks="False" ShowMenu="True" />



Displays only dropdownlist


Sample 3

<dnn:LANGUAGE runat="server" ID="dnnLANGUAGE" ShowLinks="False" ShowMenu="True" CommonFooterTemplate='&#160;<img src="[I][FLAGSRC]" alt="[CULTURE:NATIVENAME]" border="0" />' />



Displays dropdownlist and flag of currently selected language


Sample 4

<dnn:LANGUAGE runat="server" ID="dnnLANGUAGE" ShowLinks="True" ShowMenu="False" ItemTemplate='>a href="[URL]" class="Language" title="[CULTURE:NATIVENAME]"><span class="Language[SELECTED]">[CULTURE:NAME]</span>&</a>'/>



Displays text links for languages. Selected language has different classname



What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out