Example usage for java.util Locale GERMAN

List of usage examples for java.util Locale GERMAN

Introduction

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

Prototype

Locale GERMAN

To view the source code for java.util Locale GERMAN.

Click Source Link

Document

Useful constant for language.

Usage

From source file:Main.java

public static void main(String[] args) {
    Locale locale = Locale.GERMAN;

    System.out.println("Locale1:" + locale);

    // print the country of this locale
    System.out.println("Country:" + locale.getCountry());

}

From source file:Main.java

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

    Locale locale = Locale.GERMAN;
    String string = NumberFormat.getNumberInstance(locale).format(-1234.56);
    System.out.println(string);//from ww  w  .  j a  v a2s. c  om
}

From source file:Main.java

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

    Number number = NumberFormat.getNumberInstance(Locale.GERMAN).parse("-1.234,56");
    if (number instanceof Long) {
        System.out.println("Long value");
    } else {/*from   w  w  w  .  j a  va2 s . c o  m*/
        System.out.println("Double value");
    }
}

From source file:FormatDateLocale.java

public static void main(String[] args) {
    Locale[] locales = new Locale[] { Locale.JAPAN, Locale.CHINA, Locale.KOREA, Locale.TAIWAN, Locale.ITALY,
            Locale.FRANCE, Locale.GERMAN };

    Date today = new Date();

    for (Locale locale : locales) {
        System.out.println("Date format in " + locale.getDisplayName() + " = "
                + SimpleDateFormat.getDateInstance(SimpleDateFormat.LONG, locale).format(today).toUpperCase());
    }// w  w w.  ja v  a  2s  . c  o  m
}

From source file:Main.java

public static void main(String... args) {
    DateTimeFormatter germanFormatter = DateTimeFormatter.ofLocalizedTime(FormatStyle.SHORT)
            .withLocale(Locale.GERMAN);

    LocalTime leetTime = LocalTime.parse("13:37", germanFormatter);
    System.out.println(leetTime);

}

From source file:Main.java

public static void main(String... args) {
    DateTimeFormatter germanFormatter = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM)
            .withLocale(Locale.GERMAN);

    LocalDate xmas = LocalDate.parse("24.12.2014", germanFormatter);
    System.out.println(xmas);/*from www. ja  va  2s.  c  om*/

}

From source file:DisplayCountryOutput.java

public static void main(String[] argv) {

    Locale defaultLocale = Locale.getDefault();
    System.out.println(defaultLocale.getISO3Country());
    System.out.println(defaultLocale.getDisplayCountry());
    System.out.println(defaultLocale.getDisplayCountry(Locale.GERMAN));
}

From source file:Main.java

public static void main(String args[]) {
    Formatter fmt = new Formatter();
    Calendar cal = Calendar.getInstance();
    fmt = new Formatter();
    fmt.format("Default locale: %tc\n", cal);

    fmt.format(Locale.GERMAN, "For Locale.GERMAN: %tc\n", cal);
    fmt.format(Locale.ITALY, "For Locale.ITALY: %tc\n", cal);
    fmt.format(Locale.FRANCE, "For Locale.FRANCE: %tc\n", cal);
    System.out.println(fmt);/* w  ww.jav a2  s  . c om*/
}

From source file:Test.java

public static void main(String[] args) {
    Set<Currency> currencies = Currency.getAvailableCurrencies();
    for (Currency currency : currencies) {
        System.out.println("" + currency.getDisplayName() + " - " + currency.getDisplayName(Locale.GERMAN)
                + " - " + currency.getNumericCode());
    }/*from   www  .j a  v a  2s.  c o  m*/

}

From source file:RBPropDemo.java

public static void main(String[] args) {
    ResourceBundle.clearCache();/*w ww .  j a va2s.  c  o m*/
    String bundleName = "myproj.MyResources";

    ResourceBundle myResources = ResourceBundle.getBundle(bundleName, Locale.GERMAN);

    System.out.println("Key's values:");
    System.out.println(myResources.getString("okKey"));
    System.out.println(myResources.getString("cancelKey"));
    System.out.println(myResources.getString("submitKey"));
    System.out.println("\nChecking okKey in resource bundle:");
    if (myResources.containsKey("okKey")) {
        System.out.println("okKey exists! " + " Value = " + myResources.getString("okKey"));
    } else {
        System.out.println("The key Doesn't Exist");
    }

    System.out.println("\nGet a set of keys:");
    Set<String> keySet = myResources.keySet();
    Object[] keys = keySet.toArray();
    for (int i = 0; i < keys.length; i++) {
        System.out.println("Key " + (i + 1) + " = " + keys[i]);
    }
}