Example usage for java.util Locale FRANCE

List of usage examples for java.util Locale FRANCE

Introduction

In this page you can find the example usage for java.util Locale FRANCE.

Prototype

Locale FRANCE

To view the source code for java.util Locale FRANCE.

Click Source Link

Document

Useful constant for country.

Usage

From source file:org.ocelotds.marshalling.ArgumentServicesTest.java

/**
 * Test of getJsonResultFromSpecificMarshaller method, of class ArgumentServices.
 *
 * @throws org.ocelotds.marshalling.exceptions.JsonMarshallerException
 * @throws org.ocelotds.marshalling.exceptions.JsonMarshallingException
 */// w  w w .j a  va2 s .  c o m
@Test(expected = JsonMarshallerException.class)
public void testGetJsonResultFromSpecificMarshallerFail()
        throws JsonMarshallerException, JsonMarshallingException {
    System.out.println("getJsonResultFromSpecificMarshaller");
    doThrow(JsonMarshallerException.class).when(instance).getIJsonMarshallerInstance(any(Class.class));
    JsonMarshaller jm = mock(JsonMarshaller.class);
    when(jm.value()).thenReturn((Class) BadMarshaller1.class);
    instance.getJsonResultFromSpecificMarshaller(jm, Locale.FRANCE);
}

From source file:org.ocelotds.marshalling.ArgumentServicesTest.java

/**
 * Test of getJsonResultFromSpecificMarshaller method, of class ArgumentServices.
 *
 * @throws java.lang.Exception/*from  www  . j  av  a2  s .  c o m*/
 */
@Test
public void testGetJsonResultFromSpecificMarshallerIterable() throws Exception {
    System.out.println("getJsonResultFromSpecificMarshallerIterable");
    IJsonMarshaller ijm = mock(IJsonMarshaller.class);
    when(ijm.toJson(anyObject())).thenReturn("\"JSON\"");
    List<Locale> locales = Arrays.asList(Locale.FRANCE, Locale.US);
    String result = instance.getJsonResultFromSpecificMarshallerIterable(locales, ijm);
    assertThat(result).isEqualTo("[\"JSON\",\"JSON\"]");
}

From source file:hk.idv.kenson.jrconsole.Console.java

/**
 * /*from  ww w.j a v  a  2 s .  c  om*/
 * @param localeString
 * @return
 */
private static Locale getLocale(String localeString) {
    if ("default".equals(localeString))
        return Locale.getDefault();
    if ("canada".equals(localeString))
        return Locale.CANADA;
    if ("canada_french".equals(localeString))
        return Locale.CANADA_FRENCH;
    if ("china".equals(localeString))
        return Locale.CHINA;
    if ("chinese".equals(localeString))
        return Locale.CHINESE;
    if ("english".equals(localeString))
        return Locale.ENGLISH;
    if ("franch".equals(localeString))
        return Locale.FRANCE;
    if ("german".equals(localeString))
        return Locale.GERMAN;
    if ("germany".equals(localeString))
        return Locale.GERMANY;
    if ("italian".equals(localeString))
        return Locale.ITALIAN;
    if ("italy".equals(localeString))
        return Locale.ITALY;
    if ("japan".equals(localeString))
        return Locale.JAPAN;
    if ("japanese".equals(localeString))
        return Locale.JAPANESE;
    if ("korea".equals(localeString))
        return Locale.KOREA;
    if ("korean".equals(localeString))
        return Locale.KOREAN;
    if ("prc".equals(localeString))
        return Locale.PRC;
    if ("simplified_chinese".equals(localeString))
        return Locale.SIMPLIFIED_CHINESE;
    if ("taiwan".equals(localeString))
        return Locale.TAIWAN;
    if ("traditional_chinese".equals(localeString))
        return Locale.TRADITIONAL_CHINESE;
    if ("uk".equals(localeString))
        return Locale.UK;
    if ("us".equals(localeString))
        return Locale.US;

    String parts[] = localeString.split("_", -1);
    if (parts.length == 1)
        return new Locale(parts[0]);
    else if (parts.length == 2)
        return new Locale(parts[0], parts[1]);
    else
        return new Locale(parts[0], parts[1], parts[2]);
}

From source file:fr.bde_eseo.eseomega.events.EventItem.java

public String getMonthHeader() {
    SimpleDateFormat sdf = new SimpleDateFormat("MMMM yyyy", Locale.FRANCE);
    return sdf.format(this.date).toUpperCase(Locale.FRANCE);
}

From source file:fr.paris.lutece.portal.web.admin.AdminPageJspBeanTest.java

