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:io.cfp.model.User.java

public Locale getLocale() {
    if (language != null && (language.equalsIgnoreCase("franais") || language.equalsIgnoreCase("fr"))) {
        return Locale.FRENCH;
    }//from  w w  w .j a va 2 s .  c o  m
    return Locale.ENGLISH;
}

From source file:com.p5solutions.core.utils.Comparison.java

/**
 * Checks if is french.//ww w.  j  a  v a2  s.  c  o m
 * 
 * @param locale
 *          the locale
 * @return true, if is french
 */
public static boolean isFrench(Locale locale) {
    String lang = Locale.FRENCH.getLanguage();
    if (lang.equals(locale.getLanguage())) {
        return true;
    }
    return false;
}

From source file:org.obiba.onyx.core.service.UserServiceTest.java

@Test
@Dataset//  w w w  .  j  a v  a  2s .co  m
public void testUpdateUserlanguage() {
    User user = persistenceManager.get(User.class, 2l);
    userService.updateUserLanguage(user, Locale.FRENCH);
    Assert.assertEquals(Locale.FRENCH, persistenceManager.get(User.class, Long.valueOf("2")).getLanguage());
}

From source file:guru.bubl.module.model.User.java

public Locale getLocaleForBundle() {
    return getPreferredLocales().toString().toLowerCase().contains(Locale.FRENCH.toString().toLowerCase())
            ? Locale.FRENCH/*ww  w .  ja v  a  2 s. co m*/
            : Locale.ENGLISH;
}

From source file:test.unit.be.fedict.eid.applet.MessagesTest.java

@Test
public void testDefaultLocale() throws Exception {
    Locale defaultLocale = Locale.FRENCH;
    Locale.setDefault(defaultLocale);
    Locale locale = Locale.ENGLISH;
    Messages messages = new Messages(locale);
    String message = messages.getMessage(Messages.MESSAGE_ID.GENERIC_ERROR);
    LOG.debug("message: " + message);
    assertEquals("Generic Error.", message);
}

From source file:org.apache.velocity.tools.test.whitebox.ConfigTests.java

protected FactoryConfiguration getBaseConfig() {
    FactoryConfiguration base = new FactoryConfiguration();

    Data datum = new Data();
    datum.setKey("version");
    datum.setType("number");
    datum.setValue("2.0");
    base.addData(datum);/*  w ww  . j  a v a  2s . c o m*/

    ToolboxConfiguration toolbox = new ToolboxConfiguration();
    toolbox.setScope(Scope.REQUEST);
    toolbox.setProperty("locale", Locale.US);
    ToolConfiguration tool = new ToolConfiguration();
    tool.setClass(ResourceTool.class);
    toolbox.addTool(tool);
    base.addToolbox(toolbox);

    toolbox = new ToolboxConfiguration();
    toolbox.setScope(Scope.APPLICATION);
    tool = new ToolConfiguration();
    tool.setKey("calc");
    tool.setClass(MathTool.class);
    toolbox.addTool(tool);

    tool = new ToolConfiguration();
    tool.setClass(NumberTool.class);
    tool.setProperty("locale", Locale.FRENCH);
    toolbox.addTool(tool);
    base.addToolbox(toolbox);

    return base;
}

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

