Package com.caucho.quercus.env

Examples of com.caucho.quercus.env.QuercusLocale


   */
  public static ArrayValue localeconv(Env env)
  {
    ArrayValueImpl array = new ArrayValueImpl();

    QuercusLocale money = env.getLocaleInfo().getMonetary();

    Locale locale = money.getLocale();

    DecimalFormatSymbols decimal = new DecimalFormatSymbols(locale);
    Currency currency = NumberFormat.getInstance(locale).getCurrency();

    array.put(env.createString("decimal_point"),
View Full Code Here


   *
   * @return a string of formatted values
   */
  public static String money_format(Env env, String format, double value)
  {
    QuercusLocale monetary = env.getLocaleInfo().getMonetary();

    Locale locale = monetary.getLocale();

    return NumberFormat.getCurrencyInstance(locale).format(value);
  }
View Full Code Here

  {
    LocaleInfo localeInfo = env.getLocaleInfo();

    if (localeArg instanceof ArrayValue) {
      for (Value value : ((ArrayValue) localeArg).values()) {
        QuercusLocale locale = setLocale(localeInfo,
                                         category,
                                         value.toString());

        if (locale != null)
          return env.createString(locale.toString());
      }
    }
    else {
      QuercusLocale locale = setLocale(localeInfo,
                                       category,
                                       localeArg.toString());

      if (locale != null)
        return env.createString(locale.toString());
    }

    for (int i = 0; i < fallback.length; i++) {
      QuercusLocale locale = setLocale(localeInfo,
                                       category,
                                       fallback[i].toString());

      if (locale != null)
        return env.createString(locale.toString());
    }

    return BooleanValue.FALSE;
  }
View Full Code Here

   */
  private static QuercusLocale setLocale(LocaleInfo localeInfo,
                                         int category,
                                         String localeName)
  {
    QuercusLocale locale = findLocale(localeName);

    if (locale == null)
      return null;

    switch (category) {
View Full Code Here

      locale = new Locale(language, country);
    else
      locale = new Locale(language);

    if (isValidLocale(locale))
      return new QuercusLocale(locale, charset);
    else
      return null;
  }
View Full Code Here

            i = j;
            break loop;

          case 'e': case 'E': case 'f': case 'g': case 'G':
          case 'F':
            QuercusLocale locale = null;

            if (ch == 'F')
              ch = 'f';
            else
              locale = env.getLocaleInfo().getNumeric();
View Full Code Here

   */
  public static ArrayValue localeconv(Env env)
  {
    ArrayValueImpl array = new ArrayValueImpl();

    QuercusLocale money = env.getLocaleInfo().getMonetary();

    Locale locale = money.getLocale();

    DecimalFormatSymbols decimal = new DecimalFormatSymbols(locale);
    Currency currency = NumberFormat.getInstance(locale).getCurrency();

    array.put(env.createString("decimal_point"),
View Full Code Here

   *
   * @return a string of formatted values
   */
  public static String money_format(Env env, String format, double value)
  {
    QuercusLocale monetary = env.getLocaleInfo().getMonetary();

    Locale locale = monetary.getLocale();

    return NumberFormat.getCurrencyInstance(locale).format(value);
  }
View Full Code Here

  {
    LocaleInfo localeInfo = env.getLocaleInfo();

    if (localeArg instanceof ArrayValue) {
      for (Value value : ((ArrayValue) localeArg).values()) {
        QuercusLocale locale = setLocale(localeInfo,
                                         category,
                                         value.toString());

        if (locale != null)
          return env.createString(locale.toString());
      }
    }
    else {
      QuercusLocale locale = setLocale(localeInfo,
                                       category,
                                       localeArg.toString());

      if (locale != null)
        return env.createString(locale.toString());
    }

    for (int i = 0; i < fallback.length; i++) {
      QuercusLocale locale = setLocale(localeInfo,
                                       category,
                                       fallback[i].toString());

      if (locale != null)
        return env.createString(locale.toString());
    }

    return BooleanValue.FALSE;
  }
View Full Code Here

   */
  private static QuercusLocale setLocale(LocaleInfo localeInfo,
                                         int category,
                                         String localeName)
  {
    QuercusLocale locale = findLocale(localeName);

    if (locale == null)
      return null;

    switch (category) {
View Full Code Here

TOP

Related Classes of com.caucho.quercus.env.QuercusLocale

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.