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:com.github.rvesse.airline.restrictions.common.AllowedRawValuesRestriction.java

public AllowedRawValuesRestriction(boolean ignoreCase, Locale locale, String... values) {
    super(ignoreCase);
    if (locale == null)
        locale = Locale.ENGLISH;
    this.locale = locale;
    for (String value : values) {
        if (ignoreCase)
            value = value.toLowerCase(locale);
        rawValues.add(value);/*from  ww  w  .  j a  v  a2s. c  o m*/
    }
}

From source file:be.ceau.chart.enums.BorderJoinStyle.java

private BorderJoinStyle() {
    this.serialized = name().toLowerCase(Locale.ENGLISH);
}

From source file:hr.fer.zemris.vhdllab.platform.i18n.LocalizationSupport.java

protected final String getMessageCodeFromSimpleClassName() {
    if (cached == null) {
        String className = getClass().getSimpleName();
        String altered = alterSimpleClassName(className);
        StringBuilder code = new StringBuilder(altered.length() + 30);
        String[] split = StringUtils.splitByCharacterTypeCamelCase(altered);
        for (String part : split) {
            part = part.toLowerCase(Locale.ENGLISH);
            code.append(part).append(PART_SEPARATOR);
        }/*from   www .  j a v  a2  s.  c  o  m*/
        if (split.length > 0) {
            code.deleteCharAt(code.length() - 1);
        }
        cached = alterMessageCode(code.toString());
    }
    return cached;
}

From source file:hr.diskobolos.model.listener.MemberRegisterListener.java

@PrePersist
private void beforePersistOfMemberRegister(Object object) {
    AutowireHelper.autowire(this, this.membershipCategoryService, this.sportService, this.messageSource);
    if (object instanceof MemberRegister) {
        MemberRegister memberRegister = (MemberRegister) object;

        if (memberRegister.getMembershipCategory().getId() == null) {
            MembershipCategory membershipCategory = membershipCategoryService
                    .findMembershipCategoryByDescription(
                            messageSource.getMessage(UNKNOWN, null, Locale.ENGLISH));
            memberRegister.setMembershipCategory(membershipCategory);
        }//from w ww  .  java 2  s  .  co m

        if (memberRegister.getSportCategory().getId() == null) {
            Sport sport = sportService.findSportByName(messageSource.getMessage(UNKNOWN, null, Locale.ENGLISH));
            memberRegister.setSportCategory(sport);
        }
    }
}

From source file:com.carlomicieli.jtrains.value.objects.LocalizedFieldSerializationTests.java

@Test
public void shouldDeserializeLocalizedFieldsContainStrings() throws IOException {
    LocalizedField<String> field = parseLocalizedField("{\"en\": \"Hello\", \"it\": \"Ciao\"}", String.class);
    assertThat(field).hasSize(2).containsEntry(Locale.ENGLISH, "Hello").containsEntry(Locale.ITALIAN, "Ciao");
}

From source file:neembuu.httpserver.VFSHandler.java

@Override
public void handle(final HttpRequest request, final HttpResponse response, final HttpContext context)
        throws HttpException, IOException {

    String method = request.getRequestLine().getMethod().toUpperCase(Locale.ENGLISH);
    if (!method.equals("GET") && !method.equals("HEAD") && !method.equals("POST")) {
        throw new MethodNotSupportedException(method + " method not supported");
    }//w w w. j a va  2 s.  c o  m
    String target = request.getRequestLine().getUri();

    if (request instanceof HttpEntityEnclosingRequest) {
        HttpEntity entity = ((HttpEntityEnclosingRequest) request).getEntity();
        byte[] entityContent = EntityUtils.toByteArray(entity);
        System.out.println("Incoming entity content (bytes): " + entityContent.length);
    }

    String filePath = URLDecoder.decode(target, "UTF-8");
    FileAttributesProvider fap = fs.open(filePath.split("/"));
    if (fap == null) {
        response.setStatusCode(HttpStatus.SC_NOT_FOUND);
        StringEntity entity = new StringEntity(
                "<html><body><h1>File" + filePath + " not found</h1></body></html>",
                ContentType.create("text/html", "UTF-8"));
        response.setEntity(entity);
        System.out.println("File " + filePath + " not found");

    } else if (fap.getFileType() != FileType.FILE || !(fap instanceof AbstractFile)) {

        response.setStatusCode(HttpStatus.SC_FORBIDDEN);
        StringEntity entity = new StringEntity("<html><body><h1>Access denied</h1></body></html>",
                ContentType.create("text/html", "UTF-8"));
        response.setEntity(entity);
        System.out.println("Cannot read file " + filePath + " fap=" + fap);

    } else {
        long offset = Utils.standardOffsetResponse(request, response, fap.getFileSize());
        response.setStatusCode(HttpStatus.SC_OK);
        VFileEntity body = new VFileEntity((AbstractFile) fap, offset);
        response.setEntity(body);
        System.out.println("Serving file " + filePath);
    }
}

