LanguageAPI Server Control

The LanguageAPI server control lets a developer force a particular language for a Web site. You can do this by dropping the server control on the page and setting a language in the SiteLanguage property box. You can also override site language logic by programmatically using the LanguageAPI server control to detect the browser’s language, and display the site in that language.

LanguageSelect server control vs. LanguageAPI server control

LanguageSelect Server Control vs. LanguageAPI Server Control

The LanguageSelect server control lets users view your site in the language they choose. The LanguageAPI server control, on the other hand, forces users to view a site in a particular language. For information on LanguageSelect, see LanguageSelect Server Control.

LanguageAPI server control properties

LanguageAPI Server Control Properties

The following are Ektron-specific server control properties. You can find information about native .NET properties such as font, height, width and border style in Visual Studio® help.

  • SiteLanguage (String)

    Sets the site language. Runs through the IsValid function to verify that the language is an active language in the system.

  • SiteLanguageID (Integer)

    Numeric value of the site language. This is the property you will use if you are using code-behind to set the sites language ID.

    Example: 1036 = French

    For a list of supported languages, go to Ektron Workarea > Settings > Configuration > Language Settings.

LanguageAPI Code-behind only properties and methods

LanguageAPI Code-Behind Only Properties and Methods

The following is a list can only be used programmatically.

  • CurrentLanguage (String)

    Read only. Returns the current language.

  • CurrentLanguageID (Integer)

    Read only. Returns the current language ID.

  • DefaultLanguage (String)

    Read only. What the default language of the site is set to. For example, the demo site is “English (Standard)”.

  • DefaultLanguageID (Integer)

    Read only. Returns the value that is the default language ID of the site. For example, the demo site is “1033” for English.

  • GetLanguage (Integer Argument)

    This method returns a string. Pass in a valid language ID and it will return the language name.

  • GetLanguageID (Sting Argument)

    This method returns an integer. Pass in a valid language name and it will return the language ID.

  • IsValid (Argument)

    This method returns a boolean. You can pass in a language ID or a string and it will tell you if the system is supporting it.

  • LanguageIdList (Array of Integers)

    Read only. Lists all the language IDs that are activated in Ektron. For information on how to enable languages, see Working with Multi-Language Content.

  • LanguageTitleList (Array of Strings)

    Read only. Lists all the languages that are activated in Ektron.

  • MultiLanguageEnabled (Boolean)

    Read only. Tells if the site supports multi-language mode.

    • True (default)—Multi-language enabled
    • False—Multi-language not enabled
Using the LanguageAPI server control programmatically

Using the LanguageAPI Server Control Programmatically

This example uses a logo that is not managed through Ektron. It retrieves the current language from the LanguageAPI control, and uses that information to choose the logo version to display. The code-behind looks like this.

Select Case LanguageAPI1.CurrentLanguageID
	Case 1031
	Image1.ImageUrl = "germanlogo.gif"
	Case 1033
	Image1.ImageUrl = "englishlogo.gif"
	Case 1036
	Image1.ImageUrl = "frenchlogo.gif"
End Select