Skip to content

Commit f692d3c

Browse files
committed
ICU-23056 Use Locale in Directionality.of
1 parent 1cc931c commit f692d3c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

icu4j/main/core/src/main/java/com/ibm/icu/message2/Directionality.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
package com.ibm.icu.message2;
55

6+
import java.util.Locale;
7+
68
import com.ibm.icu.util.ULocale;
79

810
/**
@@ -50,15 +52,15 @@ public enum Directionality {
5052
/**
5153
* Determines the directionality appropriate for a given locale.
5254
*
53-
* @param ulocale the locale to determine the directionality from.
55+
* @param locale the locale to determine the directionality from.
5456
* @return the appropriate directionality for the locale given.
5557
*
5658
* @draft ICU 78
5759
*/
58-
public static Directionality of(ULocale ulocale) {
59-
if (ulocale == null ) {
60+
public static Directionality of(Locale locale) {
61+
if (locale == null) {
6062
return Directionality.INHERIT;
6163
}
62-
return ulocale.isRightToLeft() ? Directionality.RTL : Directionality.LTR;
64+
return ULocale.forLocale(locale).isRightToLeft() ? Directionality.RTL : Directionality.LTR;
6365
}
6466
}

icu4j/main/core/src/main/java/com/ibm/icu/message2/OptUtils.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import java.util.regex.Matcher;
99
import java.util.regex.Pattern;
1010

11-
import com.ibm.icu.util.ULocale;
12-
1311
class OptUtils {
1412
// This matches JSON number (https://www.rfc-editor.org/rfc/rfc8259#section-6)
1513
//
@@ -118,7 +116,7 @@ static Locale getBestLocale(Map<String, Object> options, Locale defaultValue) {
118116

119117
static Directionality getBestDirectionality(Map<String, Object> options, Locale locale) {
120118
Directionality result = getDirectionality(options);
121-
return result == Directionality.UNKNOWN ? Directionality.of(ULocale.forLocale(locale)) : result;
119+
return result == Directionality.UNKNOWN ? Directionality.of(locale) : result;
122120
}
123121

124122
static Directionality getDirectionality(Map<String, Object> options) {

0 commit comments

Comments
 (0)