Example usage for java.util Locale CANADA

List of usage examples for java.util Locale CANADA

Introduction

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

Prototype

Locale CANADA

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

Click Source Link

Document

Useful constant for country.

Usage

From source file:Main.java

public static void main(String[] args) {
    LocalDate localDate = LocalDate.of(2014, Month.JUNE, 21);
    DayOfWeek dayOfWeek = DayOfWeek.from(localDate);
    System.out.println(dayOfWeek.getDisplayName(TextStyle.FULL, Locale.CANADA));
    System.out.println(dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.CANADA));
    System.out.println(dayOfWeek.getDisplayName(TextStyle.NARROW, Locale.CANADA));
}

From source file:TimeFormatDemo.java

public static void main(String args[]) {
    Date date = new Date();
    DateFormat df;//w w  w . j a  v a2 s . co  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:RBCPTest.java

public static void main(String[] args) {
    ResourceBundle rb = ResourceBundle.getBundle("resources.XmlRB", Locale.ROOT);
    String type = rb.getString("type");
    System.out.println("Root locale. Key, type: " + type);
    System.out.println();/*from w w w.  j  av a 2  s.  c  om*/

    rb = ResourceBundle.getBundle("resources.XmlRB", Locale.JAPAN);
    type = rb.getString("type");
    System.out.println("Japan locale. Key, type: " + type);
    System.out.println();

    test(Locale.CHINA);
    test(new Locale("zh", "HK"));
    test(Locale.TAIWAN);
    test(Locale.CANADA);
}

From source file:Main.java

public static String convertToCurrency(float value) {
    DecimalFormat format = new DecimalFormat("#.##");
    try {/*from  www.jav a2 s  . c  om*/
        value = Float.parseFloat(format.format(value));
    } catch (Exception e) {
        e.printStackTrace();
    }
    NumberFormat defaultFormat = NumberFormat.getCurrencyInstance(Locale.CANADA);
    return defaultFormat.format(value);
}

From source file:Main.java

public static String getTOSLink() {
    String link = "http://m.google.com/toscountry"; // default

    String locale = Locale.getDefault().toString();
    if (locale.equals(Locale.US.toString())) {
        link = "http://m.google.com/tospage";
    } else if (locale.equals(Locale.UK.toString())) {
        link = "http://m.google.co.uk/tospage";
    } else if (locale.equals(Locale.CANADA.toString())) {
        link = "http://m.google.ca/tospage";
    } else if (locale.equals(Locale.CANADA_FRENCH.toString())) {
        link = "http://m.google.ca/tospage?hl=fr";
    } else if (locale.equals(Locale.FRANCE.toString())) {
        link = "http://m.google.fr/tospage";
    }//from  ww w . j av  a  2 s . c  om
    return link;
}

From source file:Main.java

/**
 * This method returns a date string formatted in MMM d, yyyy
 * @param date//  www  .  java2 s  . co m
 * @return date string
 */
public static String formatDate(Date date) {
    SimpleDateFormat sdf = new SimpleDateFormat("MMM d, yyyy", Locale.CANADA);
    return sdf.format(date);
}

From source file:com.gettextresourcebundle.GettextResourceBundleControlTest.java

/**
 * test that the controls picks up PO files by locale
 * from the classpath//from   w  w w. j a  va  2  s  .  c  o m
 */
@Test
public void testClasspathReads() {
    ResourceBundle en_US = ResourceBundle.getBundle("locale", Locale.US,
            GettextResourceBundleControl.getControl("test"));
    assertEquals("The locale key should be en_US for the en_US locale", en_US.getString("locale"), "en_US");

    ResourceBundle en_CA = ResourceBundle.getBundle("locale", Locale.CANADA,
            GettextResourceBundleControl.getControl("test"));
    assertEquals("The locale key should be en_CA for the en_CA locale", en_CA.getString("locale"), "en_CA");
}

From source file:com.mc.Circle.java

@Override
public void draw() {
    System.out.println("Circle Drawn: " + getCenter().getX() + ", " + getCenter().getY());
    System.out.println(this.messageSource.getMessage("greeting", null, "Default greeting", Locale.CANADA));
    System.out// w w  w. j av a2s . c o  m
            .println(this.messageSource.getMessage("drawing.circle", null, "Default greeting", Locale.CANADA));
    System.out.println(this.messageSource.getMessage("drawing.point",
            new Object[] { center.getX(), center.getY() }, "Default point greeting", Locale.CANADA));
    DrawEvent drawEvent = new DrawEvent(this);
    publisher.publishEvent(drawEvent);
}

From source file:org.pdfsam.support.LocaleKeyValueItemTest.java

@Test
public void equalsAndHashCodes() {
    LocaleKeyValueItem eq1 = new LocaleKeyValueItem(Locale.CANADA);
    LocaleKeyValueItem eq2 = new LocaleKeyValueItem(Locale.CANADA);
    LocaleKeyValueItem eq3 = new LocaleKeyValueItem(Locale.CANADA);
    LocaleKeyValueItem diff = new LocaleKeyValueItem(Locale.CHINA);
    TestUtils.testEqualsAndHashCodes(eq1, eq2, eq3, diff);
}

From source file:com.gettextresourcebundle.GettextResourceBundleControlTest.java

/**
 * test that the controls picks up PO files by locale
 * from the filesystem//from  w  ww  .j  ava 2 s.c  o  m
 */
@Test
public void testFileReads() {
    ResourceBundle en_US = ResourceBundle.getBundle("./src/test/resources/locale", Locale.US,
            GettextResourceBundleControl.getControl("test"));
    assertEquals("The locale key should be en_US for the en_US locale", en_US.getString("locale"), "en_US");

    ResourceBundle en_CA = ResourceBundle.getBundle("./src/test/resources/locale", Locale.CANADA,
            GettextResourceBundleControl.getControl("test"));
    assertEquals("The locale key should be en_CA for the en_CA locale", en_CA.getString("locale"), "en_CA");
}