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 void main(String[] args) {

    String str = "java2s.com";

    System.out.println(str.toLowerCase(Locale.getDefault()));
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Locale myLocale = Locale.getDefault();
    ComponentOrientation ce = ComponentOrientation.getOrientation(myLocale);
    System.out.println("Is horizontal? " + ce.isHorizontal());
    System.out.println("Is left to right? " + ce.isLeftToRight());
}

From source file:NumberFormatApp.java

public static void main(String args[]) {
    NumberFormat format = NumberFormat.getCurrencyInstance(Locale.getDefault());
    String formattedCurrency = format.format(1000000);
    System.out.println(formattedCurrency);
}

From source file:Main.java

public static void main(String[] args) {

    Locale defaultLocale = Locale.getDefault();
    Locale france = Locale.FRANCE;

    System.out.printf("%s%n", DayOfWeek.MONDAY.minus(401).getDisplayName(TextStyle.SHORT, defaultLocale));
    System.out.printf("%s%n", DayOfWeek.MONDAY.minus(401).getDisplayName(TextStyle.SHORT, france));

}

From source file:Test.java

public static void main(String[] args) {
    Locale locale = Locale.getDefault();
    Calendar calendar = Calendar.getInstance();
    calendar.setWeekDate(2012, 16, 3);//from  w  w  w.j  av a 2  s.  c o  m

    System.out.println(
            DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(calendar.getTime()));
    System.out.println("" + locale.getDisplayLanguage());

    Locale.setDefault(Locale.Category.FORMAT, Locale.JAPANESE);
    Locale.setDefault(Locale.Category.DISPLAY, Locale.GERMAN);

    System.out.println(
            DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(calendar.getTime()));
    System.out.println("" + locale.getDisplayLanguage());

}

From source file:Main.java

public static void main(String[] args) {

    Calendar now = Calendar.getInstance();
    Locale locale = Locale.getDefault();

    String n = now.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.ALL_STYLES, locale);

    System.out.printf(n);/*  w  w w.j  a  v a 2  s  .com*/
}

From source file:Main.java

public static void main(String[] args) {

    Calendar now = Calendar.getInstance();
    Locale locale = Locale.getDefault();

    String n = now.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.SHORT, locale);

    System.out.printf(n);/*from www.  j  a  v a  2s  .  c  om*/
}

From source file:Main.java

public static void main(String[] args) {

    Calendar now = Calendar.getInstance();
    Locale locale = Locale.getDefault();

    String n = now.getDisplayName(Calendar.DAY_OF_WEEK, Calendar.LONG, locale);

    System.out.printf(n);//w ww  . ja v a  2s .  c  o  m
}

From source file:DaysOfTheWeek.java

public static void main(String argv[]) {
    Locale usersLocale = Locale.getDefault();

    DateFormatSymbols dfs = new DateFormatSymbols(usersLocale);
    String weekdays[] = dfs.getWeekdays();

    Calendar cal = Calendar.getInstance(usersLocale);

    int firstDayOfWeek = cal.getFirstDayOfWeek();
    int dayOfWeek;

    for (dayOfWeek = firstDayOfWeek; dayOfWeek < weekdays.length; dayOfWeek++)
        System.out.println(weekdays[dayOfWeek]);

    for (dayOfWeek = 0; dayOfWeek < firstDayOfWeek; dayOfWeek++)
        System.out.println(weekdays[dayOfWeek]);
}

From source file:Main.java

  public static void main(String[] argv) throws Exception {

  ResourceBundle rb = ResourceBundle.getBundle("res.ResourcesDynamic", Locale.getDefault());
  System.out.println(rb.getString("title"));
}