Example usage for java.util Locale FRANCE

List of usage examples for java.util Locale FRANCE

Introduction

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

Prototype

Locale FRANCE

To view the source code for java.util Locale FRANCE.

Click Source Link

Document

Useful constant for country.

Usage

From source file:org.pac4j.oauth.client.PayPalClientIT.java

@Override
protected void verifyProfile(final UserProfile userProfile) {
    final PayPalProfile profile = (PayPalProfile) userProfile;
    logger.debug("userProfile : {}", profile);
    assertEquals("YAxf5WKSFn4BG_l3wqcBJUSObQTG1Aww5FY0EDf_ccw", profile.getId());
    assertEquals(PayPalProfile.class.getSimpleName() + UserProfile.SEPARATOR
            + "YAxf5WKSFn4BG_l3wqcBJUSObQTG1Aww5FY0EDf_ccw", profile.getTypedId());
    assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), PayPalProfile.class));
    assertTrue(StringUtils.isNotBlank(profile.getAccessToken()));
    assertCommonProfile(userProfile, "testscribeup@gmail.com", "Test", "ScribeUP", "Test ScribeUP", null,
            Gender.UNSPECIFIED, Locale.FRANCE, null, null, "Europe/Berlin");
    final PayPalAddress address = profile.getAddress();
    assertEquals("FR", address.getCountry());
    assertEquals("Paris", address.getLocality());
    assertEquals("75001", address.getPostalCode());
    assertEquals("Adr1", address.getStreetAddress());
    final Locale language = profile.getLanguage();
    assertEquals(Locale.FRANCE, language);
    assertEquals(9, profile.getAttributes().size());
}

From source file:fr.bde_eseo.eseomega.news.NewsItem.java

private Date getParsedDate(String d) {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.FRANCE);
    Date date = null;/*from   ww w .j a v  a  2 s  .  c  om*/
    try {
        date = format.parse(d);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return date;
}

From source file:logic.Export.java

public boolean convertXls2()
        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;/* w w  w  . j a  v  a 2  s  .  c o  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);
        cell = sheet.getRow(0).getCell(1);
        cell.setCellValue(cd.sheetnames.get(i));
        ArrayList<String[]> convert = cd.convert(cd.sheetnames.get(i));
        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 + 1);
                String name;
                switch (Cell) {
                case 3:
                    name = convert.get(Row)[Cell];
                    int parseInt = Integer.parseInt(name);
                    cell.setCellValue(parseInt);
                    cell.setCellType(CellType.NUMERIC);
                    break;
                case 4:
                    number = format.parse(convert.get(Row)[Cell]);
                    cell.setCellValue(number.doubleValue());
                    //  cell.setCellStyle(cellStyle);
                    cell.setCellType(CellType.NUMERIC);

                    break;
                default:
                    cell.setCellValue(convert.get(Row)[Cell]);
                    break;
                }
            }
        }

        for (String[] sa : convert) {
            number = format.parse(sa[4]);
            hours = hours + number.doubleValue();
        }
        cell = sheet.getRow(6).getCell(5);
        cell.setCellValue(hours);
        cell = sheet.getRow(2).getCell(8);
        XSSFCell cellHourlyRate = sheet.getRow(1).getCell(8);
        double numericCellValue = cellHourlyRate.getNumericCellValue();
        cell.setCellValue(hours * numericCellValue);
    }
    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.mifos.config.Localization.java

private synchronized void setLocaleMap() {
    if (LOCALE_MAP.isEmpty()) {
        LOCALE_MAP.put((short) 1, Locale.UK); // These were the options in personnel language list (pre Mifos 2.2)
        LOCALE_MAP.put((short) 2, new Locale("is", "IS")); // Icelandic
        LOCALE_MAP.put((short) 3, SPANISH); // Spanish
        LOCALE_MAP.put((short) 4, Locale.FRANCE); // French
        LOCALE_MAP.put((short) 5, Locale.SIMPLIFIED_CHINESE); // Chinese
        LOCALE_MAP.put((short) 6, new Locale("sw", "KE")); // Swahili
        LOCALE_MAP.put((short) 7, new Locale("ar", "DZ")); // Arabic
        LOCALE_MAP.put((short) 8, new Locale("pt", "AO")); // Portuguese
        LOCALE_MAP.put((short) 9, new Locale("km", "KH")); // Khmer
        LOCALE_MAP.put((short) 10, new Locale("lo", "LA")); // Lola
        LOCALE_MAP.put((short) 11, new Locale("hu", "HU")); // Hungarian
        LOCALE_MAP.put((short) 12, new Locale("te", "IN")); // Tegulu
        LOCALE_MAP.put((short) 13, new Locale("hi", "IN")); // Hindi
        LOCALE_MAP.put((short) 14, Locale.GERMAN);
        LOCALE_MAP.put((short) 15, new Locale("ru")); // Georgian
        LOCALE_MAP.put((short) 16, new Locale("ka")); // Russian
    }/*from  w w w .j a v a 2s  . c om*/
}

