List of usage examples for java.util Locale FRANCE
Locale FRANCE
To view the source code for java.util Locale FRANCE.
Click Source Link
From source file:org.openmrs.contrib.metadatarepository.util.DateConverterTest.java
public void testInternationalization() throws Exception { final List<Locale> locales = new ArrayList<Locale>() { private static final long serialVersionUID = 1L; {//from www. j a v a 2s. c om add(Locale.US); add(Locale.GERMANY); add(Locale.FRANCE); add(Locale.CHINA); add(Locale.ITALY); } }; for (final Locale locale : locales) { LocaleContextHolder.setLocale(locale); testConvertStringToDate(); testConvertDateToString(); testConvertStringToTimestamp(); testConvertTimestampToString(); } }
From source file:org.openhie.openempi.util.ConvertUtilTest.java
public void testGetInternationalDatePattern() { LocaleContextHolder.setLocale(new Locale("nl")); assertEquals("dd-MMM-yyyy", DateUtil.getDatePattern()); LocaleContextHolder.setLocale(Locale.FRANCE); assertEquals("dd/MM/yyyy", DateUtil.getDatePattern()); LocaleContextHolder.setLocale(Locale.GERMANY); assertEquals("dd.MM.yyyy", DateUtil.getDatePattern()); // non-existant bundle should default to default locale LocaleContextHolder.setLocale(new Locale("fi")); String fiPattern = DateUtil.getDatePattern(); LocaleContextHolder.setLocale(Locale.getDefault()); String defaultPattern = DateUtil.getDatePattern(); assertEquals(defaultPattern, fiPattern); }
From source file:com.gisgraphy.util.DateUtilTest.java
@Test public void testGetInternationalDatePattern() { LocaleContextHolder.setLocale(new Locale("nl")); assertEquals("dd-MMM-yyyy", DateUtil.getDatePattern()); LocaleContextHolder.setLocale(Locale.FRANCE); assertEquals("dd/MM/yyyy", DateUtil.getDatePattern()); LocaleContextHolder.setLocale(Locale.GERMANY); assertEquals("dd.MM.yyyy", DateUtil.getDatePattern()); // non-existant bundle should default to default locale LocaleContextHolder.setLocale(new Locale("fi")); String fiPattern = DateUtil.getDatePattern(); LocaleContextHolder.setLocale(Locale.getDefault()); String defaultPattern = DateUtil.getDatePattern(); assertEquals(defaultPattern, fiPattern); }
From source file:logic.Export.java
public boolean convertXls() throws IOException, FileNotFoundException, IllegalArgumentException, ParseException { FileInputStream tamplateFile = new FileInputStream(templatePath); XSSFWorkbook workbook = new XSSFWorkbook(tamplateFile); CellStyle cellStyle = workbook.createCellStyle(); cellStyle.setDataFormat(workbook.getCreationHelper().createDataFormat().getFormat("#,##")); double hours = 0.0; NumberFormat format = NumberFormat.getInstance(Locale.FRANCE); Number number;/*from w w w. j a v a2 s. co m*/ XSSFSheet sheet; XSSFSheet sheet2; Cell cell = null; ConvertData cd = new ConvertData(); for (int i = 0; i < cd.getSheetnames().size(); i++) { sheet2 = workbook.cloneSheet(0, cd.sheetnames.get(i)); sheet = workbook.getSheetAt(i + 1); //formate sheets sheet.getPrintSetup().setLandscape(true); sheet.getPrintSetup().setPaperSize(HSSFPrintSetup.A4_PAPERSIZE); cell = sheet.getRow(0).getCell(1); cell.setCellValue(cd.sheetnames.get(i)); ArrayList<String[]> convert = cd.convert(cd.sheetnames.get(i)); //setPrintArea workbook.setPrintArea(i + 1, //sheet index 0, //start column Spalte 6, //end column 0, //start row zeile convert.size() + 8 //end row ); for (int Row = 0; Row < convert.size(); Row++) { for (int Cell = 0; Cell < convert.get(Row).length; Cell++) { cell = sheet.getRow(9 + Row).getCell(Cell); if (Cell == 3) { if ("true".equals(convert.get(Row)[Cell])) { XSSFCellStyle style1 = workbook.createCellStyle(); style1 = (XSSFCellStyle) cell.getCellStyle(); style1 = (XSSFCellStyle) style1.clone(); style1.setFillBackgroundColor(HSSFColor.RED.index); style1.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND); XSSFColor myColor = new XSSFColor(Color.RED); style1.setFillForegroundColor(myColor); sheet.getRow(9 + Row).getCell(6).setCellStyle(style1); } } else { cell.setCellValue(convert.get(Row)[Cell]); } } } } workbook.removeSheetAt(0); tamplateFile.close(); File exportFile = newPath.getSelectedFile(); if (FilenameUtils.getExtension(exportFile.getName()).equalsIgnoreCase("xlsx")) { } else { exportFile = new File(exportFile.getParentFile(), FilenameUtils.getBaseName(exportFile.getName()) + ".xlsx"); } FileOutputStream outFile = new FileOutputStream(exportFile); workbook.write(outFile); outFile.close(); tamplateFile.close(); return true; }
From source file:org.glenans.extractor.model.StageTest.java
/** * Test of getName method, of class Stage. *///from ww w .jav a 2s . c o m public void testconvertStringToDate() { System.out.println( "convertStringToDate in a static way, I know it's bad but it's just to illustrate how to Unit Test"); Date date = Stage.convertStringToDate(""); assertTrue(date == null); date = Stage.convertStringToDate("04/10/15"); Date date1 = Stage.convertStringToDate("18/07/15 15H00"); Date date2 = Stage.convertStringToDate("24/07/15 17H00"); Date date3 = Stage.convertStringToDate("01/08/15 15H00"); Date date4 = Stage.convertStringToDate("7/08/15 17H00"); Date date5 = Stage.convertStringToDate("7/08/15 17H01"); Date date6 = Stage.convertStringToDate("07/08/15 17H01"); Date date7 = Stage.convertStringToDate("07/8/15 17H01"); Date date8 = Stage.convertStringToDate("7/8/15 17H01"); Date date9 = Stage.convertStringToDate("12/09/15 14h30"); // System.out.println(new SimpleDateFormat(Stage.DATE_PATTERN_OUTPUT, Locale.FRANCE).format(null)); System.out.println(new SimpleDateFormat(Stage.DATE_PATTERN_OUTPUT, Locale.FRANCE).format(date)); System.out.println(new SimpleDateFormat(Stage.DATE_PATTERN_OUTPUT, Locale.FRANCE).format(date1)); System.out.println(new SimpleDateFormat(Stage.DATE_PATTERN_OUTPUT, Locale.FRANCE).format(date2)); System.out.println(new SimpleDateFormat(Stage.DATE_PATTERN_OUTPUT, Locale.FRANCE).format(date3)); System.out.println(new SimpleDateFormat(Stage.DATE_PATTERN_OUTPUT, Locale.FRANCE).format(date4)); System.out.println(new SimpleDateFormat(Stage.DATE_PATTERN_OUTPUT, Locale.FRANCE).format(date5)); System.out.println(new SimpleDateFormat(Stage.DATE_PATTERN_OUTPUT, Locale.FRANCE).format(date6)); System.out.println(new SimpleDateFormat(Stage.DATE_PATTERN_OUTPUT, Locale.FRANCE).format(date7)); System.out.println(new SimpleDateFormat(Stage.DATE_PATTERN_OUTPUT, Locale.FRANCE).format(date8)); System.out.println(new SimpleDateFormat(Stage.DATE_PATTERN_OUTPUT, Locale.FRANCE).format(date9)); // Test conversion is OK assertNotNull(date); assertNotNull(date1); assertNotNull(date2); assertNotNull(date3); assertNotNull(date4); assertNotNull(date5); assertNotNull(date6); assertNotNull(date7); assertNotNull(date8); assertNotNull(date9); assertEquals(new SimpleDateFormat(Stage.DATE_PATTERN_OUTPUT, Locale.FRANCE).format(date), "04/10/15 00:00"); // assertEquals(new SimpleDateFormat(Stage.DATE_PATTERN_OUTPUT, Locale.FRANCE).format(date1),"04/10/15 00:00"); //18/07/15 15:00 //24/07/15 17:00 //01/08/15 15:00 //07/08/15 17:00 //07/08/15 17:01 //07/08/15 17:01 //07/08/15 17:01 //07/08/15 17:01 //12/09/15 14:30 // test date is the same but time is not assertTrue(DateUtils.isSameDay(date4, date5)); assertFalse(DateUtils.isSameInstant(date4, date5)); // Comparison test assertTrue(date1.before(date2)); // Comparison Date with different format on day assertTrue(DateUtils.isSameInstant(date6, date5)); assertTrue(DateUtils.isSameInstant(date7, date5)); assertTrue(DateUtils.isSameInstant(date8, date5)); }
From source file:org.mayocat.configuration.internal.ConfigurationJsonMergerTest.java
@Test public void testConfigurationMerge() throws Exception { Map<String, Serializable> generalConfiguration = getConfiguration(defaultConfiguration); Map<String, Serializable> tenantConfiguration = loadConfiguration("configuration/tenant1.json"); ConfigurationJsonMerger merger = new ConfigurationJsonMerger(generalConfiguration, tenantConfiguration); Map<String, Serializable> merged = merger.merge(); Assert.assertEquals(Locale.FRANCE.toString(), ((Map<String, Object>) ((Map<String, Object>) merged.get("locales")).get("main")).get("value")); }
From source file:fr.paris.lutece.plugins.grusupply.service.GruSupplyPlugin.java
/** * {@inheritDoc}//w w w . jav a2 s. c om */ @Override public void init() { BeanUtilsBean.getInstance().getConvertUtils().register( new DateConverter(DateFormat.getDateInstance(DateFormat.SHORT, Locale.FRANCE)), java.sql.Date.class); }
From source file:com.zestedesavoir.zestwriter.utils.Configuration.java
/** * Class constructor/*www.ja va 2 s . c o m*/ * @param homeDir Absolute path of home directory */ public Configuration(String homeDir) { String appName = "zestwriter"; String confDirPath = homeDir + File.separator + "." + appName; File confDir = new File(confDirPath); if (!confDir.exists()) { if (!confDir.mkdir()) { log.error("Le rpertoire de configuration n'a pas pu tre cre"); } else { log.info("Le rpertoire de configuration a t cre avec succs"); } } initConf(confDirPath); initActions(); try { bundle = ResourceBundle.getBundle("locales/ui", Lang.getLangFromCode(getDisplayLang()).getLocale()); } catch (Exception e) { bundle = ResourceBundle.getBundle("locales/ui", Locale.FRANCE); log.error("Impossible de charger la langue " + getDisplayLang(), e); } }
From source file:org.mayocat.configuration.internal.ValidConfigurationEnforcerTest.java
@Test public void testEnforceValidConfiguration() throws Exception { Map<String, Serializable> generalConfiguration = getConfiguration(defaultSettings); Map<String, Serializable> tenantConfiguration = loadConfiguration("configuration/tenant1.json"); ValidConfigurationEnforcer enforcer = new ValidConfigurationEnforcer(generalConfiguration, tenantConfiguration);/* w w w. j a va 2 s . c o m*/ ValidConfigurationEnforcer.ValidationResult result = enforcer.enforce(); Map<String, Serializable> enforced = result.getResult(); Assert.assertEquals(false, result.isHasErrors()); Assert.assertEquals(Locale.FRANCE.toString(), ((Map<String, Serializable>) enforced.get("locales")).get("main")); }
From source file:fr.bde_eseo.eseomega.events.tickets.model.ShuttleItem.java
public Date getParsedDate(String datetime) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.FRANCE); Date date = null;/*www . ja v a 2s.com*/ try { date = format.parse(datetime); } catch (ParseException e) { e.printStackTrace(); } return date; }