Example usage for java.util Locale UK

List of usage examples for java.util Locale UK

Introduction

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

Prototype

Locale UK

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

Click Source Link

Document

Useful constant for country.

Usage

From source file:Main.java

public static void main(String[] args) {
    ResourceBundle resource = ResourceBundle.getBundle("Messages", Locale.UK);

    Properties properties = convertResourceBundleToProperties(resource);

    Enumeration keys = properties.keys();
    while (keys.hasMoreElements()) {
        String key = (String) keys.nextElement();
        String value = (String) properties.get(key);
        System.out.println(key + " = " + value);
    }//from   w ww .  j a v  a2 s.co  m
}

From source file:Main.java

public static void main(String[] args) {
    Month m = Month.from(LocalDate.now());

    System.out.println(m.getDisplayName(TextStyle.SHORT, Locale.UK));

}

From source file:Main.java

public static void main(String[] args) {
    Currency currency = Currency.getInstance(Locale.US);
    System.out.println("United States: " + currency.getSymbol());

    currency = Currency.getInstance(Locale.UK);
    System.out.println("United Kingdom: " + currency.getSymbol());
}

From source file:Main.java

public static void main(String[] args) {
    Currency currency = Currency.getInstance(Locale.JAPAN);
    System.out.println("Currency.getSymbol() = " + currency.getSymbol());

    currency = Currency.getInstance(Locale.UK);
    System.out.println("Currency.getSymbol() = " + currency.getSymbol());

    currency = Currency.getInstance(Locale.US);
    System.out.println("Currency.getSymbol() = " + currency.getSymbol());

    currency = Currency.getInstance(new Locale("in", "ID"));
    System.out.println("Currency.getSymbol() = " + currency.getSymbol());
}

From source file:Main.java

public static void main(String args[]) {
    int style = DateFormat.MEDIUM;
    // Also try with style = DateFormat.FULL and DateFormat.SHORT
    Date date = new Date();
    DateFormat df;//from ww w . ja v  a  2  s  .c  o  m
    df = DateFormat.getDateInstance(style, Locale.UK);
    System.out.println("United Kingdom: " + df.format(date));
    df = DateFormat.getDateInstance(style, Locale.US);
    System.out.println("USA: " + df.format(date));
    df = DateFormat.getDateInstance(style, Locale.FRANCE);
    System.out.println("France: " + df.format(date));
    df = DateFormat.getDateInstance(style, Locale.ITALY);
    System.out.println("Italy: " + df.format(date));
    df = DateFormat.getDateInstance(style, Locale.JAPAN);
    System.out.println("Japan: " + df.format(date));
}

From source file:Main.java

public static void main(String[] args) {
    String s = "tutorial from java2s.com";
    try {//from  w w w.  j av  a2  s. c  om

        PrintWriter pw = new PrintWriter(System.out);

        // printf text with specified locale.
        // %s indicates a string will be placed there, which is s
        pw.printf(Locale.UK, "This is a %s program", s);

        // flush the writer
        pw.flush();

    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:Main.java

public static void main(String[] args) {
    String s = "tutorial from java2s.com";
    try {/* w  w w  .ja va  2s. co  m*/

        PrintWriter pw = new PrintWriter(System.out);

        // format text with specified locale.
        // %s indicates a string will be placed there, which is s
        pw.format(Locale.UK, "This is a %s program", s);

        // flush the writer
        pw.flush();

    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:TimeFormatDemo.java

public static void main(String args[]) {
    Date date = new Date();
    DateFormat df;/* w w w.  j  ava  2 s.c  o m*/

    df = DateFormat.getTimeInstance(DateFormat.SHORT, Locale.JAPAN);
    System.out.println("Japan: " + df.format(date));

    df = DateFormat.getTimeInstance(DateFormat.LONG, Locale.UK);
    System.out.println("United Kingdom: " + df.format(date));

    df = DateFormat.getTimeInstance(DateFormat.FULL, Locale.CANADA);
    System.out.println("Canada: " + df.format(date));
}

From source file:MainClass.java

public static void main(String args[]) {
    Date date = new Date();
    DateFormat df;// w w w  . j  a v  a2 s . c  om

    df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.JAPAN);
    System.out.println("Japan: " + df.format(date));

    df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.KOREA);
    System.out.println("Korea: " + df.format(date));

    df = DateFormat.getDateInstance(DateFormat.LONG, Locale.UK);
    System.out.println("United Kingdom: " + df.format(date));

    df = DateFormat.getDateInstance(DateFormat.FULL, Locale.US);
    System.out.println("United States: " + df.format(date));
}

From source file:MainClass.java

public static void main(String[] args) {
    Date today = new Date();
    Locale[] locales = { Locale.US, Locale.UK, Locale.GERMANY, Locale.FRANCE };

    int[] styles = { DateFormat.FULL, DateFormat.LONG, DateFormat.MEDIUM, DateFormat.SHORT };

    DateFormat fmt;/*from w  w  w .  ja  va2  s .c  om*/
    String[] styleText = { "FULL", "LONG", "MEDIUM", "SHORT" };

    // Output the date for each local in four styles
    for (int i = 0; i < locales.length; i++) {
        System.out.println("\nThe Date for " + locales[i].getDisplayCountry() + ":");
        for (int j = 0; j < styles.length; j++) {
            fmt = DateFormat.getDateInstance(styles[j], locales[i]);
            System.out.println("\tIn " + styleText[j] + " is " + fmt.format(today));
        }
    }
}