List of usage examples for java.util Locale setDefault
public static synchronized void setDefault(Locale newLocale)
From source file:org.jfree.data.time.YearTest.java
/** * Some checks for the getLastMillisecond() method. */// w w w . ja v a 2 s . c o m @Test public void testGetLastMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Year y = new Year(1970); // TODO: Check this result... assertEquals(31532399999L, y.getLastMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:org.jfree.data.time.junit.MonthTest.java
/** * Some checks for the getFirstMillisecond() method. *//* www.j a v a 2 s .c om*/ public void testGetFirstMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Month m = new Month(3, 1970); assertEquals(5094000000L, m.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:org.jfree.data.time.junit.DayTest.java
/** * Some checks for the getFirstMillisecond() method. *///from w w w . ja 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")); Day d = new Day(1, 3, 1970); assertEquals(5094000000L, d.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }
From source file:org.pentaho.reporting.engine.classic.core.testsupport.gold.GoldTestBase.java
@Before public void setUp() throws Exception { Locale.setDefault(Locale.US); TimeZone.setDefault(TimeZone.getTimeZone("UTC")); // enforce binary compatibility for the xml-files so that comparing them can be faster. ClassicEngineBoot.getInstance().start(); if (NamingManager.hasInitialContextFactoryBuilder() == false) { NamingManager.setInitialContextFactoryBuilder(new DebugJndiContextFactoryBuilder()); }//from www .ja va2 s .c o m localFontRegistry = new LocalFontRegistry(); localFontRegistry.initialize(); }
From source file:org.jfree.data.time.WeekTest.java
/** * A test case for bug 1448828.//from www . j av a2 s . co m */ @Test public void testBug1448828() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); try { Week w = new Week(new Date(1136109830000l), TimeZone.getTimeZone("GMT")); assertEquals(2005, w.getYearValue()); assertEquals(52, w.getWeek()); } finally { Locale.setDefault(saved); } }
From source file:org.eclipse.wb.internal.core.nls.NlsSupport.java
/** * If user chosen {@link Locale}, then set it as default during refresh. *//*www.j av a 2 s .c om*/ private void setDefaultLocaleDuringRefresh() { m_root.addBroadcastListener(new ObjectEventListener() { private Locale m_oldDefaultLocale; @Override public void refreshBeforeCreate() throws Exception { LocaleInfo localeInfo = AbstractSource.getLocaleInfo(m_root); if (localeInfo != null) { Locale locale = localeInfo.getLocale(); if (locale != null) { m_oldDefaultLocale = Locale.getDefault(); Locale.setDefault(locale); } } } @Override public void refreshFinallyRefresh() { if (m_oldDefaultLocale != null) { Locale.setDefault(m_oldDefaultLocale); m_oldDefaultLocale = null; } } }); }
From source file:net.sourceforge.squirrel_sql.client.Application.java
/** * Application is starting up./*from w w w .ja va2s . co m*/ */ public void startup() { final ApplicationArguments args = ApplicationArguments.getInstance(); // Setup the applications Look and Feel. setupLookAndFeel(args); editWhereCols.setApplication(this); // TODO: Make properties file Application.properties so we can use class // name to generate properties file name. _resources = new SquirrelResources(SquirrelResources.BUNDLE_BASE_NAME); _prefs = SquirrelPreferences.load(); _desktopStyle = new DesktopStyle(_prefs); Locale.setDefault(constructPreferredLocale(_prefs)); preferencesHaveChanged(null); _prefs.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { preferencesHaveChanged(evt); } }); SquirrelSplashScreen splash = null; if (args.getShowSplashScreen()) { splash = new SquirrelSplashScreen(_prefs, 17); } executeStartupTasks(splash, args); }
From source file:com.amagi82.kerbalspaceapp.Settings.java
@Override public void onConfigurationChanged(Configuration config) { super.onConfigurationChanged(config); if (language == null) { language = Locale.getDefault(); } else if (!config.locale.equals(language) && !Locale.getDefault().equals(language)) { config.locale = language;// w w w . ja va2 s .c o m Locale.setDefault(config.locale); getBaseContext().getResources().updateConfiguration(config, getResources().getDisplayMetrics()); recreate(); } Log.i(null, "language = " + language); }
From source file:com.android.projectz.teamrocket.thebusapp.activities.SplashScreenActivity.java
/** * Metodo che prende la lingua di sistema o quella delle SharedPreferences a seconda * della tipologia di avvio dell'app (se la prima volta quella di sistema, se non la * prima volta allora prende quella delle sharedpreferences) *//*ww w . j a va 2 s . co m*/ private void setLanguage(String type) { Locale language = null; if (type.equals("system")) { language = Locale.getDefault(); SharedPreferencesUtils.setSelectedLanguage(this, Locale.getDefault().getLanguage()); } else if (type.equals("local")) { String languageToLoad = SharedPreferencesUtils.getSelectedLanguage(this); language = new Locale(languageToLoad); Locale.setDefault(language); } Configuration config = new Configuration(); config.locale = language; getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics()); }
From source file:org.jfree.data.time.junit.MillisecondTest.java
/** * Some checks for the getLastMillisecond() method. *//*ww w . j ava 2 s .c o m*/ public void testGetLastMillisecond() { Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Millisecond m = new Millisecond(750, 1, 1, 1, 1, 1, 1970); assertEquals(61750L, m.getLastMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone); }