Example usage for java.util Locale ENGLISH

List of usage examples for java.util Locale ENGLISH

Introduction

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

Prototype

Locale ENGLISH

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

Click Source Link

Document

Useful constant for language.

Usage

From source file:de.otto.mongodb.profiler.web.AbstractController.java

protected static long lowerBoundary(int diffHours) {
    final Calendar cal = Calendar.getInstance(Locale.ENGLISH);
    cal.add(Calendar.HOUR, diffHours);
    return cal.getTimeInMillis();
}

From source file:org.vaadin.spring.i18n.TranslatorTest.java

@Test
public void testTranslate() {
    MessageSource messageSource = mock(MessageSource.class);
    when(messageSource.getMessage("privateLabel.caption", null, "", Locale.ENGLISH))
            .thenReturn("Private Label Caption");
    when(messageSource.getMessage("publicLabel.caption", null, "", Locale.ENGLISH))
            .thenReturn("Public Label Caption");
    when(messageSource.getMessage("textField.caption", null, "", Locale.ENGLISH))
            .thenReturn("Text Field Caption");
    when(messageSource.getMessage("textField.description", null, "", Locale.ENGLISH))
            .thenReturn("Text Field Description");
    when(messageSource.getMessage("methodLabel.caption", null, "", Locale.ENGLISH))
            .thenReturn("Method Label Caption");
    when(messageSource.getMessage("methodTextField.caption", null, "", Locale.ENGLISH))
            .thenReturn("Method Text Field Caption");
    when(messageSource.getMessage("methodTextField.description", null, "", Locale.ENGLISH))
            .thenReturn("Method Text Field Description");

    new Translator(this).translate(Locale.ENGLISH, messageSource);

    assertEquals("Private Label Caption", privateLabel.getCaption());
    assertEquals("Public Label Caption", publicLabel.getCaption());
    assertEquals("Text Field Caption", textField.getCaption());
    assertEquals("Text Field Description", textField.getDescription());
    assertEquals("Method Label Caption", methodLabel.getCaption());
    assertEquals("Method Text Field Caption", methodTextField.getCaption());
    assertEquals("Method Text Field Description", methodTextField.getDescription());
}

From source file:ch.ralscha.extdirectspring.provider.RemoteProviderStoreModifyInterface.java

@ExtDirectMethod(value = ExtDirectMethodType.STORE_MODIFY, entryClass = Row.class)
public List<RowInterface> update2(Locale locale, @RequestParam(value = "id") int id,
        final List<RowInterface> rows) {
    assertThat(id).isEqualTo(10);/*from  w  w w. j  a  v  a  2 s. c om*/
    assertThat(locale).isEqualTo(Locale.ENGLISH);
    return rows;
}

From source file:com.asual.summer.core.RequestFilter.java

static String getMethod(HttpServletRequest request, String requestMethod) {
    String method = request.getParameter(methodAttribute);
    if ("POST".equalsIgnoreCase(requestMethod) && !StringUtils.isEmpty(method)) {
        return method.toUpperCase(Locale.ENGLISH);
    }/*from  w  ww .j a v  a  2 s .  com*/
    return requestMethod;
}

From source file:com.liferay.faces.test.hooks.ServiceUtil.java