private synchronized void initIfNecessary() {
    if (topDocs == null) {
        try {/*from   w w w.j a va  2  s .  co m*/
            Directory directory = FSDirectory.open(indexDir);
            Analyzer analyzer = analyzerProvider.getAnalyzer(Locale.FRENCH);
            MultiFieldQueryParser parser = new MultiFieldQueryParser(Version.LUCENE_44, searchFields, analyzer);
            parser.setAllowLeadingWildcard(true);
            try {
                luceneQuery = parser.parse(luceneTextQuery);
            } catch (ParseException e) {
                try {
                    luceneQuery = parser.parse(QueryParser.escape(luceneTextQuery));
                } catch (ParseException e1) {
                    throw new RuntimeException(e1);
                }
            }
            indexReader = DirectoryReader.open(directory);
            indexSearcher = new IndexSearcher(indexReader);
            //              Sort sort;
            //              if (sortField != null) {
            //                  sort = new Sort(new SortField(sortField, Locale.CANADA_FRENCH, Boolean.FALSE.equals(sortAscending)));
            //              } else {
            //                  sort = null;
            //              }
            topDocs = indexSearcher.search(luceneQuery, indexReader.maxDoc());
            directory.close();
        } catch (CorruptIndexException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

From source file:org.xwiki.test.rest.PageTranslationResourceTest.java

@Test
public void testPUTGETDELETETranslation() throws Exception {
    Page newPage = this.objectFactory.createPage();
    newPage.setTitle("fr titre");
    newPage.setContent("fr contenue");
    newPage.setLanguage(Locale.FRENCH.toString());

    assertFalse(this.testUtils.rest().exists(this.referenceDefault));

    String uri = buildURI(PageTranslationResource.class, getWiki(), this.spaces, this.pageName, Locale.FRENCH)
            .toString();/*from  w w w.  j  a  va 2 s.c  o  m*/

    // PUT
    PutMethod putMethod = executePutXml(uri, newPage, TestUtils.SUPER_ADMIN_CREDENTIALS.getUserName(),
            TestUtils.SUPER_ADMIN_CREDENTIALS.getPassword());
    assertEquals(getHttpMethodInfo(putMethod), HttpStatus.SC_CREATED, putMethod.getStatusCode());
    Page modifiedPage = (Page) this.unmarshaller.unmarshal(putMethod.getResponseBodyAsStream());

    assertEquals("fr titre", modifiedPage.getTitle());
    assertEquals("fr contenue", modifiedPage.getContent());
    assertEquals(Locale.FRENCH.toString(), modifiedPage.getLanguage());

    assertTrue(this.testUtils.rest().exists(this.referenceFR));
    assertFalse(this.testUtils.rest().exists(this.referenceDefault));

    // GET
    GetMethod getMethod = executeGet(uri);
    assertEquals(getHttpMethodInfo(getMethod), HttpStatus.SC_OK, getMethod.getStatusCode());
    modifiedPage = (Page) this.unmarshaller.unmarshal(getMethod.getResponseBodyAsStream());

    assertEquals("fr titre", modifiedPage.getTitle());
    assertEquals("fr contenue", modifiedPage.getContent());
    assertEquals(Locale.FRENCH.toString(), modifiedPage.getLanguage());

    // DELETE
    DeleteMethod deleteMethod = executeDelete(uri, TestUtils.SUPER_ADMIN_CREDENTIALS.getUserName(),
            TestUtils.SUPER_ADMIN_CREDENTIALS.getPassword());
    assertEquals(getHttpMethodInfo(deleteMethod), HttpStatus.SC_NO_CONTENT, deleteMethod.getStatusCode());

    assertFalse(this.testUtils.rest().exists(this.referenceDefault));
    assertFalse(this.testUtils.rest().exists(this.referenceFR));
}

From source file:com.github.mrstampy.gameboot.messages.context.GameBootContextTest.java

/**
 * Test intl./*from ww w. j a  va  2  s  . c  o  m*/
 *
 * @throws Exception
 *           the exception
 */
@Test
public void testIntl() throws Exception {
    ResponseContext rc = lookup.lookup(UNEXPECTED_ERROR, Locale.getDefault());
    assertRC(rc, UNEXPECTED_ERROR, DEFAULT);

    rc = lookup.lookup(UNEXPECTED_ERROR, Locale.FRENCH);
    assertRC(rc, UNEXPECTED_ERROR, FRENCH);

    rc = lookup.lookup(UNEXPECTED_ERROR, Locale.UK);
    assertRC(rc, UNEXPECTED_ERROR, DEFAULT);

    rc = lookup.lookup(UNEXPECTED_ERROR, new Locale("r2", "D2"));
    assertRC(rc, UNEXPECTED_ERROR, DEFAULT);
}

From source file:com.webbfontaine.valuewebb.report.PDInformationForAnalysisReport.java

@Override
public boolean prepareParameters() {

    if (bean.getFromYear().compareTo(bean.getToYear()) > 0
            || bean.getFromYear().compareTo(bean.getToYear()) == 0
                    && bean.getFromMonth().compareTo(bean.getToMonth()) > 0) {
        infoHandling.setInfoList(Utils.translate("Incorrect interval! Please correct and try again"));
        return false;
    }// w w w  . j  a v  a2s  . c  om

    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
    try {
        fromYearAndMonth.setValue(sdf.parse(bean.getFromYear() + bean.getFromMonth()));

        Date toDate = sdf.parse(bean.getToYear() + bean.getToMonth());

        toDate = DateUtils.addMonths(toDate, 1);
        toDate = DateUtils.addDays(toDate, -1);

        toYearAndMonth.setValue(toDate);
    } catch (ParseException e) {
        LOGGER.warn("", e);
        return false;
    }
    appCountry.setValue(ApplicationProperties.getAppCountry());
    reportLocale.setValue(FR.equals(getLanguage()) ? Locale.FRENCH : Locale.ENGLISH);
    return true;
}