Example usage for java.util Locale setDefault

List of usage examples for java.util Locale setDefault

Introduction

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

Prototype

public static synchronized void setDefault(Locale newLocale) 

Source Link

Document

Sets the default locale for this instance of the Java Virtual Machine.

Usage

From source file:org.jfree.data.time.junit.MinuteTest.java

/**
 * Some checks for the getEnd() method./*from   w w  w .j  a  v  a  2 s  . c  om*/
 */
public void testGetEnd() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/Rome"));
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.JANUARY, 16, 3, 47, 59);
    cal.set(Calendar.MILLISECOND, 999);
    Minute m = new Minute(47, 3, 16, 1, 2006);
    assertEquals(cal.getTime(), m.getEnd());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

From source file:org.jfree.data.time.junit.SecondTest.java

/**
 * Some checks for the getEnd() method./*from www . j ava  2  s . c  o m*/
 */
public void testGetEnd() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55);
    cal.set(Calendar.MILLISECOND, 999);
    Second s = new Second(55, 47, 3, 16, 1, 2006);
    assertEquals(cal.getTime(), s.getEnd());
    Locale.setDefault(saved);
}

From source file:org.jfree.data.time.DayTest.java

/**
 * Some checks for the getStart() method.
 *//* w  ww  . j a  v a 2 s  . c  o  m*/
@Test
public void testGetStart() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.NOVEMBER, 3, 0, 0, 0);
    cal.set(Calendar.MILLISECOND, 0);
    Day d = new Day(3, 11, 2006);
    assertEquals(cal.getTime(), d.getStart());
    Locale.setDefault(saved);
}

From source file:org.apache.jackrabbit.standalone.cli.JcrClient.java

/**
 * Sets the default Locale for the given CommandLine
 * @param cl//from   w  w w . j  a  v  a  2 s .c  om
 *        the CLI <code>CommandLine</code>
 * @throws ParseException
 *         if cl can't be parsed
 */
private void setLocale(org.apache.commons.cli.CommandLine cl) throws ParseException {
    Locale locale = null;
    if (cl.hasOption("lang") && cl.hasOption("country")) {
        locale = new Locale(cl.getOptionValue("lang"), cl.getOptionValue("country"));
    }
    if (cl.hasOption("lang") && !cl.hasOption("country")) {
        locale = new Locale(cl.getOptionValue("lang"));
    }
    if (locale != null) {
        Locale.setDefault(locale);
    }
}

From source file:org.jfree.data.time.MillisecondTest.java

/**
 * Some checks for the getEnd() method./*from   ww w.j a v a2 s  . co m*/
 */
@Test
public void testGetEnd() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.JANUARY, 16, 3, 47, 55);
    cal.set(Calendar.MILLISECOND, 555);
    Millisecond m = new Millisecond(555, 55, 47, 3, 16, 1, 2006);
    assertEquals(cal.getTime(), m.getEnd());
    Locale.setDefault(saved);
}

From source file:org.jfree.data.time.MonthTest.java

/**
 * Some checks for the getStart() method.
 *///  w  w  w  .  j av  a 2s.  co m
@Test
public void testGetStart() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.MARCH, 1, 0, 0, 0);
    cal.set(Calendar.MILLISECOND, 0);
    Month m = new Month(3, 2006);
    assertEquals(cal.getTime(), m.getStart());
    Locale.setDefault(saved);
}

From source file:org.jfree.data.time.junit.HourTest.java

/**
 * Some checks for the getStart() method.
 *//*from ww w  .j a  v a  2s . c  o m*/
public void testGetStart() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(2006, Calendar.JANUARY, 16, 3, 0, 0);
    cal.set(Calendar.MILLISECOND, 0);
    Hour h = new Hour(3, 16, 1, 2006);
    assertEquals(cal.getTime(), h.getStart());
    Locale.setDefault(saved);
}

From source file:org.apache.maven.graph.common.version.SingleVersionComparisonsTest.java

@Test
public void testLocaleIndependent() throws InvalidVersionSpecificationException {
    final Locale orig = Locale.getDefault();
    final Locale[] locales = { Locale.ENGLISH, new Locale("tr"), Locale.getDefault() };
    try {//w  ww .j a  v a2 s . co m
        for (final Locale locale : locales) {
            Locale.setDefault(locale);
            checkVersionsEqual("1-abcdefghijklmnopqrstuvwxyz", "1-ABCDEFGHIJKLMNOPQRSTUVWXYZ");
        }
    } finally {
        Locale.setDefault(orig);
    }
}

From source file:org.jfree.data.time.DayTest.java

/**
 * Some checks for the getEnd() method./*from w  ww  .ja va  2  s .  c  om*/
 */
@Test
public void testGetEnd() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.ITALY);
    Calendar cal = Calendar.getInstance(Locale.ITALY);
    cal.set(1900, Calendar.JANUARY, 1, 23, 59, 59);
    cal.set(Calendar.MILLISECOND, 999);
    Day d = new Day(1, 1, 1900);
    assertEquals(cal.getTime(), d.getEnd());
    Locale.setDefault(saved);
}

From source file:edu.ku.brc.specify.tools.schemalocale.LocalizerApp.java

/**
 * @param args//from  w  w  w.  ja v  a2  s. c o m
 */
public static void main(String[] args) {
    boolean doResCheck = false;
    if (doResCheck) {
        LocalizerApp fd = new LocalizerApp();

        //fd.indexSourceFiles();
        fd.processProperties();

        return;
    }

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            try {
                ResourceBundle.getBundle("resources", Locale.getDefault()); //$NON-NLS-1$

            } catch (MissingResourceException ex) {
                edu.ku.brc.af.core.UsageTracker.incrHandledUsageCount();
                edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(LocalizerApp.class, ex);
                Locale.setDefault(Locale.ENGLISH);
                UIRegistry.setResourceLocale(Locale.ENGLISH);
            }

            LocalizerApp fd = new LocalizerApp();

            fd.indexSourceFiles();
        }
    });

}