public static User addUser(long creatorUserId, long companyId, String firstName, String lastName)
        throws Exception {

    boolean autoPassword = false;
    String password1 = "test";
    String password2 = password1;
    boolean autoScreenName = false;
    String screenName = firstName.toLowerCase() + StringPool.PERIOD + lastName.toLowerCase();
    String emailAddress = screenName + StringPool.AT + "liferay.com";
    long facebookId = 0L;
    String openId = StringPool.BLANK;
    Locale locale = Locale.ENGLISH;
    String middleName = StringPool.BLANK;
    int prefixId = 0;
    int suffixId = 0;
    boolean male = true;
    int birthdayMonth = 1;
    int birthdayDay = 1;
    int birthdayYear = 1970;
    String jobTitle = StringPool.BLANK;
    long[] groupIds = new long[] {};
    long[] organizationIds = new long[] {};
    long[] roleIds = new long[] {};
    long[] userGroupIds = new long[] {};
    boolean sendEmail = false;
    ServiceContext serviceContext = new ServiceContext();

    User user = null;//ww  w.  j  av  a  2s.  com

    try {
        user = UserLocalServiceUtil.getUserByScreenName(companyId, screenName);
    } catch (NoSuchUserException e) {
        user = UserLocalServiceUtil.addUser(creatorUserId, companyId, autoPassword, password1, password2,
                autoScreenName, screenName, emailAddress, facebookId, openId, locale, firstName, middleName,
                lastName, prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle,
                groupIds, organizationIds, roleIds, userGroupIds, sendEmail, serviceContext);
        log.info("Added user: " + screenName);
    }

    return user;
}

From source file:it.cnr.isti.smartfed.papers.qbrokage.BrokageLockin.java

public static String executeSingleSetCost(AbstractAllocator allocator, int seed, int numOfCloudlets,
        int numOfDatacenter) {
    int repetitions = 20;

    String str = "";
    int numHost = 100 * numOfDatacenter;
    DataSet dataset = new LockInDatset(numOfCloudlets, numOfDatacenter, numHost, seed);

    Experiment e = new Experiment(allocator, dataset);
    for (int i = 0; i < repetitions; i++) {
        e.setRandomSeed(i);//from   ww  w .jav a  2s  . c o m
        e.run();
    }

    double result = TestResult.getCost().getMean();
    double resultSTD = TestResult.getCost().getStandardDeviation();
    double time = TestResult.getMappingTime().getMean();
    double timeSTD = TestResult.getMappingTime().getStandardDeviation();
    double failure = TestResult.getFailures().getN();
    double berger = TestResult.getBerger().getMean();
    double lockin = TestResult.getLockDegree().getMean();
    str += String.format(Locale.ENGLISH, "%.4f", result) + "\t";
    str += String.format(Locale.ENGLISH, "%.4f", time) + "\t";
    str += String.format(Locale.ENGLISH, "%.4f", lockin) + "\t";
    TestResult.reset();
    return str;
}

From source file:modelibra.swing.app.config.NatLang.java

/**
 * Sets the language with the location for text resources.
 * /*from ww  w  . j a  va 2 s  .  c  o  m*/
 * @param language
 *            language
 * @param textResources
 *            text resources
 */
