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:carstore.CarStore.java

public CarStore() {
    if (log.isDebugEnabled()) {
        log.debug("Creating main CarStore bean");
        log.debug("Populating locale map");
    }/*from   w w  w  .  ja v  a2  s.  com*/
    locales = new HashMap();
    locales.put("NAmerica", Locale.ENGLISH);
    locales.put("SAmerica", new Locale("es", "es"));
    locales.put("Germany", Locale.GERMAN);
    locales.put("France", Locale.FRENCH);
}

From source file:org.xwiki.search.solr.internal.job.DatabaseDocumentIteratorTest.java

@Test
public void iterateAllWikis() throws Exception {
    Query emptyQuery = mock(Query.class);
    when(emptyQuery.execute()).thenReturn(Collections.emptyList());

    Query chessQuery = mock(Query.class);
    when(chessQuery.setOffset(0)).thenReturn(chessQuery);
    when(chessQuery.setOffset(100)).thenReturn(emptyQuery);
    when(chessQuery.execute()).thenReturn(Arrays.<Object>asList(
            new Object[] { "Blog.Code", "WebHome", "", "3.2" }, new Object[] { "Main", "Welcome", "en", "1.1" },
            new Object[] { "XWiki.Syntax", "Links", "fr", "2.5" }));

    DocumentReference chessBlogCodeWebHome = createDocumentReference("chess", Arrays.asList("Blog", "Code"),
            "WebHome", null);
    DocumentReference chessMainWelcome = createDocumentReference("chess", Arrays.asList("Main"), "Welcome",
            Locale.ENGLISH);//from w  w w.  jav a 2 s .  c  o m
    DocumentReference chessXWikiSyntaxLinks = createDocumentReference("chess", Arrays.asList("XWiki", "Syntax"),
            "Links", Locale.FRENCH);

    Query tennisQuery = mock(Query.class);
    when(tennisQuery.setOffset(0)).thenReturn(tennisQuery);
    when(tennisQuery.setOffset(100)).thenReturn(emptyQuery);
    when(tennisQuery.execute())
            .thenReturn(Arrays.<Object>asList(new Object[] { "Main", "Welcome", "en", "2.1" },
                    new Object[] { "XWiki.Syntax", "Links", "fr", "1.3" }));

    DocumentReference tennisMainWelcome = createDocumentReference("tennis", Arrays.asList("Main"), "Welcome",
            Locale.ENGLISH);
    DocumentReference tennisXWikiSyntaxLinks = createDocumentReference("tennis",
            Arrays.asList("XWiki", "Syntax"), "Links", Locale.FRENCH);

    Query query = mock(Query.class);
    when(query.setLimit(anyInt())).thenReturn(query);
    when(query.getNamedParameters()).thenReturn(Collections.<String, Object>emptyMap());
    when(query.setWiki("chess")).thenReturn(chessQuery);
    when(query.setWiki("tennis")).thenReturn(tennisQuery);

    Query chessCountQuery = mock(Query.class);
    when(chessCountQuery.execute()).thenReturn(Collections.<Object>singletonList(3L));

    Query tennisCountQuery = mock(Query.class);
    when(tennisCountQuery.execute()).thenReturn(Collections.<Object>singletonList(2L));

    Query countQuery = mock(Query.class);
    when(countQuery.addFilter(mocker.<QueryFilter>getInstance(QueryFilter.class, "count")))
            .thenReturn(countQuery);
    when(countQuery.setWiki("chess")).thenReturn(chessCountQuery);
    when(countQuery.setWiki("tennis")).thenReturn(tennisCountQuery);

    QueryManager queryManager = mocker.getInstance(QueryManager.class);
    when(queryManager.createQuery("select doc.space, doc.name, doc.language, doc.version from XWikiDocument doc"
            + " order by doc.space, doc.name, doc.language", Query.HQL)).thenReturn(query);
    when(queryManager.createQuery("", Query.HQL)).thenReturn(countQuery);

    DocumentIterator<String> iterator = mocker.getComponentUnderTest();

    assertEquals(5L, iterator.size());

    List<Pair<DocumentReference, String>> actualResults = new ArrayList<Pair<DocumentReference, String>>();
    while (iterator.hasNext()) {
        actualResults.add(iterator.next());
    }

    List<Pair<DocumentReference, String>> expectedResults = new ArrayList<Pair<DocumentReference, String>>();
    expectedResults.add(new ImmutablePair<DocumentReference, String>(chessBlogCodeWebHome, "3.2"));
    expectedResults.add(new ImmutablePair<DocumentReference, String>(chessMainWelcome, "1.1"));
    expectedResults.add(new ImmutablePair<DocumentReference, String>(chessXWikiSyntaxLinks, "2.5"));
    expectedResults.add(new ImmutablePair<DocumentReference, String>(tennisMainWelcome, "2.1"));
    expectedResults.add(new ImmutablePair<DocumentReference, String>(tennisXWikiSyntaxLinks, "1.3"));

    assertEquals(expectedResults, actualResults);
}