From source file:xml.sk.Parser.java

/**
 * Parses ClassificationSk.xml./* w  ww . j a v a  2s  .co  m*/
 *
 * @param manager classification manager to store data
 * @throws javax.xml.parsers.ParserConfigurationException
 * @throws org.xml.sax.SAXException
 * @throws java.io.IOException
 */
public void parseClassificationSk(ClassificationManagerImpl manager)
        throws ParserConfigurationException, SAXException, IOException, ParseException {
    Map<String, String> nameMap = new HashMap<>();

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();

    // file with statistics 2012 - 2013
    Document doc = builder.parse("src/main/java/xml/sk/Classification1Sk.xml");

    NodeList classificationList = doc.getElementsByTagName("PRAC_strMzdyZamIsco");
    for (int i = 0; i < classificationList.getLength(); i++) {
        Element classificationNode = (Element) classificationList.item(i);

        String name = classificationNode.getElementsByTagName("UKAZ2").item(0).getTextContent();
        String[] splited = name.split(" ", 2);
        if (!nameMap.containsKey(splited[0]))
            nameMap.put(splited[0], splited[1]);

        NodeList years = classificationNode.getChildNodes();

        for (int j = 0; j < years.getLength(); j++) {
            if (years.item(j).getNodeType() == Node.TEXT_NODE) {
                continue;
            }
            Element yearNode = (Element) years.item(j);
            if ("MJ".equals(yearNode.getNodeName()) || "UKAZ".equals(yearNode.getNodeName().substring(0, 4)))
                continue;

            String year = yearNode.getNodeName().substring(1);
            if (".".equals(yearNode.getTextContent()) || "".equals(yearNode.getTextContent())) {
                continue;
            }
            String salaryStr = yearNode.getTextContent().replaceAll(" ", "");
            NumberFormat format = NumberFormat.getInstance(Locale.FRANCE);
            Number number = format.parse(salaryStr);
            double salaryDouble = number.doubleValue();

            Classification classification = new Classification();
            classification.setCode(splited[0]);
            classification.setName(splited[1]);
            classification.setCountry("sk");
            classification.setYear(year);
            classification.setAverageSalary(salaryDouble);

            manager.createClassification(classification);
        }
    }

    //file with statistics 1998, 2009 - 2011
    doc = builder.parse("src/main/java/xml/sk/Classification2Sk.xml");
    classificationList = doc.getElementsByTagName("PRAC_strMzdyZam");
    for (int i = 0; i < classificationList.getLength(); i++) {
        Element classificationNode = (Element) classificationList.item(i);

        if (!"EUR".equals(classificationNode.getElementsByTagName("MJ").item(0).getTextContent()))
            continue;

        String name = classificationNode.getElementsByTagName("UKAZ2").item(0).getTextContent();
        String[] splited = name.split(" ", 2);

        NodeList years = classificationNode.getChildNodes();

        for (int j = 0; j < years.getLength(); j++) {
            if (years.item(j).getNodeType() == Node.TEXT_NODE) {
                continue;
            }
            Element yearNode = (Element) years.item(j);
            if ("MJ".equals(yearNode.getNodeName()) || "UKAZ".equals(yearNode.getNodeName().substring(0, 4)))
                continue;

            String year = yearNode.getNodeName().substring(1);
            if (".".equals(yearNode.getTextContent()) || "".equals(yearNode.getTextContent())) {
                continue;
            }
            String salaryStr = yearNode.getTextContent().replaceAll(" ", "");
            NumberFormat format = NumberFormat.getInstance(Locale.FRANCE);
            Number number = format.parse(salaryStr);
            double salaryDouble = number.doubleValue();

            Classification classification = new Classification();
            classification.setCode(splited[0]);
            classification.setName(nameMap.get(splited[0]));
            classification.setCountry("sk");
            classification.setYear(year);
            classification.setAverageSalary(salaryDouble);

            manager.createClassification(classification);
        }
    }
}

From source file:org.duniter.client.Main.java

protected void initI18n() throws IOException {
    Configuration config = Configuration.instance();

    // --------------------------------------------------------------------//
    // init i18n//from w  w  w . j a  va 2  s.c  om
    // --------------------------------------------------------------------//
    File i18nDirectory = config.getI18nDirectory();
    if (i18nDirectory.exists()) {
        // clean i18n cache
        FileUtils.cleanDirectory(i18nDirectory);
    }

    FileUtils.forceMkdir(i18nDirectory);

    if (debug) {
        System.out.println("INFO - I18N directory: " + i18nDirectory);
    }

    Locale i18nLocale = config.getI18nLocale();

    // Fix locale
    if (i18nLocale.equals(Locale.FRENCH)) {
        i18nLocale = Locale.FRANCE;
    } else if (i18nLocale.equals(Locale.ENGLISH)) {
        i18nLocale = Locale.UK;
    }

    if (debug) {
        System.out.println(
                String.format("INFO - Starts i18n with locale [%s] at [%s]", i18nLocale, i18nDirectory));
    }
    I18n.init(new UserI18nInitializer(i18nDirectory, new DefaultI18nInitializer(getI18nBundleName())),
            i18nLocale);
}

