HttpRequest.UserLanguages HttpRequest.UserLanguages HttpRequest.UserLanguages HttpRequest.UserLanguages Property


Gets a sorted string array of client language preferences.Gets a sorted string array of client language preferences.

 property cli::array <System::String ^> ^ UserLanguages { cli::array <System::String ^> ^ get(); };
public string[] UserLanguages { get; }
member this.UserLanguages : string[]
Public ReadOnly Property UserLanguages As String()



クライアント言語設定の並べ替えられた文字列配列。空の場合は nullA sorted string array of client language preferences, or null if empty.

次のコード例は、によって返される複数の値をキャプチャ、UserLanguages文字列配列に各言語の名前を HTTP 出力の別の行の書き込みのプロパティ。The following code example captures the multiple values returned by the UserLanguages property into a string array and writes each language name to a separate line of HTTP output.

言語の名前は、ブラウザーによって提供され、すべての可能なコードの完全なリストがないです。The language names are provided by the browser, and there is no definitive list of all possible codes. 通常で構成され、言語、ハイフン、およびカルチャの 2 文字のコードの 2 文字コードのよう"英語-米国"米国の英語とカナダ フランス語の"fr-ca"。Typically these consist of a two-character codes for the language, a hyphen, and a two-character code for the culture, such as "en-us" for U.S. English and "fr-ca" for Canadian French.

int count;
String[] userLang = Request.UserLanguages;    
for (count = 0; count < userLang.Length; count++) 
   Response.Write("User Language " + count +": " + userLang[count] + "<br>");
Dim userLang() As String
 Dim count As Integer
 userLang = Request.UserLanguages
 For count = 0 To userLang.GetUpperBound(0)
    Response.Write("User Language: " & Cstr(userLang(count)) & "<br>")
 Next count