Example usage for java.util Locale FRENCH

List of usage examples for java.util Locale FRENCH

Introduction

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

Prototype

Locale FRENCH

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

Click Source Link

Document

Useful constant for language.

Usage

From source file:org.opencommercesearch.EmbeddedSearchServer.java

/**
 * Creates a copy of this search server by cloning the cores
 *
 * @param name is the name for the copy used to identify the new server's core, instance directory and other configurations
 *
 * @return a copy of this search server/*  w  w  w  .  j  a  va 2  s .c  om*/
 *
 * @throws SolrServerException if an error occurs while communicating with Solr
 * @throws IOException if an error occurs while communicating with Solr
 */
public EmbeddedSearchServer createCopy(String name) throws SolrServerException, IOException {

    if (isLoggingInfo()) {
        logInfo("Creating search server copy for " + name);
    }

    EmbeddedSearchServer copy = new EmbeddedSearchServer();

    // @TODO support for configurable locales
    for (Locale locale : new Locale[] { Locale.ENGLISH, Locale.FRENCH }) {
        String catalogCoreName = getCatalogCollection(locale);
        String rulesCoreName = getRulesCollection(locale);
        String copyCatalogCollectionName = name + "_" + getCatalogCollection();
        String copyRuleCollectionName = name + "_" + getRulesCollection();
        String copyCatalogCoreName = name + "_" + catalogCoreName;
        String copyRuleCoreName = name + "_" + rulesCoreName;
        SolrCore catalogCore = coreContainer.getCore(catalogCoreName);
        SolrCore rulesCore = coreContainer.getCore(rulesCoreName);

        if (catalogCore != null) {
            copy.setCatalogCollection(copyCatalogCollectionName);
            cloneCore(catalogCore, copyCatalogCollectionName, copyCatalogCoreName, "product_catalog", locale);
            copy.setCatalogSolrServer(
                    createEmbeddedSolrServer(coreContainer, copyCatalogCollectionName, locale), locale);
            copy.getSolrServer(copyCatalogCollectionName, locale).commit();
        }

        if (rulesCore != null) {
            copy.setRulesCollection(copyRuleCollectionName);
            cloneCore(rulesCore, copyRuleCollectionName, copyRuleCoreName, "rules", locale);
            copy.setRulesSolrServer(createEmbeddedSolrServer(coreContainer, copyRuleCollectionName, locale),
                    locale);
            copy.getSolrServer(copyRuleCollectionName, locale).commit();
        }
    }
    copy.setSearchRepository(getSearchRepository());
    copy.setInMemoryIndex(getInMemoryIndex());
    copy.setEnabled(getEnabled());
    copy.setDataDir(getDataDir());
    copy.setSolrConfigUrl(getSolrConfigUrl());
    copy.setSolrCorePath(getSolrCorePath());
    copy.setLoggingInfo(this.isLoggingInfo());
    copy.setLoggingDebug(this.isLoggingDebug());
    copy.setLoggingError(this.isLoggingError());
    copy.setLoggingWarning(this.isLoggingWarning());
    copy.coreContainer = coreContainer;

    if (isLoggingInfo()) {
        logInfo("Successfully create search server copy for " + name);
    }

    return copy;
}

From source file:$.MailContactServiceImpl.java

/** {@inheritDoc} */
    @Override// w w  w  .j a  v  a  2s  .  c  om
    public void envoyerMail(final String nom, final String prenom, final String fromAddress, final String message) {

        try {
            final String sujet = String.format(objetContactMail, applicationName, WordUtils.capitalize(prenom),
                    WordUtils.capitalize(nom));

            final Map<String, Object> params = new HashMap<String, Object>();
            params.put("nom", WordUtils.capitalize(nom));
            params.put("prenom", WordUtils.capitalize(prenom));
            params.put("corps", message);
            final SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy '' HH:mm:ss", Locale.FRENCH);
            params.put("date", sdf.format(new Date()));
            params.put("applicationName", applicationName);
            params.put("applicationUrl", applicationUrl);

            // Exemple d'utilisation d'un NO_REPLY ou d'ajout d'un CC
            // params.put(MailServiceImpl.SMTP_HEADER_REPLYTO, NO_REPLY);
            // params.put(MailServiceImpl.SMTP_HEADER_CC, "root@localhost.com");

            mailService.envoyerDepuisModele(fromAddress, sujet, corpsContactMail, params, destinataires);

        } catch (final Exception e) {
            MailContactServiceImpl.LOGGER.error("Erreur lors de la tentative d'envoi de mail de contact.", e);
            throw new BusinessException("ERR-CODE-MAIL-001", e);
        }

    }