From source file:com.github.dbourdette.glass.SpringConfig.java

@Bean
public FixedLocaleResolver fixedLocaleResolver() {
    FixedLocaleResolver resolver = new FixedLocaleResolver();
    resolver.setDefaultLocale(Locale.FRANCE);
    return resolver;
}

From source file:org.opennms.netmgt.syslogd.SyslogMessageTest.java

@Test
public void testCustomParserNms5242() throws Exception {
    final Locale startLocale = Locale.getDefault();
    try {//from w ww . j a  v  a  2s .  com
        Locale.setDefault(Locale.FRANCE);
        final InputStream stream = new ByteArrayInputStream(("<?xml version=\"1.0\"?>\n"
                + "<syslogd-configuration>\n" + "    <configuration\n" + "            syslog-port=\"10514\"\n"
                + "            new-suspect-on-message=\"false\"\n"
                + "            parser=\"org.opennms.netmgt.syslogd.CustomSyslogParser\"\n"
                + "            forwarding-regexp=\"^((.+?) (.*))\\n?$\"\n"
                + "            matching-group-host=\"2\"\n" + "            matching-group-message=\"3\"\n"
                + "            discard-uei=\"DISCARD-MATCHING-MESSAGES\"\n" + "            />\n" + "\n"
                + "    <hideMessage>\n" + "        <hideMatch>\n"
                + "            <match type=\"substr\" expression=\"TEST\"/>\n" + "        </hideMatch>\n"
                + "    </hideMessage>\n" + "</syslogd-configuration>\n").getBytes());
        final SyslogdConfigFactory config = new SyslogdConfigFactory(stream);

        final SyslogParser parser = new CustomSyslogParser(config,
                "<0>Mar 14 17:10:25 petrus sudo:  cyrille : user NOT in sudoers ; TTY=pts/2 ; PWD=/home/cyrille ; USER=root ; COMMAND=/usr/bin/vi /etc/aliases");
        assertTrue(parser.find());
        final SyslogMessage message = parser.parse();
        LOG.debug("message = {}", message);
        final Calendar cal = Calendar.getInstance();
        cal.setTimeZone(TimeZone.getTimeZone("UTC"));
        cal.set(Calendar.MONTH, Calendar.MARCH);
        cal.set(Calendar.DAY_OF_MONTH, 14);
        cal.set(Calendar.HOUR_OF_DAY, 17);
        cal.set(Calendar.MINUTE, 10);
        cal.set(Calendar.SECOND, 25);
        cal.set(Calendar.MILLISECOND, 0);
        assertEquals(SyslogFacility.KERNEL, message.getFacility());
        assertEquals(SyslogSeverity.EMERGENCY, message.getSeverity());
        assertNull(message.getMessageID());
        assertEquals(cal.getTime(), message.getDate());
        assertEquals("petrus", message.getHostName());
        assertEquals("sudo", message.getProcessName());
        assertEquals(0, message.getProcessId().intValue());
        assertEquals(
                "cyrille : user NOT in sudoers ; TTY=pts/2 ; PWD=/home/cyrille ; USER=root ; COMMAND=/usr/bin/vi /etc/aliases",
                message.getMessage());
    } finally {
        Locale.setDefault(startLocale);
    }
}

From source file:fr.bde_eseo.eseomega.news.NewsItem.java

private String getFrenchDate(String dt) {
    Date d = getParsedDate(dt);//w  w  w. j av  a  2  s.c om
    SimpleDateFormat sdf = new SimpleDateFormat("E dd MMMM yyyy, '' HH:mm", Locale.FRANCE);
    return sdf.format(d);
}

From source file:org.ocelotds.core.services.ArgumentConvertorTest.java

@Test
public void testGetResultIterable() throws JsonUnmarshallingException {
    System.out.println("getResult");
    String jsonArg = "[{\"language\":\"fr\",\"country\":\"FR\"}, {\"language\":\"fr\",\"country\":\"FR\"}]";
    LocaleMarshaller lm = new LocaleMarshaller();
    when(argumentServices.getJavaResultFromSpecificUnmarshallerIterable(anyString(),
            any(IJsonMarshaller.class))).thenReturn(Arrays.asList(Locale.FRANCE, Locale.US));
    Object result = instance.getResult(jsonArg, lm, JsonMarshallerType.LIST);
    assertThat(result).isInstanceOf(List.class);
}