List of usage examples for java.util Locale setDefault
public static synchronized void setDefault(Locale newLocale)
From source file:org.camelcookbook.transformation.csv.CsvSpringTest.java
@Override public void doPreSetup() throws Exception { super.doPreSetup(); Locale.setDefault(Locale.US); }
From source file:ca.nines.ise.cmd.Works.java
/** * {@inheritDoc}/*from w ww .j a va 2 s.c om*/ */ @Override public void execute(CommandLine cmd) throws Exception { Corpus corpus; String root = "input"; Locale.setDefault(Locale.ENGLISH); PrintStream out = new PrintStream(System.out, true, "UTF-8"); if (cmd.hasOption("l")) { out = new PrintStream(new FileOutputStream(cmd.getOptionValue("l")), true, "UTF-8"); } corpus = new Corpus(root); out.println(corpus); }
From source file:com.iflytek.edu.cloud.frame.InitializingService.java
@Override public void afterPropertiesSet() throws Exception { //hibernate validator Locale.setDefault(Locale.SIMPLIFIED_CHINESE); ResourceBundleMessageSource bundleMessageSource = new ResourceBundleMessageSource(); bundleMessageSource.setBasenames(I18N_ROP_ERROR); LOGGER.info("?" + I18N_ROP_ERROR); MessageSourceAccessor messageSourceAccessor = new MessageSourceAccessor(bundleMessageSource); MainErrors.setErrorMessageSourceAccessor(messageSourceAccessor); SubErrors.setErrorMessageSourceAccessor(messageSourceAccessor); }
From source file:org.esa.beam.util.math.FastMathPerformance.java
@BeforeClass public static void header() { Locale.setDefault(Locale.ENGLISH); System.out.println(String.format(FMT_HDR, "Name", "Math", "StrictMath", "FastMath", RUNS, System.getProperty("java.version"), System.getProperty("java.runtime.version", "?"), System.getProperty("java.vm.name"), System.getProperty("java.vm.version"))); }
From source file:com.examples.with.different.packagename.StringUtilsEqualsIndexOfTest.java
@Test public void testContainsIgnoreCase_LocaleIndependence() { final Locale[] locales = { Locale.ENGLISH, new Locale("tr"), Locale.getDefault() }; final String[][] tdata = { { "i", "I" }, { "I", "i" }, { "\u03C2", "\u03C3" }, { "\u03A3", "\u03C2" }, { "\u03A3", "\u03C3" }, }; final String[][] fdata = { { "\u00DF", "SS" }, }; for (final Locale testLocale : locales) { Locale.setDefault(testLocale); for (int j = 0; j < tdata.length; j++) { assertTrue(Locale.getDefault() + ": " + j + " " + tdata[j][0] + " " + tdata[j][1], StringUtils.containsIgnoreCase(tdata[j][0], tdata[j][1])); }/*w w w. j a v a2s .c o m*/ for (int j = 0; j < fdata.length; j++) { assertFalse(Locale.getDefault() + ": " + j + " " + fdata[j][0] + " " + fdata[j][1], StringUtils.containsIgnoreCase(fdata[j][0], fdata[j][1])); } } }
From source file:com.cburch.logisim.util.LocaleManager.java
public static void setLocale(Locale loc) { Locale cur = getLocale();/*from w ww . j a v a 2 s. co m*/ if (!loc.equals(cur)) { Locale[] opts = LocaleString.getUtilLocaleManager().getLocaleOptions(); Locale select = null; Locale backup = null; String locLang = loc.getLanguage(); for (Locale opt : opts) { if (select == null && opt.equals(loc)) { select = opt; } if (backup == null && opt.getLanguage().equals(locLang)) { backup = opt; } } if (select == null) { if (backup == null) { select = new Locale("en"); } else { select = backup; } } curLocale = select; Locale.setDefault(select); for (LocaleManager man : managers) { man.loadDefault(); } repl = replaceAccents ? fetchReplaceAccents() : null; fireLocaleChanged(); } }
From source file:nz.co.senanque.sandbox.LocaleTest.java
@Test public void testValidate() { Locale locale = new Locale("fr"); Locale.setDefault(locale); String t = MessageFormat.format( "chec de l''envoi: label = {0} n''est pas une adresse email valide, a tent = {1}", new Object[] { "aa", "bb" }); assertEquals("chec de l'envoi: label = aa n'est pas une adresse email valide, a tent = bb", t); }
From source file:ca.nines.ise.cmd.Fragment.java
/** * {@inheritDoc}//www.ja va2 s . co m */ @Override public void execute(CommandLine cmd) throws Exception { PrintStream out; Writer renderer; Locale.setDefault(Locale.ENGLISH); out = new PrintStream(System.out, true, "UTF-8"); renderer = new SGMLWriter(out); String[] files = getArgList(cmd); if (files.length == 0) { System.err.println("At least one document is required."); System.exit(-1); } DOM dom = new DOMBuilder(new File(files[0])).build(); if (dom.getStatus() == DOMStatus.ERROR) { System.err.println("Document contains errors. Cannot continue."); System.exit(-1); } int length = 2; if (cmd.hasOption("n")) { length = Integer.parseInt(cmd.getOptionValue("n")); } String tln = "1"; if (cmd.hasOption("tln")) { tln = cmd.getOptionValue("tln"); } dom = dom.getTlnFragment(tln, length); renderer.render(dom); }
From source file:com.fmguler.ven.LiquibaseUtil.java
/** * Undo all changes in the test database *///from w ww. j ava 2 s . c om public static void rollbackDatabase(String tag) { try { Locale currLocale = Locale.getDefault(); Locale.setDefault(Locale.ENGLISH); Database database = DatabaseFactory.getInstance() .findCorrectDatabaseImplementation(getDataSource().getConnection()); Liquibase liquibase = new Liquibase("etc/test-db/test-db-changelog.xml", new FileSystemFileOpener(), database); liquibase.rollback(tag, ""); Locale.setDefault(currLocale); } catch (SQLException ex) { ex.printStackTrace(); } catch (JDBCException ex) { ex.printStackTrace(); } catch (LiquibaseException ex) { ex.printStackTrace(); } }
From source file:ca.nines.ise.cmd.Abbrs.java
/** * {@inheritDoc}//from w ww . j av a 2 s . c o m */ @Override public void execute(CommandLine cmd) throws Exception { File[] files; Locale.setDefault(Locale.ENGLISH); PrintStream out = new PrintStream(System.out, true, "UTF-8"); if (cmd.hasOption("l")) { out = new PrintStream(new FileOutputStream(cmd.getOptionValue("l")), true, "UTF-8"); } files = getFilePaths(cmd); Formatter formatter = new Formatter(out); if (files != null) { out.println("Found " + files.length + " files to check."); for (File in : files) { DOM dom = new DOMBuilder(in).build(); for (Node n : dom) { if (n.type() == NodeType.ABBR) { formatter.format("%s:%d:%d%n", n.getSource(), n.getLine(), n.getColumn()); formatter.format(" near TLN %s%n", n.getTLN()); formatter.format(" %s%n", n.getText().substring(0, Math.min(64, n.getText().length()))); formatter.format(" %s%n", dom.getLine(n.getLine() - 1)); formatter.format("%n"); } } } } }