Java Code Examples for java.util.Locale#FRENCH

The following examples show how to use java.util.Locale#FRENCH . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Test method for {@link org.apache.pluto.container.om.portlet.impl.jsr168.UserDataConstraintImpl#addDescription(org.apache.pluto.container.om.portlet.Description)}.
 */
@Test
public void testAddDescription() {
   Locale loc = Locale.FRENCH;
   String text = "Some description";
   Description d = new DescriptionImpl(loc, text);
   udc.addDescription(d);

   List<Description> list = udc.getDescriptions();
   assertNotNull(list);
   assertEquals(2, list.size());
   for (Description desc : list) {
      if (desc.getLocale().equals(loc)) {
         assertEquals(text, desc.getText());
      } else {
         assertEquals("description", desc.getText());
      }
   }
}
 
Example 2
@Override
protected void start() throws IllegalAccessException {

  super.start();

  if (batch.getHrBatch().getDayNumber() == null
      || batch.getHrBatch().getDayNumber() == BigDecimal.ZERO
      || batch.getHrBatch().getLeaveReason() == null)
    TraceBackService.trace(
        new AxelorException(
            TraceBackRepository.CATEGORY_CONFIGURATION_ERROR,
            I18n.get(IExceptionMessage.BATCH_MISSING_FIELD)),
        ExceptionOriginRepository.LEAVE_MANAGEMENT,
        batch.getId());
  total = 0;
  noValueAnomaly = 0;
  confAnomaly = 0;
  this.maker = new TemplateMaker(Locale.FRENCH, TEMPLATE_DELIMITER, TEMPLATE_DELIMITER);
  hrConfig =
      Beans.get(HRConfigRepository.class)
          .all()
          .filter("self.company.id = ?1 ", batch.getHrBatch().getCompany().getId())
          .fetchOne();
  checkPoint();
}
 
Example 3
/**
 * Test method for {@link org.apache.pluto.container.om.portlet.impl.jsr168.CustomPortletModeImpl#addDescription(org.apache.pluto.container.om.portlet.Description)}.
 */
@Test
public void testAddDescription() {
   assertEquals(1, pad.getCustomPortletModes().size());
   CustomPortletMode cpm = 
         new CustomPortletModeImpl(pad.getCustomPortletModes().get(0));
   assertEquals(1, cpm.getDescriptions().size());
   Locale loc = Locale.FRENCH;
   String text = "Some description";
   Description d = new DescriptionImpl(loc, text);
   cpm.addDescription(d);
   
   List<Description> list = cpm.getDescriptions();
   assertNotNull(list);
   assertEquals(2, list.size());
   for (Description desc : list) {
      if (desc.getLocale().equals(loc)) {
         assertEquals(text, desc.getText());
      } else {
         assertEquals("description", desc.getText());
      }
   }

}
 
Example 4
@DataProvider(name = "locale")
private Object[][] locale() {
    return new Object[][]{
            {Locale.ENGLISH},
            {Locale.FRENCH},
    };
}
 
Example 5
public void test_ParseText() {
    Locale[] locales = new Locale[] { Locale.ENGLISH, Locale.JAPANESE, Locale.FRENCH };
    Set<String> zids = ZoneRulesProvider.getAvailableZoneIds();
    for (Locale locale : locales) {
        parseText(zids, locale, TextStyle.FULL, false);
        parseText(zids, locale, TextStyle.FULL, true);
        parseText(zids, locale, TextStyle.SHORT, false);
        parseText(zids, locale, TextStyle.SHORT, true);
    }
}
 
Example 6
@Test
public void allFRMessagesPresent() {
	MessageTag[] values = MessageTag.values();
	assertNotNull(values);
	assertTrue(values.length > 0);
	
	// all messages that are not defined in the language-related messages_*.properties
	// will be overridden by default values
	I18nProvider i18nFRProvider = new I18nProvider(Locale.FRENCH);
	for (MessageTag messageTag : values) {
		String message = i18nFRProvider.getMessage(messageTag);
		assertNotNull(message, "A message property for a MessageTag with id [" + messageTag.getId() + "] is not defined!");
	}
}
 
Example 7
@Test
public void testLoadStopwords() throws IOException {
	Language language = new Language(Locale.FRENCH);
	Set<String> swords = language.getStopWords();
	assertNotNull(swords);
	assertEquals(126, swords.size());
}
 
