Partager via


XmlLanguage.GetLanguage Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns a XmlLanguage instance, based on a string representing the language per RFC 3066.

Namespace:  System.Windows.Markup
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Shared Function GetLanguage ( _
    ietfLanguageTag As String _
) As XmlLanguage
public static XmlLanguage GetLanguage(
    string ietfLanguageTag
)

Parameters

  • ietfLanguageTag
    Type: System.String
    An RFC 3066 language string, or an empty string ("").

Return Value

Type: System.Windows.Markup.XmlLanguage
A new XmlLanguage with the provided string as its IetfLanguageTag value.

Exceptions

Exception Condition
ArgumentException

ietfLanguageTag cannot be processed as a valid IETF language.

Remarks

This method is effectively the constructor, and also supports the type conversion for XAML attribute usage.

The language string may be empty, or else must conform to RFC 3066 rules:

  • The first subtag must consist of only ASCII letters.

  • Additional subtags must consist of ASCII letters or numerals.

  • Subtags are separated by a single hyphen character.

  • Every subtag must be 1 to 8 characters long.

  • No leading or trailing hyphens are permitted.

By default an XmlLanguage has an empty value for its language component.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.