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.puppycrawl.tools.checkstyle.api.LocalizedMessageTest.java

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

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

From source file:org.dspace.core.ContextTest.java

/**
 * Test of setCurrentLocale method, of class Context.
 *//*from ww w.  j  a  v  a  2 s.c  o  m*/
@Test
public void testSetCurrentLocale() {

    //Get previous value
    Locale oldLocale = context.getCurrentLocale();

    //Set a new, non-English value
    Locale newLocale = Locale.FRENCH;
    context.setCurrentLocale(newLocale);

    assertThat("testSetCurrentLocale 0", context.getCurrentLocale(), notNullValue());
    assertThat("testSetCurrentLocale 1", context.getCurrentLocale(), equalTo(newLocale));

    // Restore previous value
    context.setCurrentLocale(oldLocale);
}

From source file:org.apache.velocity.tools.test.whitebox.ConfigTests.java

public @Test void testEasyConfig() {
    EasyFactoryConfiguration easy = new EasyFactoryConfiguration();
    easy.number("version", 2.0);
    easy.toolbox("request").property("locale", Locale.US).tool(ResourceTool.class);
    easy.toolbox("application").tool("calc", MathTool.class).tool(NumberTool.class).property("locale",
            Locale.FRENCH);

    assertValid(easy);//from  w  w  w  . j  a va 2 s  . c o  m
    assertConfigEquals(getBaseConfig(), easy);
}

From source file:org.opencommercesearch.EmbeddedSearchServer.java

public void connect() throws FileNotFoundException {
    InputStream in = null;//from  w ww .  j av a 2  s.com

    try {
        long startTime = System.currentTimeMillis();

        String configUrl = getSolrConfigUrl();
        System.setProperty("jetty.testMode", "true");

        if (getInMemoryIndex()) {
            System.setProperty("solr.directoryFactory", "solr.RAMDirectoryFactory");
            System.setProperty("solr.lockFactory", "single");
            configUrl += ".ram";
            if (isLoggingInfo()) {
                logInfo("Initializing in-memory embedded search server");
            }
        } else {
            if (getDataDir() != null) {
                if (!checkDataDirectory(getDataDir())) {
                    throw new FileNotFoundException("Directory not found " + getDataDir());
                }
                System.setProperty("data.dir", getDataDir());
            }

            if (isLoggingInfo()) {
                logInfo("Initializing embedded search server, data directory is " + getDataDir());
            }
        }

        in = getClass().getResourceAsStream(configUrl);

        if (in != null) {
            File tmpConfigFile = File.createTempFile("solr-", ".xml");

            FileWriter out = new FileWriter(tmpConfigFile);

            IOUtils.copy(in, out);
            if (isLoggingInfo()) {
                logInfo("Using embedded sarch server with config file " + tmpConfigFile.getPath());
            }
            out.close();

            coreContainer = CoreContainer.createAndLoad(getSolrCorePath(), tmpConfigFile);
            tmpConfigFile.delete();
            // @TODO fix this support configurable supported locales
            setCatalogSolrServer(
                    createEmbeddedSolrServer(coreContainer, getCatalogCollection(), Locale.ENGLISH),
                    Locale.ENGLISH);
            setRulesSolrServer(createEmbeddedSolrServer(coreContainer, getRulesCollection(), Locale.ENGLISH),
                    Locale.ENGLISH);
            setCatalogSolrServer(createEmbeddedSolrServer(coreContainer, getCatalogCollection(), Locale.FRENCH),
                    Locale.FRENCH);
            setRulesSolrServer(createEmbeddedSolrServer(coreContainer, getRulesCollection(), Locale.FRENCH),
                    Locale.FRENCH);
        } else {
            throw new FileNotFoundException("Resource not found " + getSolrConfigUrl());
        }

        if (isLoggingInfo()) {
            logInfo("Embedded search server initialized in " + (System.currentTimeMillis() - startTime) + "ms");
        }

    } catch (IOException ex) {
        if (isLoggingError()) {
            logError(ex);
        }
    } finally {
        try {
            if (in != null) {
                in.close();
            }
        } catch (IOException ex) {
            if (isLoggingError()) {
                logError(ex);
            }
        }
    }
}

