Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Remove annotation for getLocaleFromString() #33409

Merged
merged 3 commits into from
May 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ public void sendLocalesToFlutter(@NonNull Configuration config) {
localizationChannel.sendLocales(locales);
}

@VisibleForTesting
/**
* Computes the {@link Locale} from the provided {@code String} with format
* language[-script][-region][-...], where script is an alphabet string of length 4, and region is
* either an alphabet string of length 2 or a digit string of length 3.
*/
@NonNull
public static Locale localeFromString(@NonNull String localeString) {
// Use Locale.forLanguageTag if available (API 21+).
Expand All @@ -201,11 +205,6 @@ public static Locale localeFromString(@NonNull String localeString) {
// Pre-API 21, we fall back to manually parsing the locale tag.
String parts[] = localeString.split("-", -1);

// The format is:
// language[-script][-region][-...]
// where script is an alphabet string of length 4, and region is either an alphabet string of
// length 2 or a digit string of length 3.

// Assume the first part is always the language code.
String languageCode = parts[0];
String scriptCode = "";
Expand Down