public void setNaturalLanguage(String language, String textResources) {
    try {
        if ((language == null) || (language.equals("en"))) {
            locale = Locale.ENGLISH;
        } else if (language.equals("fr")) {
            locale = Locale.FRENCH;
        } else if (language.equals("ba")) {
            locale = new Locale("ba"); // bosnian language
        } else if (language.equals("hr")) {
            locale = new Locale("hr"); // croatian language
        } else if (language.equals("sr")) {
            locale = new Locale("sr"); // serbian language
        } else { // other languages are not supported, English used
            locale = Locale.ENGLISH;
        }
        resource = ResourceBundle.getBundle(textResources, locale);
    } catch (MissingResourceException e) {
        System.out.println(e.getMessage());
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
}

From source file:org.openmrs.module.metadatamapping.api.db.hibernate.interceptor.LocalMappingHibernateInterceptorPost19Test.java

@Test
public void shouldRetireConceptReferenceTermIfConceptPurged() {
    //given/*w  w w.  jav  a  2  s. c om*/
    Concept concept = new Concept();
    concept.setConceptClass(conceptService.getConceptClass(1));
    concept.setDatatype(conceptService.getConceptDatatype(1));
    concept.addName(new ConceptName("my-dict-concept", Locale.ENGLISH));
    conceptService.saveConcept(concept);
    Integer id = concept.getId();

    service.addLocalMappingToConcept(concept);

    ConceptReferenceTerm term = conceptService.getConceptReferenceTermByCode(id.toString(), localeSource);
    Assert.assertFalse(term.isRetired());

    //when
    conceptService.purgeConcept(concept);

    //then
    term = conceptService.getConceptReferenceTermByCode(id.toString(), localeSource);
    Assert.assertTrue(term.isRetired());
}

From source file:de.tudarmstadt.ukp.experiments.dip.wp1.documents.Step11GoldDataStatistics.java

/**
 * (1) Plain text with 4 columns: (1) the rank of the document in the list
 * (2) average agreement rate over queries (3) standard deviation of
 * agreement rate over queries. (4) average length of the document in the
 * rank.// w w w .j a v a  2 s.co  m
 */
public static void statistics1(File inputDir, File outputDir) throws Exception {
    SortedMap<Integer, DescriptiveStatistics> mapDocumentRankObservedAgreement = new TreeMap<>();
    SortedMap<Integer, DescriptiveStatistics> mapDocumentRankDocLength = new TreeMap<>();

    // iterate over query containers
    for (File f : FileUtils.listFiles(inputDir, new String[] { "xml" }, false)) {
        QueryResultContainer queryResultContainer = QueryResultContainer
                .fromXML(FileUtils.readFileToString(f, "utf-8"));

        for (QueryResultContainer.SingleRankedResult rankedResult : queryResultContainer.rankedResults) {
            // add new entries
            if (!mapDocumentRankObservedAgreement.containsKey(rankedResult.rank)) {
                mapDocumentRankObservedAgreement.put(rankedResult.rank, new DescriptiveStatistics());
            }
            if (!mapDocumentRankDocLength.containsKey(rankedResult.rank)) {
                mapDocumentRankDocLength.put(rankedResult.rank, new DescriptiveStatistics());
            }

            Double observedAgreement = rankedResult.observedAgreement;

            if (observedAgreement == null) {
                System.err
                        .println("Observed agreement is null; " + f.getName() + ", " + rankedResult.clueWebID);
            } else {
                // update value
                mapDocumentRankObservedAgreement.get(rankedResult.rank).addValue(observedAgreement);
                mapDocumentRankDocLength.get(rankedResult.rank).addValue(rankedResult.plainText.length());
            }
        }
    }

    PrintWriter pw = new PrintWriter(new FileWriter(new File(outputDir, "stats1.csv")));
    for (Map.Entry<Integer, DescriptiveStatistics> entry : mapDocumentRankObservedAgreement.entrySet()) {
        pw.printf(Locale.ENGLISH, "%d\t%.4f\t%.4f\t%.4f\t%.4f%n", entry.getKey(), entry.getValue().getMean(),
                entry.getValue().getStandardDeviation(), mapDocumentRankDocLength.get(entry.getKey()).getMean(),
                mapDocumentRankDocLength.get(entry.getKey()).getStandardDeviation());
    }
    pw.close();
}

From source file:org.hdiv.web.servlet.SimpleWebApplicationContext.java

public void refresh() throws BeansException {
    MutablePropertyValues pvs = new MutablePropertyValues();
    pvs.add("commandClass", "org.hdiv.beans.TestBean");
    pvs.add("formView", "form");
    registerSingleton("/form.do", SimpleFormController.class, pvs);

    registerSingleton("/locale.do", LocaleChecker.class);

    addMessage("test", Locale.ENGLISH, "test message");
    addMessage("test", Locale.CANADA, "Canadian & test message");
    addMessage("testArgs", Locale.ENGLISH, "test {0} message {1}");
    addMessage("testArgsFormat", Locale.ENGLISH, "test {0} message {1,number,#.##} X");

    registerSingleton(UiApplicationContextUtils.THEME_SOURCE_BEAN_NAME, DummyThemeSource.class);

    registerSingleton("handlerMapping", BeanNameUrlHandlerMapping.class);
    registerSingleton("viewResolver", InternalResourceViewResolver.class);

    pvs = new MutablePropertyValues();
    pvs.add("location", "org/hdiv/web/context/WEB-INF/sessionContext.xml");
    registerSingleton("viewResolver2", XmlViewResolver.class, pvs);

    super.refresh();
}