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.jbake.app.template.AbstractTemplateEngineRenderingTest.java

@After
public void cleanup() throws InterruptedException {
    db.drop();
    db.close();
    db.shutdown();
    Locale.setDefault(currentLocale);
}

From source file:ch.ralscha.extdirectspring_itest.InfoServiceTest.java

@Test
public void testUpdateInfoUser4() throws IOException {
    Locale.setDefault(Locale.US);
    testUserPost("updateInfoUser4", "Wrong E-Mail", entry("lc", "ralph"), entry("success", Boolean.TRUE));
}

From source file:org.mozilla.gecko.tests.testDistribution.java

private void setOSLocale(Locale locale) {
    Locale.setDefault(locale);
    BrowserLocaleManager.storeAndNotifyOSLocale(GeckoSharedPrefs.forProfile(mActivity), locale);
}

From source file:ch.ralscha.extdirectspring_itest.InfoServiceTest.java

@Test
public void testUpdateInfoUser5() throws IOException {
    Locale.setDefault(Locale.US);
    testUserPost("updateInfoUser5", "Wrong E-Mail", entry("lc", "ralph"), entry("success", Boolean.FALSE));
}

From source file:org.openhab.binding.ntp.test.NtpOSGiTest.java

@AfterClass
public static void tearDownClass() {
    // Stopping the local time server
    timeServer.stopServer();/* www  .  j a  v  a2 s. c o  m*/
    // Set the default time zone and locale to their initial value.
    TimeZone.setDefault(systemTimeZone);
    Locale.setDefault(locale);
}

From source file:ly.count.android.api.DeviceInfoTests.java

public void testGetLocale() {
    final Locale defaultLocale = Locale.getDefault();
    try {//  ww  w .  j a  v  a2 s  .c  o  m
        Locale.setDefault(new Locale("ab", "CD"));
        assertEquals("ab_CD", DeviceInfo.getLocale());
    } finally {
        Locale.setDefault(defaultLocale);
    }
}

From source file:de.mpg.escidoc.pubman.util.InternationalizationHelper.java

public void changeLanguage(ValueChangeEvent event) {
    FacesContext fc = FacesContext.getCurrentInstance();
    if (event.getOldValue() != null && !event.getOldValue().equals(event.getNewValue())) {
        Locale locale = null;//from   w w  w . j av  a 2 s .  co m
        String language = event.getNewValue().toString();
        String country = language.toUpperCase();
        this.locale = language;
        try {
            locale = new Locale(language, country);
            fc.getViewRoot().setLocale(locale);
            Locale.setDefault(locale);
            userLocale = locale;
            homeContent = "n/a";

            notifyLanguageChanged(event.getOldValue().toString(), event.getNewValue().toString());
            ;
            logger.debug("New locale: " + language + "_" + country + " : " + locale);
        } catch (Exception e) {
            logger.error(
                    "unable to switch to locale using language = " + language + " and country = " + country, e);
        }
        if (language.equals("de")) {
            selectedHelpPage = HELP_PAGE_DE;
        } else {
            selectedHelpPage = HELP_PAGE_EN;
        }
    }
}

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

/**
 * Some checks for the getFirstMillisecond() method.
 *///from  w  w  w .ja va 2  s . c om
@Test
public void testGetFirstMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Millisecond m = new Millisecond(500, 15, 43, 15, 1, 4, 2006);
    assertEquals(1143902595500L, m.getFirstMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

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

/**
 * Some checks for the getFirstMillisecond() method.
 *///from  w  ww  .  j  a  v a 2  s.c  o m
public void testGetFirstMillisecond() {
    Locale saved = Locale.getDefault();
    Locale.setDefault(Locale.UK);
    TimeZone savedZone = TimeZone.getDefault();
    TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));
    Minute m = new Minute(43, 15, 1, 4, 2006);
    assertEquals(1143902580000L, m.getFirstMillisecond());
    Locale.setDefault(saved);
    TimeZone.setDefault(savedZone);
}

From source file:es.uvigo.ei.sing.laimages.core.entities.datasets.VerticalElementDataTest.java

@Test
public void testVerticalElementDataToCSVVWithLibreOfficeFormatES() throws IOException {
    Locale.setDefault(new Locale("es", "ES"));

    File exportFile = exportElementToTmpCSVFile(TEST_ELEMENT_DATA_VERTICAL, FileFormat.LIBRE_OFFICE);

    assertTrue(FileUtils.contentEquals(TEST_ELEMENT_DATA_VERTICAL_LIBRE_OFFICE_ES, exportFile));
}