From source file:com.googlecode.wickedcharts.highcharts.jackson.HighchartsColorReferenceSerializer.java

@Override
protected void serializeIfNotNull(final HighchartsColor color, final JsonGenerator jgen,
        final SerializerProvider provider) throws IOException, JsonProcessingException {
    if (color.getBrightness() == null) {
        jgen.writeRawValue(String.format(HIGHCHARTS_COLOR, color.getHighchartsIndex()));
    } else {//from  w w  w .  j  a  v a2 s  . c  om
        String colorString = String.format(Locale.ENGLISH, HIGHCHARTS_COLOR, color.getHighchartsIndex());
        colorString = brighten(colorString, color.getBrightness());
        jgen.writeRawValue(colorString);
    }

}

From source file:be.ceau.chart.enums.Easing.java

private Easing() {
    StringBuilder sb = new StringBuilder();
    for (String s : name().split("_")) {
        if (sb.length() == 0) {
            sb.append(s.toLowerCase(Locale.ENGLISH));
        } else {/*from w  w  w . ja v a  2  s.c o  m*/
            sb.append(s.substring(0, 1).toUpperCase(Locale.ENGLISH));
            sb.append(s.substring(1).toLowerCase(Locale.ENGLISH));
        }
    }
    this.serialized = sb.toString();
}

From source file:com.github.tomakehurst.wiremock.common.SafeNames.java

public static String makeSafeName(String name) {
    String nowhitespace = WHITESPACE.matcher(name).replaceAll("-");
    String normalized = Normalizer.normalize(nowhitespace, Normalizer.Form.NFD);
    String slug = sanitise(normalized);

    slug = slug.replaceAll("^[_]*", "");
    slug = slug.replaceAll("[_]*$", "");

    slug = StringUtils.truncate(slug, 200);

    return slug.toLowerCase(Locale.ENGLISH);
}

From source file:org.obiba.onyx.engine.StageTest.java

/**
 * Tests that the returned stage description is localized.
 *///from www . j av a2  s. c  o  m
@Test
public void testGetDescription() {
    Stage heightMeasurementStage = new Stage();
    heightMeasurementStage.setName("Height_Measurement");

    MessageSourceResolvable resolvableDescription = heightMeasurementStage.getDescription();

    String expectedEnglishLocalizedStageDescription = "Height Measurement";
    applicationContextMock.setMessage(expectedEnglishLocalizedStageDescription);

    String actualEnglishLocalizedStageDescription = applicationContextMock.getMessage(resolvableDescription,
            Locale.ENGLISH);
    Assert.assertEquals(expectedEnglishLocalizedStageDescription, actualEnglishLocalizedStageDescription);

    // TODO: Substitute true French translation when it is added to the resource bundle
    String expectedFrenchLocalizedStageDescription = "fr:Height Measurement";
    applicationContextMock.setMessage(expectedFrenchLocalizedStageDescription);
    String actualFrenchLocalizedStageDescription = applicationContextMock.getMessage(resolvableDescription,
            Locale.FRENCH);

    Assert.assertEquals(expectedFrenchLocalizedStageDescription, actualFrenchLocalizedStageDescription);
}