Tabnine Logo
LocaleData
Code IndexAdd Tabnine to your IDE (free)

How to use
LocaleData
in
libcore.icu

Best Java code snippets using libcore.icu.LocaleData (Showing top 20 results out of 315)

origin: robovm/robovm

private static String defaultPattern() {
  LocaleData localeData = LocaleData.get(Locale.getDefault());
  return localeData.getDateFormat(SHORT) + " " + localeData.getTimeFormat(SHORT);
}
origin: robovm/robovm

private static LocaleData initLocaleData(Locale locale) {
  LocaleData localeData = new LocaleData();
  if (!ICU.initLocaleDataNative(locale.toString(), localeData)) {
    throw new AssertionError("couldn't initialize LocaleData for locale " + locale);
origin: robovm/robovm

/**
 * Returns a shared LocaleData for the given locale.
 */
public static LocaleData get(Locale locale) {
  if (locale == null) {
    locale = Locale.getDefault();
  }
  String localeName = locale.toString();
  synchronized (localeDataCache) {
    LocaleData localeData = localeDataCache.get(localeName);
    if (localeData != null) {
      return localeData;
    }
  }
  LocaleData newLocaleData = initLocaleData(locale);
  synchronized (localeDataCache) {
    LocaleData localeData = localeDataCache.get(localeName);
    if (localeData != null) {
      return localeData;
    }
    localeDataCache.put(localeName, newLocaleData);
    return newLocaleData;
  }
}
origin: robovm/robovm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing time
 * values in the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getTimeInstance(int style, Locale locale) {
  checkTimeStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getTimeFormat(style), locale);
}
origin: robovm/robovm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getDateInstance(int style, Locale locale) {
  checkDateStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getDateFormat(style), locale);
}
origin: robovm/robovm

/**
 * Constructs a new {@code DateFormatSymbols} instance containing the
 * symbols for the specified locale.
 *
 * @param locale
 *            the locale.
 */
public DateFormatSymbols(Locale locale) {
  this.locale = locale;
  this.localPatternChars = SimpleDateFormat.PATTERN_CHARS;
  this.localeData = LocaleData.get(locale);
  this.ampms = localeData.amPm;
  this.eras = localeData.eras;
  this.months = localeData.longMonthNames;
  this.shortMonths = localeData.shortMonthNames;
  this.weekdays = localeData.longWeekdayNames;
  this.shortWeekdays = localeData.shortWeekdayNames;
}
origin: robovm/robovm

/**
 * Returns a {@code NumberFormat} for formatting and parsing numbers for the
 * specified locale.
 *
 * @param locale
 *            the locale to use.
 * @return a {@code NumberFormat} for handling {@code Number} objects.
 */
public static NumberFormat getNumberInstance(Locale locale) {
  return getInstance(LocaleData.get(locale).numberPattern, locale);
}
origin: MobiVM/robovm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing time
 * values in the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getTimeInstance(int style, Locale locale) {
  checkTimeStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getTimeFormat(style), locale);
}
origin: MobiVM/robovm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getDateInstance(int style, Locale locale) {
  checkDateStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getDateFormat(style), locale);
}
origin: robovm/robovm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates
 * and time values in the specified styles for the specified locale.
 *
 * @param dateStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param timeStyle
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @return the {@code DateFormat} instance for {@code dateStyle},
 *         {@code timeStyle} and {@code locale}.
 * @throws IllegalArgumentException
 *             if {@code dateStyle} or {@code timeStyle} is not one of
 *             SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 */
public static final DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale) {
  checkTimeStyle(timeStyle);
  checkDateStyle(dateStyle);
  LocaleData localeData = LocaleData.get(locale);
  String pattern = localeData.getDateFormat(dateStyle) + " " + localeData.getTimeFormat(timeStyle);
  return new SimpleDateFormat(pattern, locale);
}
origin: robovm/robovm

/**
 * Returns a {@code NumberFormat} for formatting and parsing currency values
 * for the specified locale.
 *
 * @param locale
 *            the locale to use.
 * @return a {@code NumberFormat} for handling currency values.
 */
public static NumberFormat getCurrencyInstance(Locale locale) {
  return getInstance(LocaleData.get(locale).currencyPattern, locale);
}
origin: com.mobidevelop.robovm/robovm-rt