public void testGetRemovePage() {
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter(Parameters.PAGE_ID, Integer.toString(_page.getId()));
    _bean.getRemovePage(request);//from ww  w  .jav a2  s  . c om
    AdminMessage message = AdminMessageService.getMessage(request);
    assertNotNull(message);
    assertNotNull(message.getRequestParameters().get(SecurityTokenService.PARAMETER_TOKEN));
    assertEquals(AdminMessage.TYPE_CONFIRMATION, message.getType());
    ReferenceList listLanguages = I18nService.getAdminLocales(Locale.FRANCE);
    for (ReferenceItem lang : listLanguages) {
        assertTrue(message.getText(new Locale(lang.getCode())).contains(_randomPageName));
    }
}

From source file:org.talend.dataquality.statistics.type.TypeInferenceUtilsTest.java

@Test
public void testIsDateWithCustomAndLocale() throws Exception {
    String date = "fvr..12.2014=";
    assertFalse(TypeInferenceUtils.isDate(date));
    assertTrue(TypeInferenceUtils.isDate(date, Collections.singletonList("MMM.dd.yyyy="), Locale.FRANCE));
}

From source file:fr.bde_eseo.eseomega.events.EventItem.java

public String getTimeAsString(Date d) {
    SimpleDateFormat sdf = new SimpleDateFormat("HH':'mm", Locale.FRANCE);
    String sDate = sdf.format(d);
    if (sDate.equals(HOUR_PASS_ALLDAY))
        sDate = "";
    return sDate;
}

From source file:org.talend.dataquality.statistics.type.TypeInferenceUtilsTest.java

@Test
public void testIsDateWithCustomAndWrongLocale() throws Exception {
    String date = "Feb.12.2014=";
    assertFalse(TypeInferenceUtils.isDate(date));
    assertTrue(TypeInferenceUtils.isDate(date, Collections.singletonList("MMM.dd.yyyy="), Locale.FRANCE));
}

From source file:org.jraf.irondad.handler.pixgame.PixGameHandler.java

private void guess(Connection connection, HandlerContext handlerContext, String channel, String fromNickname,
        String guess) throws IOException {
    mGuessCount++;//from w ww .j av  a 2  s  .c  om
    if (!StringUtils.stripAccents(mSearchTerms.toLowerCase(Locale.FRANCE))
            .equals(StringUtils.stripAccents(guess.toLowerCase(Locale.FRANCE)))) {
        // Lost
        connection.send(Command.PRIVMSG, channel, fromNickname + ": WRONG.");

        if (mGuessCount >= mSearchResultCount) {
            connection.send(Command.PRIVMSG, channel, "Well there are no more results.  You lose, after "
                    + mGuessCount + " guesses!  The secret search was \"" + mSearchTerms + "\"...  FAIL.");
            resetGame();
            return;
        }

        switch (mGuessCount) {
        case GUESSES_FIRST_HINT:
            int nbWords = mSearchTerms.split("\\s+").length;
            connection.send(Command.PRIVMSG, channel, "Ok since you guys suck, here's an hint: the search has "
                    + nbWords + " word" + (nbWords == 1 ? "." : "s."));
            break;

        case GUESSES_SECOND_HINT:
            connection.send(Command.PRIVMSG, channel,
                    "Ok since you guys suck, here's another hint: the search looks like this: \""
                            + getSecondHint() + "\".");
            break;

        case GUESSES_THIRD_HINT:
            connection.send(Command.PRIVMSG, channel,
                    "Ok I'll give you one last hint: the search looks like this: \"" + getThirdHint() + "\".");
            break;

        case GUESSES_MAX:
            connection.send(Command.PRIVMSG, channel, "Ok you guys suck too much.  You lose, after "
                    + mGuessCount + " guesses!  The secret search was \"" + mSearchTerms + "\"...  FAIL.");
            resetGame();
            return;

        }

        if (mGuessCount % RESULT_SIZE == 0) {
            // Fetch a new results page
            queryGoogle(handlerContext, connection, mSearchTerms);
        }

        connection.send(Command.PRIVMSG, channel,
                hideUrl(mSearchResults.get(mGuessCount % RESULT_SIZE).getLink()));
    } else {
        // Won
        connection.send(Command.PRIVMSG, channel, fromNickname + ": YES!  The secret search was \""
                + mSearchTerms + "\".  It was found in " + mGuessCount + " guesses.  Congrats!");
        resetGame();
    }
}

From source file:org.ocelotds.marshalling.ArgumentServicesTest.java

@Test
public void testGetJavaResultFromSpecificUnmarshallerIterable() throws JsonUnmarshallingException {
    System.out.println("getJavaResultFromSpecificUnmarshallerIterable");
    LocaleMarshaller lm = new LocaleMarshaller();
    String json = "[{\"country\":\"FR\",\"language\":\"fr\"},{\"country\":\"FR\",\"language\":\"fr\"},{\"country\":\"FR\",\"language\":\"fr\"}]";
    List result = instance.getJavaResultFromSpecificUnmarshallerIterable(json, lm);
    assertThat(result).hasSize(3);// ww w  . java  2 s  .  co  m
    for (Object object : result) {
        assertThat(object).isEqualTo(Locale.FRANCE);
    }
}