Example 8
@Test
public void nestedMessageTagTest() {
	Locale systemLocale = Locale.getDefault();
	try {
		Locale.setDefault(Locale.ENGLISH);
		
		MessageTag validationTime = MessageTag.VT_VALIDATION_TIME;
		MessageTag messageTag = MessageTag.CERT_QUALIFICATION_AT_TIME.setArgs(validationTime);
	
		final I18nProvider i18nProvider = new I18nProvider(Locale.ENGLISH);
		String message = i18nProvider.getMessage(messageTag);
		assertNotNull(message);
		assertEquals("Certificate Qualification at validation time", message);
		
		final I18nProvider i18nFrenchProvider = new I18nProvider(Locale.FRENCH);
		message = i18nFrenchProvider.getMessage(messageTag);
		assertNotNull(message);
		assertEquals("Qualification du certificat au moment de la validation", message);

		final I18nProvider i18nGermanProvider = new I18nProvider(Locale.GERMAN);
		message = i18nGermanProvider.getMessage(messageTag);
		assertNotNull(message);
		assertEquals("Certificate Qualification at validation time", message);
	} finally {
		Locale.setDefault(systemLocale); // restore default
	}
}
 
Example 9
Source Project: apollo   File: DateParserTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testParseWithFormatAndLocale() throws Exception {
  Date someDate = assembleDate(2016, 9, 28, 15, 10, 10, 123);
  Locale someLocale = Locale.FRENCH;
  String someFormat = "EEE, d MMM yyyy HH:mm:ss.SSS Z";
  SimpleDateFormat someDateFormat = new SimpleDateFormat(someFormat, someLocale);
  String dateText = someDateFormat.format(someDate);

  checkWithFormatAndLocale(someDate, dateText, someFormat, someLocale);
}
 
Example 10
@Override
protected Locale getLocale() {
    return Locale.FRENCH;
}
 
Example 11
@Override
protected Locale getLocale() {
    return Locale.FRENCH;
}
 
Example 12
protected Locale getLocale() {
    return Locale.FRENCH;
}
 
Example 13
@Override
protected Locale getLocale() {
    return Locale.FRENCH;
}
 
Example 14
@Override
protected Locale getLocale() {
    return Locale.FRENCH;
}
 
Example 15
@Override
protected Locale getLocale() {
    return Locale.FRENCH;
}
 
Example 16
private Locale getLocale(String localeName) {
    String language, country;
    int index;

    index = localeName.indexOf('_');
    if (index == -1) {
        //
        // Special case the builtin JDK languages
        //
        if (localeName.equals("de"))
            return Locale.GERMAN;
        if (localeName.equals("en"))
            return Locale.ENGLISH;
        if (localeName.equals("fr"))
            return Locale.FRENCH;
        if (localeName.equals("it"))
            return Locale.ITALIAN;
        if (localeName.equals("ja"))
            return Locale.JAPANESE;
        if (localeName.equals("ko"))
            return Locale.KOREAN;
        if (localeName.equals("zh"))
            return Locale.CHINESE;

        language = localeName;
        country = "";
    } else {
        if (localeName.equals("zh_CN"))
            return Locale.SIMPLIFIED_CHINESE;
        if (localeName.equals("zh_TW"))
            return Locale.TRADITIONAL_CHINESE;

        //
        // JDK also has constants for countries:  en_GB, en_US, en_CA,
        // fr_FR, fr_CA, de_DE, ja_JP, ko_KR.  We don't use those.
        //
        language = localeName.substring(0, index);
        country = localeName.substring(index + 1);
    }

    return new Locale(language, country);
}
 
Example 17
@Override
protected Locale getLocale() {
    return Locale.FRENCH;
}
 
Example 18
private Locale getLocale(String localeName) {
    String language, country;
    int index;

    index = localeName.indexOf('_');
    if (index == -1) {
        //
        // Special case the builtin JDK languages
        //
        if (localeName.equals("de"))
            return Locale.GERMAN;
        if (localeName.equals("en"))
            return Locale.ENGLISH;
        if (localeName.equals("fr"))
            return Locale.FRENCH;
        if (localeName.equals("it"))
            return Locale.ITALIAN;
        if (localeName.equals("ja"))
            return Locale.JAPANESE;
        if (localeName.equals("ko"))
            return Locale.KOREAN;
        if (localeName.equals("zh"))
            return Locale.CHINESE;

        language = localeName;
        country = "";
    } else {
        if (localeName.equals("zh_CN"))
            return Locale.SIMPLIFIED_CHINESE;
        if (localeName.equals("zh_TW"))
            return Locale.TRADITIONAL_CHINESE;

        //
        // JDK also has constants for countries:  en_GB, en_US, en_CA,
        // fr_FR, fr_CA, de_DE, ja_JP, ko_KR.  We don't use those.
        //
        language = localeName.substring(0, index);
        country = localeName.substring(index + 1);
    }

    return new Locale(language, country);
}
 
Example 19
@Override
public Locale getLocale() {
    return Locale.FRENCH;
}
 
Example 20
@Override
protected Locale getLocale() {
    return Locale.FRENCH;
}