XmlLanguage XmlLanguage XmlLanguage XmlLanguage Class


表示在 XAML 標記 (Markup) 中使用的語言標記 (Tag)。Represents a language tag for use in XAML markup.

public ref class XmlLanguage
public class XmlLanguage
type XmlLanguage = class
Public Class XmlLanguage


語言標記不一定會在用來解讀 XAML CultureInfo的系統上註冊。The language tag may or may not have a registered CultureInfo present on the system where the XAML is interpreted.

這個類別適合用來處理xml:lang以 XML 表示的值。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:lang, XML 規格允許的空字串, 雖然 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 Attribute UsageXAML Attribute Usage

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


語言前置詞, 使用 ISO 639-1 語言首碼值。Language prefix, using the ISO 639-1 language prefix values. 例如 "en" 或 "zh"。For example "en", or "zh". 會接受大寫值, 並將其轉換成小寫。Uppercase values are accepted and converted to lowercase. 這也可能是空的屬性 ""。This may also be an empty attribute, "".

如果提供的話, 前面必須加上單一連字號。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 Empty Empty 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 IetfLanguageTag IetfLanguageTag IetfLanguageTag

取得語言標記的字串表示。Gets the string representation of the language tag.


Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetEquivalentCulture() GetEquivalentCulture() GetEquivalentCulture() GetEquivalentCulture()

傳回這個 CultureInfo 的適當對等 XmlLanguage,僅限於針對這個 CultureInfoIetfLanguageTag 值註冊 XmlLanguage 的情況Returns the appropriate equivalent CultureInfo for this XmlLanguage, if and only if such a CultureInfo is registered for the IetfLanguageTag value of this XmlLanguage

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetLanguage(String) GetLanguage(String) GetLanguage(String) GetLanguage(String)

根據 RFC 3066,依照表示語言的字串傳回 XmlLanguage 執行個體。Returns a XmlLanguage instance, based on a string representing the language per RFC 3066.

GetSpecificCulture() GetSpecificCulture() GetSpecificCulture() GetSpecificCulture()

傳回這個 CultureInfo 之最為密切相關的非中性 XmlLanguageReturns the most-closely-related non-neutral CultureInfo for this XmlLanguage.

GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回表示目前 StringXmlLanguageReturns a String that represents the current XmlLanguage.