From source file:org.zoumbox.mh_dla_notifier.MhDlaNotifierUtils.java

public static String formatDLAForDisplay(Context context, Date input) {
    String result = N_C;/*from  w  w w.  j  a v a  2  s  .c o  m*/
    if (input != null) {
        CharSequence format = context.getText(R.string.dla_format);
        DateFormat outputDF = new SimpleDateFormat(format.toString(), Locale.FRENCH);
        outputDF.setTimeZone(getDisplayTimeZone(context));
        result = outputDF.format(input);
    }
    return result;
}

From source file:org.duniter.client.Main.java

protected void initI18n() throws IOException {
    Configuration config = Configuration.instance();

    // --------------------------------------------------------------------//
    // init i18n//  ww  w.j  ava2s. com
    // --------------------------------------------------------------------//
    File i18nDirectory = config.getI18nDirectory();
    if (i18nDirectory.exists()) {
        // clean i18n cache
        FileUtils.cleanDirectory(i18nDirectory);
    }

    FileUtils.forceMkdir(i18nDirectory);

    if (debug) {
        System.out.println("INFO - I18N directory: " + i18nDirectory);
    }

    Locale i18nLocale = config.getI18nLocale();

    // Fix locale
    if (i18nLocale.equals(Locale.FRENCH)) {
        i18nLocale = Locale.FRANCE;
    } else if (i18nLocale.equals(Locale.ENGLISH)) {
        i18nLocale = Locale.UK;
    }

    if (debug) {
        System.out.println(
                String.format("INFO - Starts i18n with locale [%s] at [%s]", i18nLocale, i18nDirectory));
    }
    I18n.init(new UserI18nInitializer(i18nDirectory, new DefaultI18nInitializer(getI18nBundleName())),
            i18nLocale);
}

From source file:org.jahia.modules.external.test.vfs.VFSContentStoreProviderTest.java

private void getCleanSession() throws Exception {
    String defaultLanguage = site.getDefaultLanguage();
    JCRSessionFactory sessionFactory = JCRSessionFactory.getInstance();
    sessionFactory.closeAllSessions();/*from   w  w w.  j a  v  a 2s.c o  m*/
    englishEditSession = sessionFactory.getCurrentUserSession(Constants.EDIT_WORKSPACE, Locale.ENGLISH,
            LanguageCodeConverters.languageCodeToLocale(defaultLanguage));
    frenchEditSession = sessionFactory.getCurrentUserSession(Constants.EDIT_WORKSPACE, Locale.FRENCH,
            LanguageCodeConverters.languageCodeToLocale(defaultLanguage));
}

From source file:org.openmrs.module.webservices.rest.web.ConversionUtilTest.java

/**
 * @see {@link ConversionUtil#convert(Object,Type)}
 * @verifies convert to an array/*from  w w  w.  j a  v a  2s. c o  m*/
 */
@Test
public void convert_shouldConvertToAnArray() throws Exception {
    List<String> input = Arrays.asList("en", "fr");
    Locale[] converted = (Locale[]) ConversionUtil.convert(input, Locale[].class);
    assertThat(converted.length, is(2));
    assertThat(converted[0], is(Locale.ENGLISH));
    assertThat(converted[1], is(Locale.FRENCH));
}

From source file:fr.paris.lutece.plugins.workflow.modules.ticketingfacilfamilles.service.task.TaskAutomaticAssignment.java

