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

public static String getCountry() {
    Locale locale = Locale.getDefault();
    return locale.getCountry();
}

From source file:Main.java

public static String getLocaleLanguage() {
    Locale l = Locale.getDefault();
    return String.format("%s-%s", l.getLanguage(), l.getCountry());
}

From source file:Main.java

public static String getCountryAbbreviation() {
    return Locale.getDefault().getCountry();
}

From source file:Main.java

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

From source file:Main.java

public static String getThreadInfo() {
    return String.format(Locale.getDefault(), "[thread_id:%d name=%s]", Thread.currentThread().getId(),
            Thread.currentThread().getName());
}

From source file:Main.java

public static float b2mb(int b) {
    String mb = String.format(Locale.getDefault(), "%.2f", (float) b / 1024 / 1024);
    return Float.valueOf(mb);
}

From source file:Main.java

public static String getLanguage() {
    String language = Locale.getDefault().getLanguage();
    if (language == null) {
        language = "en";
    }//w w w  . ja v a2s .  com
    return language;
}

From source file:Main.java

public static boolean IsLanguageCN() {
    String language = Locale.getDefault().getLanguage();
    if (language.equalsIgnoreCase("zh") || language.equalsIgnoreCase("cn"))
        return true;
    return false;
}

From source file:Main.java

public static String GetWhetherBlank() {
    if ("zh".equals(Locale.getDefault().getLanguage()))
        return "";
    else//w w w .jav a  2 s  .c o m
        return " ";
}

From source file:Main.java

public static String formatFloat(float value) {
    return String.format(Locale.getDefault(), "%.3f", value);
}