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:com.norconex.commons.lang.time.DurationUtil.java

private static String getString(Locale locale, long unitValue, final String key, boolean islong) {
    String k = key;//from w w w  . ja v  a  2 s .  c  om
    if (islong && unitValue > 1) {
        k += "s";
    }
    String pkg = ClassUtils.getPackageName(DurationUtil.class);
    ResourceBundle time;
    if (locale != null && Locale.FRENCH.getLanguage().equals(locale.getLanguage())) {
        time = ResourceBundle.getBundle(pkg + ".time", Locale.FRENCH);
    } else {
        time = ResourceBundle.getBundle(pkg + ".time");
    }
    if (islong) {
        return " " + unitValue + " " + time.getString("timeunit.long." + k);
    }
    return unitValue + time.getString("timeunit.short." + k);
}

From source file:org.pac4j.oauth.client.DropBoxClientIT.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());// w  w  w.  ja 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, "https://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.TaskAssignTicketToUser.java

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

    // 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_USER_NO_CURRENT_USER,
                    Locale.FRENCH);
        } else {//from   ww w.ja  v  a  2s .c om
            strCurrentUser = assigneeUser.getFirstname() + " " + assigneeUser.getLastname();
        }

        AdminUser user = null;

        if (strUserId != null) {
            user = AdminUserHome.findByPrimaryKey(Integer.parseInt(strUserId));
        }

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

                strTaskInformation = MessageFormat.format(
                        I18nService.getLocalizedString(MESSAGE_ASSIGN_TICKET_TO_USER_INFORMATION,
                                Locale.FRENCH),
                        strCurrentUser, assigneeUser.getFirstname() + " " + assigneeUser.getLastname());
            }
        } else {
            // Unassign ticket
            ticket.setAssigneeUser(null);
            TicketHome.update(ticket);

            if (assigneeUser.getAdminUserId() != 0) {
                strTaskInformation = MessageFormat.format(
                        I18nService.getLocalizedString(
                                MESSAGE_ASSIGN_TICKET_TO_USER_INFORMATION_UNASSIGN_TICKET, Locale.FRENCH),
                        strCurrentUser);
            }
        }
    }

    return strTaskInformation;
}

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

/**
 * Test parameters.//from   www . j  a va2 s.  c  o  m
 *
 * @throws Exception
 *           the exception
 */
@Test
public void testParameters() throws Exception {
    ResponseContext rc = lookup.lookup(TEST_CODE, Locale.FRENCH, "Mary", "lamb", "fleece", "white as snow.");
    assertRC(rc, TEST_CODE, MARY);
}

From source file:org.openmrs.module.mirebalaisreports.definitions.InpatientStatsMonthlyReportManagerTest.java

@Before
public void setUpMockMessageSourceService() {
    // org.openmrs.module.reporting.ReportingConstants.GLOBAL_PROPERTY_DEFAULT_LOCALE() will cache this so we need
    // to explicitly clear that cache after the test, to avoid affecting other tests. (The automatic rollback of the
    // DB write will not trigger a GlobalPropertyListener.)
    administrationService.setGlobalProperty(ReportingConstants.DEFAULT_LOCALE_GP_NAME, "fr");

    ServiceContext serviceContext = ServiceContext.getInstance();

    originalMessageSourceService = serviceContext.getMessageSourceService();

    messageSourceService = mock(MessageSourceService.class);
    when(messageSourceService.getMessage("ui.i18n.Location.name.e5db0599-89e8-44fa-bfa2-07e47d63546f", null,
            Locale.FRENCH)).thenReturn("Sal Gason");
    serviceContext.setMessageSourceService(messageSourceService);
}

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

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

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

    if (ticket != null) {
        AssigneeUnit assigneeUnit = new AssigneeUnit();
        Unit unit = UnitHome.findByPrimaryKey(Integer.parseInt(strTargetUnitId));

        if (unit != null) {
            AssigneeUser assigneeUser = ticket.getAssigneeUser();

            String strFormerUserInfos = (assigneeUser == null)
                    ? I18nService.getLocalizedString(MESSAGE_ASSIGN_UP_TICKET_UNKNOWN_FORMER_USER,
                            Locale.FRENCH)
                    : (assigneeUser.getFirstname() + " " + assigneeUser.getLastname());
            strTaskInformation = MessageFormat.format(
                    I18nService.getLocalizedString(MESSAGE_ASSIGN_UP_TICKET_INFORMATION, Locale.FRENCH),
                    strFormerUserInfos, unit.getLabel());

            ticket.setAssignerUser(ticket.getAssigneeUser());
            ticket.setAssignerUnit(ticket.getAssigneeUnit());
            ticket.setAssigneeUser(null);
            assigneeUnit.setUnitId(unit.getIdUnit());
            assigneeUnit.setName(unit.getLabel());
            ticket.setAssigneeUnit(assigneeUnit);
            ticket.setAssigneeUser(null);

            TicketHome.update(ticket);//w  w  w. jav  a  2  s  .co m
        }
    }

    return strTaskInformation;
}

