Example usage for java.util Locale getDefault

List of usage examples for java.util Locale getDefault

Introduction

In this page you can find the example usage for java.util Locale getDefault.

Prototype

public static Locale getDefault() 

Source Link

Document

Gets the current value of the default locale for this instance of the Java Virtual Machine.

Usage

From source file:Main.java

private final static String languagePrefix() {
    final String language = Locale.getDefault().getLanguage();
    if ("de".equals(language))
        return "_de";
    else if ("cs".equals(language))
        return "_cs";
    else if ("el".equals(language))
        return "_el";
    else if ("es".equals(language))
        return "_es";
    else if ("fr".equals(language))
        return "_fr";
    else if ("it".equals(language))
        return "_it";
    else if ("nl".equals(language))
        return "_nl";
    else if ("pl".equals(language))
        return "_pl";
    else if ("ru".equals(language))
        return "_ru";
    else if ("sv".equals(language))
        return "_sv";
    else if ("tr".equals(language))
        return "_tr";
    else if ("zh".equals(language))
        return "_zh";
    else//from w ww  .java 2  s .  co  m
        return "";
}

From source file:Main.java

private final static String languagePrefix() {
    final String language = Locale.getDefault().getLanguage();
    if ("de".equals(language))
        return "_de";
    else if ("cs".equals(language))
        return "_cs";
    else if ("el".equals(language))
        return "_el";
    else if ("es".equals(language))
        return "_es";
    else if ("fr".equals(language))
        return "_fr";
    else if ("it".equals(language))
        return "_it";
    else if ("nl".equals(language))
        return "_nl";
    else if ("pl".equals(language))
        return "_pl";
    else if ("ru".equals(language))
        return "_ru";
    else if ("sk".equals(language))
        return "_sk";
    else if ("sv".equals(language))
        return "_sv";
    else if ("tr".equals(language))
        return "_tr";
    else if ("zh".equals(language))
        return "_zh";
    else// ww  w.  j  a  va 2 s  . c o m
        return "";
}

From source file:Main.java

public static String defaultLanguageCode() {
    return Locale.getDefault().getLanguage();
}

From source file:com.eryansky.common.utils.io.ResourceUtils.java

/**
 *  {res}.properties  key /*from www  . jav  a2  s  .com*/
 * 
 * @param baseName
 * @param key
 * @return
 */
public static String getString(String baseName, String key) {
    return _getStringForLocale(Locale.getDefault(), baseName, key);
}

From source file:Main.java

public static String getRandomFileName(String filePath) {
    SimpleDateFormat format = new SimpleDateFormat("MMddHHmmss", Locale.getDefault());
    Date date = new Date();
    String key = format.format(date);

    Random r = new Random();
    key = key + r.nextInt();//  ww  w . jav a 2  s.c  o m
    key = key.substring(0, 15);
    return filePath + "/" + key + ".jpeg";
}

From source file:Main.java

public static String formattedScore(int score) {
    return String.format(Locale.getDefault(), "%06d", score);
}

From source file:Main.java

public static HashMap getSysParamMap(Map map) {
    HashMap hashmap = new HashMap();
    HashMap hashmap1 = new HashMap();
    hashmap.put(encodeStr("appid"), encodeStr("1uMqYWpHo3MoLH"));
    hashmap.put(encodeStr("callid"),
            encodeStr((new StringBuilder()).append("").append(generateCallId()).toString()));
    hashmap.put(encodeStr("v"), encodeStr("1.0"));
    hashmap.put(encodeStr("lang"), encodeStr(Locale.getDefault().getLanguage()));
    hashmap1.putAll(hashmap);/*from w ww  .ja  v a  2  s. com*/
    if (map != null) {
        hashmap1.putAll(map);
    }
    hashmap.put("bd_sig", generateBgsid(hashmap1));
    return hashmap;
}

From source file:Main.java

public static String getCountry(Context ctx) {
    TelephonyManager tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
    Locale locale = Locale.getDefault();
    return tm.getSimState() == TelephonyManager.SIM_STATE_READY
            ? tm.getSimCountryIso().toLowerCase(Locale.getDefault())
            : locale.getCountry().toLowerCase(locale);
}

From source file:Main.java

/**
 * Uppercase first character/*from ww w .j a  va  2s . co  m*/
 *
 * @param str Input string
 * @return Output string
 */
public static String uppercaseFirst(String str) {
    return str.substring(0, 1).toUpperCase(Locale.getDefault()) + str.substring(1, str.length());
}

From source file:Main.java

/**
 * keep in mind: simpleDateFormatter is not thread safe! call completeDate
 * before applying this formatter.//from   w w  w.j ava2  s  .  co m
 */
public static SimpleDateFormat createDateFormatter() {
    return new SimpleDateFormat("yyyy/MM/dd", Locale.getDefault());
}