/**
 * Returns a {@code DateFormat} instance for formatting and parsing time
 * values in the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getTimeInstance(int style, Locale locale) {
  checkTimeStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getTimeFormat(style), locale);
}
origin: ibinti/bugvm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getDateInstance(int style, Locale locale) {
  checkDateStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getDateFormat(style), locale);
}
origin: com.mobidevelop.robovm/robovm-rt

/**
 * Returns a shared LocaleData for the given locale.
 */
public static LocaleData get(Locale locale) {
  if (locale == null) {
    locale = Locale.getDefault();
  }
  String localeName = locale.toString();
  synchronized (localeDataCache) {
    LocaleData localeData = localeDataCache.get(localeName);
    if (localeData != null) {
      return localeData;
    }
  }
  LocaleData newLocaleData = initLocaleData(locale);
  synchronized (localeDataCache) {
    LocaleData localeData = localeDataCache.get(localeName);
    if (localeData != null) {
      return localeData;
    }
    localeDataCache.put(localeName, newLocaleData);
    return newLocaleData;
  }
}
origin: MobiVM/robovm

private static LocaleData initLocaleData(Locale locale) {
  LocaleData localeData = new LocaleData();
  if (!ICU.initLocaleDataNative(locale.toString(), localeData)) {
    throw new AssertionError("couldn't initialize LocaleData for locale " + locale);
origin: ibinti/bugvm

private static String defaultPattern() {
  LocaleData localeData = LocaleData.get(Locale.getDefault());
  return localeData.getDateFormat(SHORT) + " " + localeData.getTimeFormat(SHORT);
}
origin: robovm/robovm

/**
 * Returns a {@code NumberFormat} for formatting and parsing percentage
 * values for the given {@code locale}.
 *
 * <p>The {@code NumberFormat} returned by this method should only be used
 * to format floating-point numbers typically between 0 and 1 (with 1 being 100%).
 * A value such as 0.53 will be treated as 53%, but 53.0 (or the integer 53) will be
 * treated as 5,300%, which is rarely what you intended.
 */
public static NumberFormat getPercentInstance(Locale locale) {
  return getInstance(LocaleData.get(locale).percentPattern, locale);
}
origin: ibinti/bugvm

/**
 * Returns a {@code DateFormat} instance for formatting and parsing time
 * values in the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getTimeInstance(int style, Locale locale) {
  checkTimeStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getTimeFormat(style), locale);
}
origin: com.gluonhq/robovm-rt

/**
 * Returns a {@code DateFormat} instance for formatting and parsing dates in
 * the specified style for the specified locale.
 *
 * @param style
 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT.
 * @param locale
 *            the locale.
 * @throws IllegalArgumentException
 *             if {@code style} is not one of SHORT, MEDIUM, LONG, FULL, or
 *             DEFAULT.
 * @return the {@code DateFormat} instance for {@code style} and
 *         {@code locale}.
 */
public static final DateFormat getDateInstance(int style, Locale locale) {
  checkDateStyle(style);
  return new SimpleDateFormat(LocaleData.get(locale).getDateFormat(style), locale);
}
origin: ibinti/bugvm

/**
 * Returns a shared LocaleData for the given locale.
 */
public static LocaleData get(Locale locale) {
  if (locale == null) {
    locale = Locale.getDefault();
  }
  String localeName = locale.toString();
  synchronized (localeDataCache) {
    LocaleData localeData = localeDataCache.get(localeName);
    if (localeData != null) {
      return localeData;
    }
  }
  LocaleData newLocaleData = initLocaleData(locale);
  synchronized (localeDataCache) {
    LocaleData localeData = localeDataCache.get(localeName);
    if (localeData != null) {
      return localeData;
    }
    localeDataCache.put(localeName, newLocaleData);
    return newLocaleData;
  }
}
libcore.icuLocaleData

Javadoc

Passes locale-specific from ICU native code to Java.

Note that you share these; you must not alter any of the fields, nor their array elements in the case of arrays. If you ever expose any of these things to user code, you must give them a clone rather than the original.

Most used methods

  • get
    Returns a shared LocaleData for the given locale.
  • <init>
  • getDateFormat
  • getTimeFormat
  • initLocaleData

Popular in Java

  • Creating JSON documents from java classes using gson
  • getExternalFilesDir (Context)
  • compareTo (BigDecimal)
  • getSharedPreferences (Context)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • BoxLayout (javax.swing)
  • JFrame (javax.swing)
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now