From source file:fr.paris.lutece.plugins.workflow.modules.ticketing.service.task.TaskAssignUnitLinkedToCategory.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();

        if (assigneeUnit == null) {
            assigneeUnit = new AssigneeUnit();
        }/*from w  ww .j  a  v  a2s. c o m*/

        TicketCategory ticketCategory = TicketCategoryHome.findByPrimaryKey(ticket.getIdTicketCategory());

        Unit unit = UnitHome.findByPrimaryKey(ticketCategory.getAssigneeUnit().getUnitId());

        if (unit != null) {
            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_LINKED_TO_CATEGORY_INFORMATION,
                            Locale.FRENCH),
                    assigneeUnit.getName(), ticketCategory.getLabel());
        }
    }

    return strTaskInformation;
}

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

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

    AdminUser user = AdminUserService.getAdminUser(request);
    AdminUser userFront = AdminUserHome.findByPrimaryKey(
            AppPropertiesService.getPropertyInt(TicketingConstants.PROPERTY_ADMINUSER_FRONT_ID, -1));

    if ((user != null) && (user.getUserId() != userFront.getUserId())) {
        _idChannel = Integer.parseInt(request.getParameter(TicketingConstants.PARAMETER_ID_CHANNEL));
    } else {//  w w  w. j av a 2s.c  o  m
        _idChannel = TicketingConstants.WEB_ID_CHANNEL;
    }

    String strChannel = "";

    if (_idChannel != TicketingConstants.NO_ID_CHANNEL) {
        strChannel = ChannelHome.findByPrimaryKey(_idChannel).getLabel();
    }

    strTaskInformation = MessageFormat.format(
            I18nService.getLocalizedString(MESSAGE_SELECT_CHANNEL_INFORMATION_PREFIX, Locale.FRENCH),
            strChannel);

    return strTaskInformation;
}

From source file:com.silverpeas.util.FileUtilTest.java

/**
 * Test of loadBundle method, of class FileUtil.
 *//* w ww.  j a  v  a2 s.  c  om*/
@Test
public void testLoadBundle() {
    String name = "com/stratelia/webactiv/multilang/generalMultilang";
    ResourceBundle result = FileUtil.loadBundle(name, Locale.FRENCH);
    assertNotNull(result);
}

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

@Override
protected 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) {
        String strUserMessage = request.getParameter(PARAMETER_USER_MESSAGE);
        ticket.setUserMessage(strUserMessage);

        TaskReplyConfig config = _taskConfigService.findByPrimaryKey(this.getId());

        if (MessageDirection.AGENT_TO_USER == config.getMessageDirection()) {
            ticket.setTicketStatus(TicketingConstants.TICKET_STATUS_CLOSED);
            ticket.setDateClose(new Timestamp(new java.util.Date().getTime()));
        }/*  ww w  . j a  v a2 s .c o m*/

        TicketHome.update(ticket);

        if (StringUtils.isEmpty(strUserMessage)) {
            strUserMessage = I18nService.getLocalizedString(MESSAGE_REPLY_INFORMATION_NO_MESSAGE,
                    Locale.FRENCH);
        }

        strTaskInformation = MessageFormat.format(
                I18nService.getLocalizedString(MESSAGE_REPLY_INFORMATION_PREFIX
                        + config.getMessageDirection().toString().toLowerCase(), Locale.FRENCH),
                strUserMessage);
    }

    return strTaskInformation;
}