XmlLanguage 类

定义

表示供 XMAL 标记中使用的语言标记。Represents a language tag for use in XAML markup.

public ref class XmlLanguage
[System.ComponentModel.TypeConverter(typeof(System.Windows.Markup.XmlLanguageConverter))]
public class XmlLanguage
type XmlLanguage = class
Public Class XmlLanguage
继承
XmlLanguage
属性

注解

语言标记在解释 XAML 的系统上可能有也可能没有已注册的 CultureInfoThe language tag may or may not have a registered CultureInfo present on the system where the XAML is interpreted.

此类用于处理使用 XML 中的 xml:lang 表示的值。This class is useful for dealing with values represented using xml:lang in XML.

语言标记可以指定为两个字符的格式,也可以指定为带字符的语言-区域设置形式。Language tags can be specified in two-character form or in a hyphenated language-locale form. 请参阅RFC 3066See RFC 3066.

请注意,XML 规范允许 xml:lang的空字符串,不过 RFC 3066 不允许这样做;因此,XmlLanguage 类型允许 "" (空特性字符串)。Note that the XML specification allows the empty string for xml:lang, although that is not permitted by RFC 3066; therefore, the XmlLanguage type permits "" (empty attribute string). 默认构造的 XmlLanguage 的行为如同使用 "" (空字符串)构造的一样。A default-constructed XmlLanguage behaves as if constructed with "" (empty string).

XAML 属性用法XAML Attribute Usage

<object property="prefix"/>  
- or -  
<object property="prefix-subcode"/>  

XAML 值XAML Values

作为prefix
语言前缀,使用 ISO 639-1 语言前缀值。Language prefix, using the ISO 639-1 language prefix values. 例如 "en" 或 "zh-chs"。For example "en", or "zh". 接受大写值并将其转换为小写。Uppercase values are accepted and converted to lowercase. 这也可能是空的属性 ""。This may also be an empty attribute, "".

子代码subcode
如果提供,则必须以单个连字符开头。If provided, must be preceded by a single hyphen. 然后,由 RFC 3066 定义的子代码。Then, a subcode as defined by RFC 3066. 最典型的用法,以及最有可能正确映射到 CultureInfo的用法是国家或地区,如 "-us" 或 "-hk"。The most typical usage, and the one which is most likely to properly map to a CultureInfo, is a country or regional designation such as "-us" or "-hk". 接受大写值并将其转换为小写。Uppercase values are accepted and converted to lowercase.

属性

Empty

获取一个静态 XmlLanguage 实例,该实例相当于 GetLanguage(String) 在语言标记为空的特性字符串的情况下创建的实例。Gets a static XmlLanguage instance as would be created by GetLanguage(String) with the language tag as an empty attribute string.

IetfLanguageTag

获取语言标记的字符串表示形式。Gets the string representation of the language tag.

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetEquivalentCulture()

当且仅当为该 CultureInfoXmlLanguage 值注册了此类 CultureInfo 后,才会为此 IetfLanguageTag 返回合适的等效 XmlLanguageReturns the appropriate equivalent CultureInfo for this XmlLanguage, if and only if such a CultureInfo is registered for the IetfLanguageTag value of this XmlLanguage

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetLanguage(String)

根据按 RFC 3066 表示语言的字符串,返回一个 XmlLanguage 实例。Returns a XmlLanguage instance, based on a string representing the language per RFC 3066.

GetSpecificCulture()

为此 CultureInfo 返回最紧密相关的特定 XmlLanguageReturns the most-closely-related non-neutral CultureInfo for this XmlLanguage.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回一个 String,表示当前的 XmlLanguageReturns a String that represents the current XmlLanguage.

适用于