List of usage examples for java.util Locale FRENCH
Locale FRENCH
To view the source code for java.util Locale FRENCH.
Click Source Link
From source file:org.nuxeo.ecm.user.RestPassword.java
@POST @Path("sendPasswordMail") @Produces("text/html") public Object sendPasswordMail() throws ClientException { FormData formData = getContext().getForm(); String email = formData.getString("EmailAddress"); if (email == null || "".equals(email.trim())) { return redisplayFormWithErrorMessage("newPasswordRequest", ctx.getMessage("label.registerForm.validation.email"), formData); }//from w ww . j av a 2s.c o m email = email.trim(); CreatePasswordResetLinkUnrestricted runner = new CreatePasswordResetLinkUnrestricted( getDefaultRepositoryName(), email); runner.runUnrestricted(); String errorMessage = runner.getErrorMessage(); if (errorMessage != null) { return redisplayFormWithErrorMessage("newPasswordRequest", ctx.getMessage(errorMessage), formData); } else { String passwordResetLink = runner.getPasswordResetLink(); String subject; Template template; if (ctx.getLocale().equals(Locale.FRENCH)) { template = getView("mail/passwordForgotten_fr"); subject = "Nuxeo - Votre nouveau mot de passe"; } else { template = getView("mail/passwordForgotten"); subject = "Nuxeo - Your new password"; } String message = template.arg("passwordResetLink", passwordResetLink).render(); try { sendEmail(email, subject, message); } catch (MessagingException e) { // issue while sending the mail log.error("Sending Registration E-Mail Error", e); return Response.status(500).build(); } return redisplayFormWithInfoMessage("newPasswordRequest", ctx.getMessage("label.sendPasswordMail.emailSent"), formData); } }
From source file:net.sourceforge.vulcan.core.support.AxisLabelGeneratorTest.java
public void testLabelThreeMonthsAlternateLocale() throws Exception { fakeDateFormats.put("fr:axis.by.month", "MMM yyyy"); locale = Locale.FRENCH; DateFormat df = new SimpleDateFormat("MMM yyyy", locale); String dec = df.format(new GregorianCalendar(2001, GregorianCalendar.DECEMBER, 1).getTime()); assertLabels(DateUtils.MILLIS_PER_DAY * 90, "oct. 2001", "nov. 2001", dec, "janv. 2002"); }
From source file:guru.bubl.module.model.UserTest.java
@Test public void can_get_preferred_locales_of_user() throws Exception { User user = User.withEmail("some_email@example.org") .setPreferredLocales(new JSONArray().put("fr").toString()); assertTrue(user.getPreferredLocales().contains(Locale.FRENCH)); }
From source file:org.pac4j.oauth.client.TestDropBoxClient.java
@Override protected void verifyProfile(final UserProfile userProfile) { final DropBoxProfile profile = (DropBoxProfile) userProfile; logger.debug("userProfile : {}", profile); assertEquals("75206624", profile.getId()); assertEquals(DropBoxProfile.class.getSimpleName() + UserProfile.SEPARATOR + "75206624", profile.getTypedId());//from w ww. j a v a2 s. c o m assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), DropBoxProfile.class)); assertTrue(StringUtils.isNotBlank(profile.getAccessToken())); assertCommonProfile(userProfile, null, null, null, "Test ScribeUP", null, Gender.UNSPECIFIED, Locale.FRENCH, null, "http://db.tt/RvmZyvJa", null); assertEquals(0L, profile.getShared().longValue()); assertEquals(1410412L, profile.getNormal().longValue()); assertEquals(2147483648L, profile.getQuota().longValue()); assertNotNull(profile.getAccessSecret()); assertEquals(8, profile.getAttributes().size()); }
From source file:fr.paris.lutece.plugins.workflow.modules.ticketing.service.task.TaskGenerateTicketReference.java
@Override public String processTicketingTask(int nIdResourceHistory, HttpServletRequest request, Locale locale) { String strReference = StringUtils.EMPTY; // We get the ticket to modify Ticket ticket = getTicket(nIdResourceHistory); if (ticket != null) { synchronized (_ticketReferenceService) { strReference = _ticketReferenceService.generateReference(ticket); ticket.setReference(strReference); TicketHome.update(ticket);/* ww w . j a v a 2 s. co m*/ } _idChannel = ticket.getIdChannel(); } return MessageFormat.format( I18nService.getLocalizedString(MESSAGE_GENERATE_TICKET_REFERENCE_INFORMATION, Locale.FRENCH), strReference); }
From source file:eu.trentorise.opendata.semtext.jackson.test.SemTextModuleTest.java
@Test public void testUnregisteredMetadata() throws IOException { Meaning m1 = Meaning.of("a", MeaningKind.ENTITY, 0.2, Dict.of(Locale.ITALIAN, "a"), Dict.of(Locale.FRENCH, "b"), ImmutableMap.of("testns", Dict.of("s"))); try {// ww w . j a v a 2s. co m OdtJacksonTester.testJsonConv(objectMapper, LOG, m1); Assert.fail("Should have complained about unregistered namespace!"); } catch (Exception ex) { } try { SemTextModule.getMetadataTypeReference(Sentence.class, "a"); Assert.fail(); } catch (NotFoundException ex) { } }
From source file:org.onehippo.forge.hst.spring.support.util.HstLocalizationUtilsTest.java
@Test public void testGetCurrentDefaultResourceBundle_withFrenchLocale() throws Exception { requestContext.setPreferredLocale(Locale.FRENCH); ResourceBundle bundleByFrench1 = HstLocalizationUtils.getCurrentDefaultResourceBundle(frenchBundle1); assertSame(frenchBundle1, bundleByFrench1); ResourceBundle bundleByFrench2 = HstLocalizationUtils.getCurrentDefaultResourceBundle(frenchBundle2); assertSame(frenchBundle1, bundleByFrench2); }
From source file:fr.paris.lutece.plugins.workflow.modules.ticketing.service.task.TaskAssignTicketToUnit.java
@Override public String processTicketingTask(int nIdResourceHistory, HttpServletRequest request, Locale locale) { String strTaskInformation = StringUtils.EMPTY; String strUnitId = request.getParameter(PARAMETER_ASSIGNEE_UNIT); // We get the ticket to modify Ticket ticket = getTicket(nIdResourceHistory); if (ticket != null) { AssigneeUnit assigneeUnit = ticket.getAssigneeUnit(); String strCurrentUnit = null; if (assigneeUnit == null) { assigneeUnit = new AssigneeUnit(); strCurrentUnit = I18nService.getLocalizedString(MESSAGE_ASSIGN_TICKET_TO_UNIT_NO_CURRENT_UNIT, Locale.FRENCH); } else {//from w w w .java 2s. co m strCurrentUnit = assigneeUnit.getName(); } Unit unit = null; if (strUnitId != null) { unit = UnitHome.findByPrimaryKey(Integer.parseInt(strUnitId)); } if (unit != null) { if (unit.getIdUnit() != assigneeUnit.getUnitId()) { assigneeUnit.setUnitId(unit.getIdUnit()); assigneeUnit.setName(unit.getLabel()); ticket.setAssigneeUnit(assigneeUnit); ticket.setAssigneeUser(null); TicketHome.update(ticket); strTaskInformation = MessageFormat.format(I18nService .getLocalizedString(MESSAGE_ASSIGN_TICKET_TO_UNIT_INFORMATION, Locale.FRENCH), strCurrentUnit, assigneeUnit.getName()); } } } return strTaskInformation; }
From source file:fr.paris.lutece.plugins.workflow.modules.ticketing.service.task.TaskAssignTicketToMe.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) { AssigneeUser assigneeUser = ticket.getAssigneeUser(); String strCurrentUser = null; if (assigneeUser == null) { assigneeUser = new AssigneeUser(); strCurrentUser = I18nService.getLocalizedString(MESSAGE_ASSIGN_TICKET_TO_ME_NO_CURRENT_USER, Locale.FRENCH); } else {//w w w . j a va2s . c om strCurrentUser = assigneeUser.getFirstname() + " " + assigneeUser.getLastname(); } AdminUser user = AdminUserService.getAdminUser(request); 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); List<Unit> unitsList = UnitHome.findByIdUser(user.getUserId()); if ((unitsList != null) && (unitsList.size() > 0)) { AssigneeUnit assigneeUnit = new AssigneeUnit(unitsList.get(0)); ticket.setAssigneeUnit(assigneeUnit); } TicketHome.update(ticket); strTaskInformation = MessageFormat.format( I18nService.getLocalizedString(MESSAGE_ASSIGN_TICKET_TO_ME_INFORMATION, Locale.FRENCH), strCurrentUser, assigneeUser.getFirstname() + " " + assigneeUser.getLastname()); } } return strTaskInformation; }
From source file:org.pac4j.oauth.client.TestTwitterClient.java
@Override protected void verifyProfile(final UserProfile userProfile) { final TwitterProfile profile = (TwitterProfile) userProfile; logger.debug("userProfile : {}", profile); assertEquals("488358057", profile.getId()); assertEquals(TwitterProfile.class.getSimpleName() + UserProfile.SEPARATOR + "488358057", profile.getTypedId());/* www. j a v a2 s .c o m*/ assertTrue(ProfileHelper.isTypedIdOf(profile.getTypedId(), TwitterProfile.class)); assertTrue(StringUtils.isNotBlank(profile.getAccessToken())); assertCommonProfile(userProfile, null, null, null, "test scribeUP", "testscribeUP", Gender.UNSPECIFIED, Locale.FRENCH, "http://a0.twimg.com/sticky/default_profile_images/default_profile_5_normal.png", "http://github.com/leleuj", "New York"); assertFalse(profile.getContributorsEnabled()); assertEquals(TestsHelper.getFormattedDate(1328872224000L, "EEE MMM dd HH:mm:ss Z yyyy", Locale.US), profile.getCreatedAt().toString()); assertTrue(profile.getDefaultProfile()); assertTrue(profile.getDefaultProfileImage()); assertEquals("biographie", profile.getDescription()); assertEquals(0, profile.getFavouritesCount().intValue()); assertFalse(profile.getFollowRequestSent()); assertEquals(0, profile.getFollowersCount().intValue()); assertFalse(profile.getFollowing()); assertEquals(0, profile.getFriendsCount().intValue()); assertFalse(profile.getGeoEnabled()); assertFalse(profile.getIsTranslator()); assertEquals(0, profile.getListedCount().intValue()); assertFalse(profile.getNotifications()); assertTrue(profile.getProfileBackgroundColor() instanceof Color); assertEquals("http://a0.twimg.com/images/themes/theme1/bg.png", profile.getProfileBackgroundImageUrl()); assertEquals("https://twimg0-a.akamaihd.net/images/themes/theme1/bg.png", profile.getProfileBackgroundImageUrlHttps()); assertFalse(profile.getProfileBackgroundTile()); assertEquals("https://twimg0-a.akamaihd.net/sticky/default_profile_images/default_profile_5_normal.png", profile.getProfileImageUrlHttps()); assertTrue(profile.getProfileLinkColor() instanceof Color); assertTrue(profile.getProfileSidebarBorderColor() instanceof Color); assertTrue(profile.getProfileSidebarFillColor() instanceof Color); assertTrue(profile.getProfileTextColor() instanceof Color); assertTrue(profile.getProfileUseBackgroundImage()); assertTrue(profile.getProtected()); assertNull(profile.getShowAllInlineMedia()); assertEquals(0, profile.getStatusesCount().intValue()); assertEquals("Amsterdam", profile.getTimeZone()); assertEquals(3600, profile.getUtcOffset().intValue()); assertFalse(profile.getVerified()); assertNotNull(profile.getAccessSecret()); assertEquals(37, profile.getAttributes().size()); }