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.squale.welcom.taglib.dropdownpanel.DropDownTitleBarTag.java

/**
 * @see javax.servlet.jsp.tagext.BodyTagSupport#release()
 *//* w w w. java 2  s .co  m*/
public void release() {
    super.release();
    key = "";
    styleClass = "";
    style = "";
    dropDown = null;
    resources = null;
    localeRequest = Locale.FRENCH;
}

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

@Override
public synchronized void add(T object) {
    try {/*from   w  w w.ja  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));
        add(object, indexWriter);
        indexWriter.close();
        directory.close();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

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

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

    assertEquals("Empty statement.", localizedMessage.getMessage());
}

From source file:org.nuxeo.cm.mail.actionpipe.parser.DefaultFrenchMailParser.java

public static Calendar parseDate(String dateString) {
    try {//from w  ww  .jav a  2  s  .c  o m
        log.debug(String.format("Parsing date '%s'", dateString));

        SimpleDateFormat sdf = new SimpleDateFormat(FRENCH_DATE_FORMAT, Locale.FRENCH);
        Date date = sdf.parse(dateString.trim());
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);

        return cal;
    } catch (ParseException e) {
        log.error("Parsing date failed : " + dateString, e);
        return null;
    }
}

From source file:org.pac4j.oauth.client.YahooClientIT.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());/*from   w  w w  . j  a va 2 s .c  o m*/
    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, "/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(38, 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();
    assertTrue(image.getImageUrl().contains("/users/1DJGkdA6uAAECQWEo8AceAQ==.large.png"));
    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("2014-04-21T14:04:30Z", profile.getUpdated().toString());
    assertEquals("https://social.yahooapis.com/v1/user/PCSXZCYSWC6XUJNMZKRGWVPHNU/profile", profile.getUri());
    assertNotNull(profile.getAccessSecret());
    assertEquals(24, profile.getAttributes().size());
}

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

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

    Ticket ticket = getTicket(nIdResourceHistory);

    if (ticket != null) {
        String strNewCategoryId = request.getParameter(PARAMETER_TICKET_CATEGORY_ID);
        int nNewCategoryId = Integer.parseInt(strNewCategoryId);
        String strNewTypeId = request.getParameter(PARAMETER_TICKET_TYPE_ID);
        int nNewTypeId = Integer.parseInt(strNewTypeId);
        String strNewDomainId = request.getParameter(PARAMETER_TICKET_DOMAIN_ID);
        int nNewDomainId = Integer.parseInt(strNewDomainId);

        String strNewTypeLabel = TicketTypeHome.findByPrimaryKey(nNewTypeId).getLabel();
        String strNewDomainLabel = TicketDomainHome.findByPrimaryKey(nNewDomainId).getLabel();
        String strNewCategoryLabel = TicketCategoryHome.findByPrimaryKey(nNewCategoryId).getLabel();

        String strPreviousCategoryLabel = TicketCategoryHome.findByPrimaryKey(ticket.getIdTicketCategory())
                .getLabel();//from  w ww  .  ja va  2  s . co  m
        String strPreviousDomainLabel = TicketDomainHome.findByPrimaryKey(ticket.getIdTicketDomain())
                .getLabel();
        String strPreviousTypeLabel = TicketTypeHome.findByPrimaryKey(ticket.getIdTicketType()).getLabel();

        ticket.setIdTicketType(nNewTypeId);
        ticket.setIdTicketDomain(nNewDomainId);
        ticket.setIdTicketCategory(nNewCategoryId);
        TicketHome.update(ticket);

        if (!strPreviousTypeLabel.equals(strNewTypeLabel) || !strPreviousDomainLabel.equals(strNewDomainLabel)
                || !strPreviousCategoryLabel.equals(strNewCategoryLabel)) {
            strTaskInformation = MessageFormat.format(
                    I18nService.getLocalizedString(MESSAGE_MODIFY_TICKET_CATEGORY_INFORMATION, Locale.FRENCH),
                    strPreviousTypeLabel, strPreviousDomainLabel, strPreviousCategoryLabel, strNewTypeLabel,
                    strNewDomainLabel, strNewCategoryLabel);
        }
    }

    return strTaskInformation;
}

From source file:fr.paris.lutece.plugins.directory.modules.gismap.service.GismapDirectoryService.java

public String getMapTemplateWithDirectoryGismapSources(HttpServletRequest request, String viewId,
        List<DirectoryGismapSourceQuery> listGeojsonSources) {
    Map<String, Object> model = new HashMap<>();

    if (StringUtils.isEmpty(viewId)) {
        return "<span>" + I18nService.getLocalizedString(UNAVAILABILITY_MESSAGE, Locale.FRENCH) + "</span>";
    }//from   ww w . j  a v a 2s  . co  m

    String strDefaultView = AppPropertiesService.getProperty(GISMAP_DEFAULT_VIEW_PROPERTIES, "0");

    View view = ViewHome.findByPrimaryKey(Integer.parseInt(viewId));

    MapParameter tmp = view.getMapParameter();

    String strWSUrl = AppPathService.getBaseUrl(request).concat(GISMAP_URL_REST);

    for (DirectoryGismapSourceQuery geojsonSource : listGeojsonSources) {
        String strIndex = String.valueOf(geojsonSource.getGeoJsonIndex());
        String strIdDirectory = String.valueOf(geojsonSource.getIdDirectory());
        String strIdEntryGeolocation = String.valueOf(geojsonSource.getIdGeolocationEntry());
        String strView = StringUtils.isEmpty(geojsonSource.getView()) ? strDefaultView
                : geojsonSource.getView();

        String strWSUrlWithParams = UriBuilder.fromUri(strWSUrl)
                .queryParam(PARAM_ID_GEOLOCATION_ENTRY, strIdEntryGeolocation)
                .queryParam(PARAM_ID_DIRECTORY, strIdDirectory).queryParam(PARAM_GEOJSONINDEX, strIndex)
                .queryParam(PARAM_VIEW, strView).build().toString();

        tmp.setParameters(PARAM_VIEW_URLGEOJSON.concat(strIndex), "'" + strWSUrlWithParams + "'");
    }

    view.setMapParameter(tmp);

    model.put(PARAMETER_MAP_PARAMETER, view.getMapParameter());
    model.put(PARAMETER_ADD_PARAMETER, view.getAddressParam());
    model.put(PARAMETER_DEFAULT_VIEW, strDefaultView);

    Locale locale = (request == null) ? LocaleService.getDefault() : request.getLocale();
    HtmlTemplate templateList = AppTemplateService.getTemplate(view.getMapTemplateFile(), locale, model);

    return templateList.getHtml();
}

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

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

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

    if (ticket != null) {
        AssigneeUnit assigneeUnit = ticket.getAssigneeUnit();
        AssigneeUser assigneeUser = ticket.getAssigneeUser();
        String strCurrentUnit = null;
        String strCurrentUser = null;

        if (assigneeUnit != null) {
            strCurrentUnit = assigneeUnit.getName();
        }//from   ww  w .  java  2 s.  c om

        if (assigneeUser == null) {
            assigneeUser = new AssigneeUser();
            strCurrentUser = I18nService.getLocalizedString(MESSAGE_REPLY_ASSIGN_TICKET_NO_CURRENT_USER,
                    Locale.FRENCH);
        } else {
            strCurrentUser = assigneeUser.getFirstname() + " " + assigneeUser.getLastname();
        }

        AdminUser user = getAssigner(nIdResourceHistory);

        if ((user != null) && (user.getUserId() != assigneeUser.getAdminUserId())) {
            assigneeUser.setAdminUserId(user.getUserId());
            assigneeUser.setEmail(user.getEmail());
            assigneeUser.setFirstname(user.getFirstName());
            assigneeUser.setLastname(user.getLastName());
            ticket.setAssigneeUser(assigneeUser);

            if (ticket.getAssignerUnit() != null) {
                ticket.setAssigneeUnit(ticket.getAssignerUnit());
            } else {
                List<Unit> unitsList = UnitHome.findByIdUser(user.getUserId());

                if ((unitsList != null) && (unitsList.size() > 0)) {
                    assigneeUnit = new AssigneeUnit(unitsList.get(0));
                    ticket.setAssigneeUnit(assigneeUnit);
                }
            }

            ticket.setAssignerUser(null);
            ticket.setAssignerUnit(null);

            TicketHome.update(ticket);

            strTaskInformation = MessageFormat.format(
                    I18nService.getLocalizedString(MESSAGE_REPLY_ASSIGN_UP_TICKET_INFORMATION, Locale.FRENCH),
                    (strCurrentUnit != null) ? strCurrentUnit : StringUtils.EMPTY,
                    (ticket.getAssigneeUser() != null)
                            ? (ticket.getAssigneeUser().getFirstname() + " "
                                    + ticket.getAssigneeUser().getLastname())
                            : I18nService.getLocalizedString(MESSAGE_REPLY_ASSIGN_TICKET_NO_CURRENT_USER,
                                    Locale.FRENCH),
                    (ticket.getAssigneeUnit() != null) ? ticket.getAssigneeUnit().getName()
                            : StringUtils.EMPTY);
        } else {
            strTaskInformation = I18nService.getLocalizedString(MESSAGE_REPLY_ASSIGN_TICKET_NO_USER_FOUND,
                    Locale.FRENCH);
        }
    }

    request.setAttribute(TicketingConstants.ATTRIBUTE_REDIRECT_AFTER_WORKFLOW_ACTION, REDIRECT_TO_LIST);

    return strTaskInformation;
}

From source file:be.fedict.trust.service.bean.InitializationServiceBean.java

private void initTexts() {

    if (null == this.localizationDAO.findLocalization(TrustServiceConstants.INFO_MESSAGE_KEY)) {
        Map<Locale, String> texts = new HashMap<Locale, String>();
        texts.put(new Locale("es"), "");
        texts.put(Locale.ENGLISH, "");
        texts.put(new Locale("nl"), "");
        texts.put(Locale.FRENCH, "");
        texts.put(Locale.GERMAN, "");
        this.localizationDAO.addLocalization(TrustServiceConstants.INFO_MESSAGE_KEY, texts);
    }//from  w w  w . ja  va  2  s .c  om
}

From source file:org.apache.tiles.definition.TestUrlDefinitionsFactory.java

/**
 * Tests the getDefinition method.//from   w  ww. j a  v  a  2  s  .c om
 *
 * @throws Exception If something goes wrong.
 */
@SuppressWarnings("unchecked")
public void testGetDefinition() throws Exception {
    DefinitionsFactory factory = new UrlDefinitionsFactory();

    // Set up multiple data sources.
    URL url1 = this.getClass().getClassLoader().getResource("org/apache/tiles/config/defs1.xml");
    assertNotNull("Could not load defs1 file.", url1);
    URL url2 = this.getClass().getClassLoader().getResource("org/apache/tiles/config/defs2.xml");
    assertNotNull("Could not load defs2 file.", url2);
    URL url3 = this.getClass().getClassLoader().getResource("org/apache/tiles/config/defs3.xml");
    assertNotNull("Could not load defs3 file.", url3);

    factory.addSource(url1);
    factory.addSource(url2);
    factory.addSource(url3);
    factory.init(Collections.EMPTY_MAP);

    TilesRequestContext emptyContext = new MockOnlyLocaleTilesContext(null);
    TilesRequestContext usContext = new MockOnlyLocaleTilesContext(Locale.US);
    TilesRequestContext frenchContext = new MockOnlyLocaleTilesContext(Locale.FRENCH);
    TilesRequestContext chinaContext = new MockOnlyLocaleTilesContext(Locale.CHINA);
    TilesRequestContext canadaFrenchContext = new MockOnlyLocaleTilesContext(Locale.CANADA_FRENCH);

    assertNotNull("test.def1 definition not found.", factory.getDefinition("test.def1", emptyContext));
    assertNotNull("test.def2 definition not found.", factory.getDefinition("test.def2", emptyContext));
    assertNotNull("test.def3 definition not found.", factory.getDefinition("test.def3", emptyContext));
    assertNotNull("test.common definition not found.", factory.getDefinition("test.common", emptyContext));
    assertNotNull("test.common definition in US locale not found.",
            factory.getDefinition("test.common", usContext));
    assertNotNull("test.common definition in FRENCH locale not found.",
            factory.getDefinition("test.common", frenchContext));
    assertNotNull("test.common definition in CHINA locale not found.",
            factory.getDefinition("test.common", chinaContext));
    assertNotNull("test.common.french definition in FRENCH locale not found.",
            factory.getDefinition("test.common.french", frenchContext));
    assertNotNull("test.common.french definition in CANADA_FRENCH locale not found.",
            factory.getDefinition("test.common.french", canadaFrenchContext));
    assertNotNull("test.def.toextend definition not found.",
            factory.getDefinition("test.def.toextend", emptyContext));
    assertNotNull("test.def.overridden definition not found.",
            factory.getDefinition("test.def.overridden", emptyContext));
    assertNotNull("test.def.overridden definition in FRENCH locale not found.",
            factory.getDefinition("test.def.overridden", frenchContext));

    assertEquals("Incorrect default country value", "default",
            factory.getDefinition("test.def1", emptyContext).getAttribute("country").getValue());
    assertEquals("Incorrect US country value", "US",
            factory.getDefinition("test.def1", usContext).getAttribute("country").getValue());
    assertEquals("Incorrect France country value", "France",
            factory.getDefinition("test.def1", frenchContext).getAttribute("country").getValue());
    assertEquals("Incorrect Chinese country value (should be default)", "default",
            factory.getDefinition("test.def1", chinaContext).getAttribute("country").getValue());
    assertEquals("Incorrect default country value", "default",
            factory.getDefinition("test.def.overridden", emptyContext).getAttribute("country").getValue());
    assertEquals("Incorrect default title value", "Definition to be overridden",
            factory.getDefinition("test.def.overridden", emptyContext).getAttribute("title").getValue());
    assertEquals("Incorrect France country value", "France",
            factory.getDefinition("test.def.overridden", frenchContext).getAttribute("country").getValue());
    assertEquals("Incorrect France title value", "Definition to be extended",
            factory.getDefinition("test.def.overridden", frenchContext).getAttribute("title").getValue());
}