Download DOWNLOAD
Forums FORUMS
Blogs BLOGS
Forge FORGE
Help HELP
Marketplace MARKETPLACE
DotNetNuke Home
You are here >   Community > Blogs
Register  |  Login

DNN Blog

Aug 24

Posted by: Erik van Ballegoij
8/24/2008 10:23 PM 

This blog is long overdue. 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]

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-2 three-letter code for the language of the current CultureInfo

[CULTURE:THREELETTERISOCODE]

Gets the ISO 639-1 two-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=' <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

 

 

Tags:

4 comment(s) so far...

Re: The Language SkinObject explained

Thanks for this indepth look at the Language SkinObject Erik. Great to learn the different options of what can be displayed. I'll update the Online Help accordingly.

By Lorraine Young on   8/25/2008 9:36 AM

Re: The Language SkinObject explained

Nice documentation. But I allway use your MLLanguageSelector when I build ML DNN Sites for customers.

By kalak on   9/15/2008 8:46 AM

Re: The Language SkinObject explained

Can we Hide "language/en-US" QueryString parameter for currently selected Language form URL ?

By chandresh_tycs on   9/15/2008 8:46 AM

Re: The Language SkinObject explained

@chandresh_tycs: The question you are asking has nothing to do with the LANGUAGE skin object. You can turn off the language parameter in the url by going to Admin>Languages, and turn off the appropriate checkbox

By ErikVB on   9/15/2008 8:48 AM

Networks

Follow DNNCorp on Twitter

LinkedIn

Follow us on Twitter @DNNCorp or join the DotNetNuke Community on LinkedIn

Sponsors

DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation

Hosted by MaximumASP