Please login with Twitter.
24

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

[CULTURE:NATIVENAME]

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 " ()" in the language of the localized version of .NET Framework.

[CULTURE:ENGLISHNAME]

Gets the culture name in the format " ()" in English.

[CULTURE:LCID]

Gets the culture identifier for the current CultureInfo

[CULTURE:NAME]

Gets the culture name in the format "-".

[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 "-.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

Default configuration in default DotNetNuke skin.

Sample 2

Displays only dropdownlist

Sample 3

Displays dropdownlist and flag of currently selected language

Sample 4

Displays text links for languages. Selected language has different classname

 

(cross posted from my blog on dotnetnuke.com)

Posted in: DotNetNuke
  

Comments

Jose  Garrido
# Jose Garrido
Thursday, November 13, 2008 10:30 AM
Hi, I don't want show the flags, and I am trying show name, but in the nativename it show English (United States).Can I show only English?Best Regards.
Erik van Ballegoij
Tuesday, November 18, 2008 12:41 PM
AFAIK you cannot display only the name of the language in .NET. Since DNN only uses the .NET methods to display these names, DNN cannot do it either. My own language selector (MLLanguageSelector) allows you to link to a resource file for language names, so you can use anything there. Check out my company site (www.apollo-software.nl) for more information

Post Comment

Name (required)

Email (required)

Website

CAPTCHA image
Enter the code shown above: