On Thursday, May 14, 2020 at 7:30:11 AM UTC+2, foal wrote:
>
> Hi,
>
> Yes, I have and not happy with it. Can I ask how to emulate some Java 
> methods that required Locale as a parameter? The GWT version is not enough. 
> My version can cause problems. At least I need to describe it correctly on 
> the project page.
>

I don't mean introducing a new kind of Locale.
For example, you've added toLanguageTag as an instance method, and 
getAvailableLocales as a static method.
Then do:
public class LocaleExt {
  public static String toLanguageTag(Locale locale) { … }
  public static Locale[] getAvailableLocales() { … }
}

(and for performance, maybe cache the computed language tag in a 
java.util.Map or a JS WeakMap 
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap#Browser_compatibility>
)
and everywhere in your code where you used to call locale.toLanguageTag() 
or Locale.getAvailableLocales() then replace them with 
LocaleExt.toLanguageTag(locale) or LocaleExt.getAvailableLocales() 
respectively.

Then the 
SimpleDateTimeFormatStyleProvider#getFormatter(FormatStyle,FormatStyle,Chronology,Locale)
 
emulation can keep the exact same signature.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit/b14fdf84-f8e9-45fc-baf9-bc85ada2a796%40googlegroups.com.

Reply via email to