@Override
protected String processTicketingTask(int nIdResourceHistory, HttpServletRequest request, Locale locale) {
    String strTaskInformation = null;
    Ticket ticket = getTicket(nIdResourceHistory);

    if ((ticket.getTicketDomain() != null) && ticket.getTicketDomain().getLabel()
            .equalsIgnoreCase(AppPropertiesService.getProperty(PROPERTY_ACCOUNT_NUMBER_DOMAIN_LABEL))) {
        String strSuffix = getTicketAssignCriteria(ticket);

        if (StringUtils.isNotBlank(strSuffix)) {
            AdminUser adminUser = _automaticAssignmentService.getAssignedUser(getId(), strSuffix);

            if (adminUser != null) {
                AssigneeUser assigneeUser = new AssigneeUser(adminUser);
                ticket.setAssigneeUser(assigneeUser);

                List<Unit> listUnit = UnitHome.findByIdUser(adminUser.getUserId());
                AssigneeUnit assigneeUnit = null;

                if ((listUnit != null) && (listUnit.size() > 0)) {
                    assigneeUnit = new AssigneeUnit(listUnit.get(0));
                }//from www  .  j av a  2s.  c o m

                if (assigneeUnit != null) {
                    if (ticket.getAssigneeUnit().getUnitId() != assigneeUnit.getUnitId() && request != null) {
                        request.setAttribute(TicketingConstants.ATTRIBUTE_IS_UNIT_CHANGED, true);
                    }

                    ticket.setAssigneeUnit(assigneeUnit);
                }

                TicketHome.update(ticket);

                strTaskInformation = MessageFormat.format(
                        I18nService.getLocalizedString(MESSAGE_AUTOMATIC_ASSIGN_TICKET_INFORMATION,
                                Locale.FRENCH),
                        adminUser.getFirstName() + " " + adminUser.getLastName(),
                        ticket.getAssigneeUnit().getName());
            }
        }
    }

    return strTaskInformation;
}

From source file:org.richfaces.component.CalendarComponentTest.java

public void testPreloadRanges() throws Exception {
    UICalendar calendar = (UICalendar) application.createComponent(UICalendar.COMPONENT_TYPE);
    calendar.setLocale(Locale.FRENCH);
    Calendar calendarObject = Calendar.getInstance();
    calendarObject.clear();/*from w  ww  . j a  va2 s . c o  m*/
    calendarObject.set(2007, Calendar.JUNE, 10);

    Calendar preloadRangeBegin = Calendar.getInstance();
    preloadRangeBegin.clear();
    preloadRangeBegin.setTime(calendar.getDefaultPreloadBegin(calendarObject.getTime()));
    assertEquals(2007, preloadRangeBegin.get(Calendar.YEAR));
    assertEquals(Calendar.JUNE, preloadRangeBegin.get(Calendar.MONTH));
    assertEquals(1, preloadRangeBegin.get(Calendar.DATE));

    Calendar preloadRangeEnd = Calendar.getInstance();
    preloadRangeEnd.clear();
    preloadRangeEnd.setTime(calendar.getDefaultPreloadEnd(calendarObject.getTime()));
    assertEquals(2007, preloadRangeEnd.get(Calendar.YEAR));
    assertEquals(Calendar.JUNE, preloadRangeEnd.get(Calendar.MONTH));
    assertEquals(30, preloadRangeEnd.get(Calendar.DATE));

    calendarObject.set(2007, Calendar.JANUARY, 1);
    preloadRangeBegin.setTime(calendar.getDefaultPreloadBegin(calendarObject.getTime()));
    assertEquals(2007, preloadRangeBegin.get(Calendar.YEAR));
    assertEquals(Calendar.JANUARY, preloadRangeBegin.get(Calendar.MONTH));
    assertEquals(1, preloadRangeBegin.get(Calendar.DATE));

    calendarObject.set(2007, Calendar.JUNE, 10);
    calendar.setLocale(Locale.US);

    preloadRangeBegin.setTime(calendar.getDefaultPreloadBegin(calendarObject.getTime()));
    assertEquals(2007, preloadRangeBegin.get(Calendar.YEAR));
    assertEquals(Calendar.JUNE, preloadRangeBegin.get(Calendar.MONTH));
    assertEquals(1, preloadRangeBegin.get(Calendar.DATE));

    preloadRangeEnd.setTime(calendar.getDefaultPreloadEnd(calendarObject.getTime()));
    assertEquals(2007, preloadRangeEnd.get(Calendar.YEAR));
    assertEquals(Calendar.JUNE, preloadRangeEnd.get(Calendar.MONTH));
    assertEquals(30, preloadRangeEnd.get(Calendar.DATE));
}