From source file:org.openmrs.web.taglib.OpenmrsMessageTagTest.java

/**
 * @see OpenmrsMessageTag#doEndTag()//w  w  w  .j  a va 2  s  .  co m
 */
@Test
@Verifies(value = "resolve message in locale that different from default", method = "doEndTag()")
public void doEndTag_shouldResolveMessageInLocaleThatDifferentFromDefault() throws Exception {

    MockHttpServletRequest request = (MockHttpServletRequest) mockPageContext.getRequest();
    request.addPreferredLocale(Locale.FRENCH);

    String expectedOutput = "il s'agit d'un essai";
    openmrsMessageTag.setCode(TEST_CODE);

    checkDoEndTagEvaluation(expectedOutput);
}

From source file:com.doculibre.constellio.lucene.BaseLuceneIndexHelper.java

@Override
public synchronized void deleteAll() {
    try {//from   w  w w .  j  a  v a2  s  . c o m
        Directory directory = FSDirectory.open(indexDir);
        Analyzer analyzer = analyzerProvider.getAnalyzer(Locale.FRENCH);
        IndexWriter indexWriter = new IndexWriter(directory,
                new IndexWriterConfig(Version.LUCENE_44, analyzer));
        indexWriter.deleteAll();
        indexWriter.addDocument(new Document());
        //            indexWriter.optimize();
        indexWriter.close();
        directory.close();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

From source file:org.openmrs.module.emrapi.concept.EmrConceptServiceComponentTest.java

private Map<String, Concept> setupConcepts() {
    Map<String, Concept> concepts = new HashMap<String, Concept>();

    ConceptMapType sameAs = conceptService.getConceptMapTypeByName("same-as");
    ConceptSource icd10 = conceptService.getConceptSourceByName("ICD-10");

    ConceptDatatype na = conceptService.getConceptDatatypeByName("N/A");
    ConceptClass diagnosis = conceptService.getConceptClassByName("Diagnosis");
    ConceptClass convSet = conceptService.getConceptClassByName("ConvSet");

    concepts.put("malaria",
            conceptService.saveConcept(new ConceptBuilder(conceptService, na, diagnosis)
                    .add(new ConceptName("Malaria", Locale.ENGLISH))
                    .add(new ConceptName("Clinical Malaria", Locale.ENGLISH))
                    .add(new ConceptName("Paludisme", Locale.FRENCH)).addMapping(sameAs, icd10, "B54").get()));

    concepts.put("cerebral malaria",
            conceptService.saveConcept(new ConceptBuilder(conceptService, na, diagnosis)
                    .add(new ConceptName("Cerebral Malaria", Locale.ENGLISH))
                    .add(new ConceptName("Malaria clbrale", Locale.FRENCH))
                    .addMapping(sameAs, icd10, "B50.0").get()));

    concepts.put("diabetes",
            conceptService.saveConcept(new ConceptBuilder(conceptService, na, diagnosis)
                    .add(new ConceptName("Diabetes Mellitus, Type II", Locale.ENGLISH))
                    .addVoidedName(new ConceptName("Malaria", Locale.ENGLISH))
                    .addMapping(sameAs, icd10, "E11.9").get()));

    concepts.put("allowedDiagnoses",
            conceptService.saveConcept(new ConceptBuilder(conceptService, na, convSet)
                    .add(new ConceptName("Allowed Diagnoses", Locale.ENGLISH))
                    .addSetMember(concepts.get("malaria")).addSetMember(concepts.get("diabetes")).get()));

    return concepts;
}

From source file:org.squale.welcom.taglib.htmlarea.HtmlAreaTag.java

/**
 * @see javax.servlet.jsp.tagext.BodyTagSupport#release()
 *//*  w ww  .  ja  v  a 2 s. co  m*/
public void release() {
    name = null;
    property = null;
    scope = null;
    plugin = null;
    width = null;
    toolbarkey = null;
    debug = false;
    callbacksfile = null;
    editorType = HTML_EDITOR;
    forceReadWrite = false;
    localeRequest = Locale.FRENCH;
    pluginList = null;
    resources = null;
    tagname = null;
    toolbar = null;
    edName = null;
    super.release();
}

From source file:test.unit.be.fedict.eid.tsl.EtsiTslLifecycleTest.java

@Test
public void testLC002() throws Exception {
    // setup/* ww w . ja va  2 s  . c  om*/
    TrustServiceList trustServiceList = TrustServiceListFactory.newInstance();

    // scheme operator name
    trustServiceList.setSchemeOperatorName("BE:Fedict", Locale.ENGLISH);
    trustServiceList.setSchemeOperatorName("BE:Fedict", new Locale("nl"));
    trustServiceList.setSchemeOperatorName("BE:Fedict", Locale.FRENCH);
    trustServiceList.setSchemeOperatorName("BE:Fedict", Locale.GERMAN);

    // scheme operator postal address
    PostalAddressType schemeOperatorPostalAddress = new PostalAddressType();
    schemeOperatorPostalAddress.setStreetAddress("Maria-Theresiastraat 1/3");
    schemeOperatorPostalAddress.setLocality("Brussels");
    schemeOperatorPostalAddress.setStateOrProvince("Brussels");
    schemeOperatorPostalAddress.setPostalCode("1000");
    schemeOperatorPostalAddress.setCountryName("Belgium");
    trustServiceList.setSchemeOperatorPostalAddress(schemeOperatorPostalAddress, Locale.ENGLISH);

    schemeOperatorPostalAddress.setStreetAddress("Maria-Theresiastraat 1/3");
    schemeOperatorPostalAddress.setLocality("Brussel");
    schemeOperatorPostalAddress.setStateOrProvince("Brussel");
    schemeOperatorPostalAddress.setPostalCode("1000");
    schemeOperatorPostalAddress.setCountryName("Belgi");
    trustServiceList.setSchemeOperatorPostalAddress(schemeOperatorPostalAddress, new Locale("nl"));

    // scheme operator electronic address
    /*
    List<String> electronicAddresses = new LinkedList<String>();
    electronicAddresses.add("http://www.fedict.belgium.be/");
    electronicAddresses.add("mailto://eid@belgium.be");
    trustServiceList
    .setSchemeOperatorElectronicAddresses(electronicAddresses);
    */
    trustServiceList.setSchemeOperatorElectronicAddresses(Locale.ENGLISH, "http://www.fedict.belgium.be/");
    trustServiceList.setSchemeOperatorElectronicAddresses(Locale.ENGLISH, "mailto://eid@belgium.be");

    // scheme name
    trustServiceList.setSchemeName(
            "BE:Supervision/Accreditation Status List of certification services from Certification Service Providers, which are supervised/accredited by the referenced Scheme Operator Member State for compliance with the relevant provisions laid down in  Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures",
            Locale.ENGLISH);

    // scheme information URIs
    trustServiceList.addSchemeInformationUri("https://www.e-contract.be/tsl/", Locale.ENGLISH);

    // status determination approach
    trustServiceList.setStatusDeterminationApproach(TrustServiceList.STATUS_DETERMINATION_APPROPRIATE);

    // scheme type
    /*
     * The Scheme Type URIs can actually be visited. We should provide some
     * information to ETSI for the BE schemerules.
     */
    trustServiceList.addSchemeType(TrustServiceList.SCHEME_RULE_COMMON, Locale.ENGLISH);
    /*
     * The BE schemerules MUSH be provided. We can add extra paths for
     * language. For example: http://
     * uri.etsi.org/TrstSvc/eSigDir-1999-93-EC-TrustedList/schemerules/BE/nl
     */
    trustServiceList.addSchemeType("http://uri.etsi.org/TrstSvc/eSigDir-1999-93-EC-TrustedList/schemerules/BE",
            Locale.ENGLISH);

    // scheme territory
    trustServiceList.setSchemeTerritory("BE");

    // legal notice
    trustServiceList.addLegalNotice(
            "The applicable legal framework for the present TSL implementation of the Trusted List of supervised/accredited Certification Service Providers for Belgium is the Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures and its implementation in Belgian laws.",
            Locale.ENGLISH);

    // historical information period
    /*
     * Volgens de wet van 9 JULI 2001.  Wet houdende vaststelling van
     * bepaalde regels in verband met het juridisch kader voor elektronische
     * handtekeningen en certificatiediensten: Bijlage II - punt i) alle
     * relevante informatie over een gekwalificeerd certificaat te
     * registreren gedurende de nuttige termijn van dertig jaar, in het
     * bijzonder om een certificatiebewijs te kunnen voorleggen bij
     * gerechtelijke procedures.
     */
    trustServiceList.setHistoricalInformationPeriod(3653 * 3);

    // list issue date time
    DateTime listIssueDateTime = new DateTime();
    trustServiceList.setListIssueDateTime(listIssueDateTime);

    // next update
    DateTime nextUpdateDateTime = listIssueDateTime.plusMonths(6);
    trustServiceList.setNextUpdate(nextUpdateDateTime);

    // distribution point
    File tslFile = File.createTempFile("tsl-LC002-", ".xml");
    trustServiceList.addDistributionPoint("https://www.e-contract.be/tsl/" + tslFile.getName());

    // sign TSL
    KeyPair keyPair = TrustTestUtils.generateKeyPair(2048);
    PrivateKey privateKey = keyPair.getPrivate();
    DateTime notBefore = new DateTime();
    DateTime notAfter = notBefore.plusYears(1);
    X509Certificate certificate = TrustTestUtils.generateSelfSignedCertificate(keyPair,
            "C=BE, CN=Belgium Trust List Scheme Operator", notBefore, notAfter);
    trustServiceList.sign(privateKey, certificate);

    // save TSL
    trustServiceList.saveAs(tslFile);
    LOG.debug("TSL file: " + tslFile.getAbsolutePath());
}

From source file:fr.paris.lutece.plugins.dila.modules.solr.utils.parsers.DilaSolrLocalParser.java

/**
 * Event received at the end of the parsing operation
 *
 * @throws SAXException any SAX exception
 *//*from w w w.j ava2s .c o  m*/
public void endDocument() throws SAXException {
    // Sets the full URL
    UrlItem url = new UrlItem(_strProdUrl);
    url.addParameter(XPageAppService.PARAM_XPAGE_APP, AppPropertiesService.getProperty(PROPERTY_PLUGIN_NAME));
    url.addParameter(AppPropertiesService.getProperty(PROPERTY_PATH_ID), _strId);
    url.addParameter(AppPropertiesService.getProperty(PROPERTY_PATH_CATEGORY), _strAudience);

    // Converts the date from "dd MMMMM yyyy" to "yyyyMMdd"
    Locale locale = Locale.FRENCH;
    Date dateUpdate = null;

    try {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd", locale);
        String strDate = _strDate.split(STRING_SPACE)[1];
        dateUpdate = dateFormat.parse(strDate);

        dateFormat.applyPattern("yyyyMMdd");
    } catch (ParseException e) {
        dateUpdate = null;
    }

    if (StringUtils.isNotEmpty(_strId)) {
        // Creates a new lucene document
        SolrItem item = new SolrItem();

        item.setUrl(url.getUrl());
        item.setDate(dateUpdate);
        item.setUid(_strId);
        item.setContent(_strContents);
        item.setTitle(_strTitle);
        item.setType(_strType);
        item.setSite(_strSite);

        String[] categories = new String[] { _strAudience };
        item.setCategorie(Arrays.asList(categories));

        // Adds the new item to the list
        _listSolrItems.add(item);
    }
}

From source file:org.openmrs.module.emr.api.EmrServiceComponentTest.java

@Test
public void testConceptSearchInAnotherLocale() throws Exception {
    Map<String, Concept> concepts = setupConcepts();
    ConceptClass diagnosis = conceptService.getConceptClassByName("Diagnosis");

    List<ConceptSearchResult> searchResults = service.conceptSearch("malaria", Locale.FRENCH,
            Collections.singleton(diagnosis), null, null, null);
    ConceptSearchResult firstResult = searchResults.get(0);

    assertThat(searchResults.size(), is(1));
    assertThat(firstResult.getConcept(), is(concepts.get("cerebral malaria")));
    assertThat(firstResult.getConceptName().getName(), is("Malaria clbrale"));
}

From source file:org.richfaces.component.CalendarComponentTest.java

public void testGetPreloadDateRange() throws Exception {
    UICalendar calendar = (UICalendar) application.createComponent(UICalendar.COMPONENT_TYPE);
    calendar.setLocale(Locale.FRENCH);
    Calendar calendarObject = Calendar.getInstance();
    calendarObject.clear();//w  w  w.  ja v a2  s .  com
    calendarObject.set(2007, Calendar.JUNE, 10);
    calendar.setCurrentDate(calendarObject.getTime());

    Date[] range = calendar.getPreloadDateRange();
    assertEquals(calendar.getPreloadDateRangeBegin(), range[0]);
    assertEquals(calendar.getPreloadDateRangeEnd(), range[range.length - 1]);
    assertEquals(30, range.length);
}