LocaleEditor supports BCP 47 language tags as well

Closes gh-33348
This commit is contained in:
Juergen Hoeller
2024-08-13 18:50:30 +02:00
parent 86761cd233
commit 8be5010f5d
2 changed files with 7 additions and 3 deletions

View File

@@ -648,6 +648,10 @@ class CustomEditorTests {
assertThat(localeEditor.getValue()).isEqualTo(Locale.CANADA);
assertThat(localeEditor.getAsText()).isEqualTo("en_CA");
localeEditor = new LocaleEditor();
localeEditor.setAsText("zh-Hans");
assertThat(localeEditor.getValue()).isEqualTo(Locale.forLanguageTag("zh-Hans"));
localeEditor = new LocaleEditor();
assertThat(localeEditor.getAsText()).isEmpty();
}