CultureInfo.GetCultureInfoByIetfLanguageTag(String) 方法

定義

已取代。Deprecated. 擷取唯讀的 CultureInfo 物件,其語言特性是透過指定的 RFC 4646 語言標籤所辨識。Retrieves a read-only CultureInfo object having linguistic characteristics that are identified by the specified RFC 4646 language tag.

public:
 static System::Globalization::CultureInfo ^ GetCultureInfoByIetfLanguageTag(System::String ^ name);
public static System.Globalization.CultureInfo GetCultureInfoByIetfLanguageTag (string name);
static member GetCultureInfoByIetfLanguageTag : string -> System.Globalization.CultureInfo
Public Shared Function GetCultureInfoByIetfLanguageTag (name As String) As CultureInfo

參數

name
String

透過 RFC 4646 標準指定的語言名稱。The name of a language as specified by the RFC 4646 standard.

傳回

CultureInfo

唯讀 CultureInfo 物件。A read-only CultureInfo object.

例外狀況

name 為 null。name is null.

name 不會對應至支援的文化特性。name does not correspond to a supported culture.

備註

注意

這個方法和 IetfLanguageTag 屬性已被取代。This method and the IetfLanguageTag property are deprecated. 應用程式應該使用新的 CultureInfo 物件並呼叫屬性,而不是使用這些元素 NameInstead of using these elements, the application should use a new CultureInfo object and calls to the Name property. IETF 標記和名稱完全相同。IETF tags and names are identical.

網際網路工程任務推動小組所維護的 RFC 4646 標準 (IETF) 定義 IETF 語言標記,以提供識別語言的統一方式。The RFC 4646 standard that is maintained by the Internet Engineering Task Force (IETF) defines an IETF language tag, which provides a uniform means of identifying a language. IETF 語言標記的格式與屬性所傳回的文化特性名稱相同 Name ,但不會唯一識別文化特性。The format of an IETF language tag is the same as the culture name returned by the Name property, but does not identify a culture uniquely. 如果文化特性具有相同的語言特性,則不同文化特性會共用相同的 IETF 語言標記。Different cultures share the same IETF language tag if those cultures have identical linguistic characteristics. 文化特性的語言特性會包含在 TextInfo 與物件相關聯的物件中 CultureInfoThe linguistic characteristics of a culture are contained in the TextInfo object associated with a CultureInfo object.

IETF 語言標記包含強制語言識別項、選擇性的腳本識別碼,以及選擇性的區域識別碼。An IETF language tag consists of a mandatory language identifier, an optional script identifier, and an optional region identifier.

您的應用程式應該使用已抓取的文化特性來控制語言特定的工作,例如管理拼寫或文法檢查工具。Your applications should use the retrieved culture to control language-specific tasks, such as managing a spelling or grammar checker. 應用程式不應該使用已抓取的文化特性來控制文化特性特定的工作,例如排序文字或格式化時間和日期。Applications should not use the retrieved culture to control culture-specific tasks, such as sorting text or formatting times and dates.

如需詳細資訊,請參閱 RFC 4646、「識別語言的標記」和最新的草稿標準 Draft-phillips-langtags-05.txt,網址為 https://go.microsoft.com/fwlink/?LinkId=100231For more information, see RFC 4646, "Tags for Identifying Languages," and the most recent draft standard, Draft-phillips-langtags-05.txt, at https://go.microsoft.com/fwlink/?LinkId=100231.

給呼叫者的注意事項

.NET Framework 3.5.NET Framework 3.5和舊版若 ArgumentException name 未對應至支援的文化特性名稱,則會擲回。The .NET Framework 3.5.NET Framework 3.5 and earlier versions throw an ArgumentException if name does not correspond to the name of a supported culture. 從開始 .NET Framework 4.NET Framework 4 ,這個方法會擲回 CultureNotFoundExceptionStarting with the .NET Framework 4.NET Framework 4, this method throws a CultureNotFoundException.

適用於

另請參閱