From source file:io.cfp.entity.User.java

@Transient
public Locale getLocale() {
    if (language != null && language.equalsIgnoreCase("franais"))
        return Locale.FRENCH;
    return Locale.ENGLISH;
}

From source file:fr.paris.lutece.plugins.workflow.modules.ticketing.service.task.TaskQualifyTicket.java

@Override
public String processTicketingTask(int nIdResourceHistory, HttpServletRequest request, Locale locale) {
    String strTaskInformation = StringUtils.EMPTY;
    StringBuilder sb = new StringBuilder();

    // We get the ticket to modify
    Ticket ticket = getTicket(nIdResourceHistory);

    if (ticket != null) {
        boolean bPriorityChanged = false;

        String strPriority = request.getParameter(PARAMETER_TICKET_PRIORITY);
        int nPriority = Integer.parseInt(strPriority);
        TicketPriority priorityBefore = TicketPriority.valueOf(ticket.getPriority());
        TicketPriority priorityAfter = TicketPriority.valueOf(nPriority);
        ticket.setPriority(nPriority);/*from w  w w  .  j a va  2 s.  c  o  m*/

        String strCriticality = request.getParameter(PARAMETER_TICKET_CRITICALITY);
        int nCriticality = Integer.parseInt(strCriticality);
        TicketCriticality criticalityBefore = TicketCriticality.valueOf(ticket.getCriticality());
        TicketCriticality criticalityAfter = TicketCriticality.valueOf(nCriticality);
        ticket.setCriticality(nCriticality);

        TicketHome.update(ticket);

        if (priorityBefore != priorityAfter) {
            sb.append(
                    MessageFormat.format(
                            I18nService.getLocalizedString(MESSAGE_QUALIFY_TICKET_INFORMATION_PRIORITY,
                                    Locale.FRENCH),
                            priorityBefore.getLocalizedMessage(Locale.FRENCH),
                            priorityAfter.getLocalizedMessage(Locale.FRENCH)));

            bPriorityChanged = true;
        }

        if (criticalityBefore != criticalityAfter) {
            if (bPriorityChanged) {
                sb.append(NEW_LINE);
            }

            sb.append(MessageFormat.format(
                    I18nService.getLocalizedString(MESSAGE_QUALIFY_TICKET_INFORMATION_CRITICALITY,
                            Locale.FRENCH),
                    criticalityBefore.getLocalizedMessage(Locale.FRENCH),
                    criticalityAfter.getLocalizedMessage(Locale.FRENCH)));
        }

        strTaskInformation = sb.toString();
    }

    return strTaskInformation;
}

From source file:org.obiba.onyx.magma.OnyxAttributeHelper.java

/**
 * Get the locales.//from   w  ww . java  2s.  com
 * @return
 */
private Locale[] getLocales() {
    // TODO get the list of available languages !
    return new Locale[] { Locale.ENGLISH, Locale.FRENCH };
}

From source file:org.onehippo.forge.hst.spring.support.util.HstLocalizationUtilsTest.java

@Test
public void testGetCurrentDefaultResourceBundle_withDifferentLocales() throws Exception {
    requestContext.setPreferredLocale(Locale.ENGLISH);
    ResourceBundle bundleByEnglish1 = HstLocalizationUtils.getCurrentDefaultResourceBundle(englishBundle1);
    assertSame(englishBundle1, bundleByEnglish1);
    ResourceBundle bundleByEnglish2 = HstLocalizationUtils.getCurrentDefaultResourceBundle(englishBundle2);
    assertSame(englishBundle1, bundleByEnglish2);

    requestContext.removeAttribute(HstLocalizationUtils.DEFAULT_RESOURCE_BUNDLE_ATTR);

    requestContext.setPreferredLocale(Locale.FRENCH);
    ResourceBundle bundleByFrench1 = HstLocalizationUtils.getCurrentDefaultResourceBundle(frenchBundle1);
    assertSame(frenchBundle1, bundleByFrench1);
    ResourceBundle bundleByFrench2 = HstLocalizationUtils.getCurrentDefaultResourceBundle(frenchBundle2);
    assertSame(frenchBundle1, bundleByFrench2);
}

From source file:net.sourceforge.pmd.ant.PMDTaskTest.java

