XmlLanguage.GetLanguage Method

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

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

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

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

XmlLanguage Class

System.Windows.Markup Namespace