共用方式為


LocaleList.MatchesLanguageAndScript(Locale, Locale) Method

Definition

Determine whether two locales are considered a match, even if they are not exactly equal.

[Android.Runtime.Register("matchesLanguageAndScript", "(Ljava/util/Locale;Ljava/util/Locale;)Z", "", ApiSince=33)]
public static bool MatchesLanguageAndScript (Java.Util.Locale supported, Java.Util.Locale desired);
[<Android.Runtime.Register("matchesLanguageAndScript", "(Ljava/util/Locale;Ljava/util/Locale;)Z", "", ApiSince=33)>]
static member MatchesLanguageAndScript : Java.Util.Locale * Java.Util.Locale -> bool

Parameters

supported
Locale

The supported Locale to be compared.

desired
Locale

The desired Locale to be compared.

Returns

True if they match, false otherwise.

Attributes

Remarks

Determine whether two locales are considered a match, even if they are not exactly equal. They are considered as a match when both of their languages and scripts (explicit or inferred) are identical. This means that a user would be able to understand the content written in the supported locale even if they say they prefer the desired locale.

E.g. [zh-HK] matches [zh-Hant]; [en-US] matches [en-CA]

Java documentation for android.os.LocaleList.matchesLanguageAndScript(java.util.Locale, java.util.Locale).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to