@Test
public void testFormatterEncodingWithXML() throws Exception {
    Locale.setDefault(Locale.FRENCH);
    setDefaultCharset("cp1252");

    executeTarget("testFormatterEncodingWithXML");
    String report = FileUtils.readFileToString(currentTempFile(), "UTF-8");
    assertTrue(report.contains("unusedVariableWithmlaut"));
}

From source file:com.puppycrawl.tools.checkstyle.api.LocalizedMessageTest.java

@Test
public void testMessageInFrench() {
    LocalizedMessage localizedMessage = createSampleLocalizedMessage();
    LocalizedMessage.setLocale(Locale.FRENCH);

    assertEquals("Instruction vide.", localizedMessage.getMessage());
}

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

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

    List<ConceptSearchResult> searchResults = emrConceptService.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.pac4j.oauth.client.TestYahooClient.java

@Override
protected void verifyProfile(final UserProfile userProfile) {
    final YahooProfile profile = (YahooProfile) userProfile;
    logger.debug("userProfile : {}", profile);
    assertEquals("PCSXZCYSWC6XUJNMZKRGWVPHNU", profile.getId());
    assertEquals(YahooProfile.class.getSimpleName() + UserProfile.SEPARATOR + "PCSXZCYSWC6XUJNMZKRGWVPHNU",
            profile.getTypedId());/*  w  ww  .j av  a  2 s. c om*/
    assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), YahooProfile.class));
    assertTrue(StringUtils.isNotBlank(profile.getAccessToken()));
    assertCommonProfile(userProfile, "testscribeup@yahoo.fr", "Test", "ScribeUP", "Test ScribeUP", "Test",
            Gender.MALE, Locale.FRANCE, "http://avatars.zenfs.com/users/1DJGkdA6uAAECQWEo8AceAQ==.large.png",
            "http://profile.yahoo.com/PCSXZCYSWC6XUJNMZKRGWVPHNU", "Chatou, Ile-de-France");
    assertEquals("my profile", profile.getAboutMe());
    final List<YahooAddress> addresses = profile.getAddresses();
    assertEquals(2, addresses.size());
    final YahooAddress address = addresses.get(0);
    assertEquals(3, address.getId().intValue());
    assertTrue(address.getCurrent());
    assertEquals(Locale.FRENCH, address.getCountry());
    assertEquals("", address.getState());
    assertEquals("", address.getCity());
    assertEquals("78400", address.getPostalCode());
    assertEquals("", address.getStreet());
    assertEquals("HOME", address.getType());
    assertEquals(1976, profile.getBirthYear().intValue());
    assertEquals("03/10", profile.getBirthdate().toString());
    assertEquals("2012-02-06T12:46:43Z", profile.getCreated().toString());
    assertEquals(37, profile.getDisplayAge().intValue());
    final List<YahooDisclosure> disclosures = profile.getDisclosures();
    assertEquals(2, disclosures.size());
    final YahooDisclosure disclosure = disclosures.get(0);
    assertEquals("1", disclosure.getAcceptance());
    assertEquals("bd", disclosure.getName());
    assertTrue(disclosure.getSeen() instanceof Date);
    assertEquals("1", disclosure.getVersion());
    final List<YahooEmail> emails = profile.getEmails();
    assertEquals(2, emails.size());
    final YahooEmail email = emails.get(1);
    assertEquals(2, email.getId().intValue());
    assertTrue(email.getPrimary());
    assertEquals("testscribeup@yahoo.fr", email.getHandle());
    assertEquals("HOME", email.getType());
    assertEquals(Gender.MALE, profile.getGender());
    final YahooImage image = profile.getImage();
    assertEquals("http://avatars.zenfs.com/users/1DJGkdA6uAAECQWEo8AceAQ==.large.png", image.getImageUrl());
    assertEquals(150, image.getWidth().intValue());
    assertEquals(225, image.getHeight().intValue());
    assertEquals("150x225", image.getSize());
    final List<YahooInterest> interests = profile.getInterests();
    assertEquals(11, interests.size());
    final YahooInterest interest = interests.get(0);
    assertEquals("basic interest", interest.getDeclaredInterests().get(0));
    assertEquals("prfFavHobbies", interest.getInterestCategory());
    assertTrue(profile.getIsConnected());
    assertEquals("2012-02-06T12:46:36Z", profile.getMemberSince().toString());
    assertEquals("Europe/Paris", profile.getTimeZone());
    assertEquals("2012-03-05T14:26:25Z", profile.getUpdated().toString());
    assertEquals("http://social.yahooapis.com/v1/user/PCSXZCYSWC6XUJNMZKRGWVPHNU/profile", profile.getUri());
    assertNotNull(profile.getAccessSecret());
    assertEquals(24, profile.getAttributes().size());
}