Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.


The Language SkinObject explained

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

 

 

Comments

Michael Tobisch
I want the names of the language without the region/culture, e.g. "Deutsch", "English", "Français" etc. How can I achieve this?

Best wishes
Michael
Michael Tobisch Wednesday, July 24, 2013 10:29 AM (link)
Tobias Wiklund
This list has not the attribute SelectedItemTemplate. Without it, a flag is always displayed if you enter a template in ItemTemplate. Set this to replace the flags with text:

Tobias Wiklund Tuesday, February 18, 2014 3:40 AM (link)
L P
Yes, I don't understand why is there no SelectedItemTemplate? I am trying to turn the languages into an unordered list and it would work great...except for the selected language...it is always a span mixed in with my list items. It's really making something that should be simple rather difficult.
L P Friday, March 7, 2014 9:50 AM (link)
Kamran Shahid
I want's same as micahel
Kamran Shahid Thursday, May 8, 2014 1:28 PM (link)
Tom Van Wynen
Like Michael in the first comment, I also want only the " without the ()
but I don't see an option for this in the CULTURE: token properties above.
Tom Van Wynen Wednesday, October 1, 2014 9:39 AM (link)
Tom Van Wynen
sorry, the form stripped out the content I had between the quotes and parentheses.
languagefull without (country/regionfull)
Actually, I want the language name in the local script but don't know if that is even possible. I am getting that now on my current site with the old Apollo Multilingual system.
Tom Van Wynen Thursday, October 2, 2014 10:25 AM (link)
abdullah tahan
who are asking how to show only test of the language i've searched alot but i found away by my self , when i change the ItemTemplate changed only for the new localized language and didn't for the defualt one so go to admin/skins/app_localizedresources select
and change
AlternateTemplate.Default (this is for other language ) i made it like :
العربية
and
ItemTemplate.Default (this is for default ) i made it like :
English
Language.ascx.resx

Regard's
abdullah tahan Thursday, April 30, 2015 9:19 AM (link)
Amy Montgomery
For anyone who is having the flag problem, you have to go to the language.ascx.resx file under admin > Skins > App_localResources.

Then Ctrl+F to find data name = ItemTemplate. This is where it sets the default for each of these attributes and it overrides whatever you put in your ascx file for itemTemplate, and that's why you're getting flags instead of whatever you put.

If you look at the other ones who don't have anything set they just put 'value / inside of the data name one and that'll just get rid of the default so you're stuff will go through.

I didn't use html brackets in this comment because they don't show up in comments, but you get the drift.
Amy Montgomery Friday, March 2, 2018 10:14 PM (link)

Comment Form

Only registered users may post comments.

NewsArchives


Aderson Oliveira (22)
Alec Whittington (11)
Alessandra Daniels (3)
Alex Shirley (10)
Andrew Hoefling (3)
Andrew Nurse (30)
Andy Tryba (1)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (37)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Bogdan Litescu (1)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (213)
Chris Paterra (55)
Clint Patterson (108)
Cuong Dang (21)
Daniel Bartholomew (2)
Daniel Mettler (181)
Daniel Valadas (48)
Dave Buckner (2)
David Poindexter (12)
David Rodriguez (3)
Dennis Shiao (1)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (80)
Francisco Perez Andres (17)
Geoff Barlow (12)
George Alatrash (12)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (274)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Kelly Ford (4)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matt Rutledge (2)
Matthias Schlomann (16)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Miguel Gatmaytan (3)
Mike Horton (19)
Mitchel Sellers (40)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Oliver Hine (1)
Patricio F. Salinas (1)
Patrick Ryan (1)
Peter Donker (54)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Sacha Trauwaen (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott Schlesier (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Steven Fisher (1)
Tony Henrich (3)
Torsten Weggen (3)
Tycho de Waard (4)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (40)
Will Strohl (180)
William Severance (5)
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out