Example usage for java.util Locale GERMAN

List of usage examples for java.util Locale GERMAN

Introduction

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

Prototype

Locale GERMAN

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

Click Source Link

Document

Useful constant for language.

Usage

From source file:be.fedict.trust.service.bean.InitializationServiceBean.java

private void initTexts() {

    if (null == this.localizationDAO.findLocalization(TrustServiceConstants.INFO_MESSAGE_KEY)) {
        Map<Locale, String> texts = new HashMap<Locale, String>();
        texts.put(new Locale("es"), "");
        texts.put(Locale.ENGLISH, "");
        texts.put(new Locale("nl"), "");
        texts.put(Locale.FRENCH, "");
        texts.put(Locale.GERMAN, "");
        this.localizationDAO.addLocalization(TrustServiceConstants.INFO_MESSAGE_KEY, texts);
    }/* w ww  .  j a v a2 s.  c  o m*/
}

From source file:de.hybris.platform.servicelayer.internal.model.extractor.impl.DefaultCascaderTest.java

@Before
public void setUp() throws Exception {
    getOrCreateLanguage("de");
    //prepare UNSAVED models
    customer = modelService.create(CustomerModel.class);
    customer.setUid("Jan");
    customer.setDescription("Customer for cascader test");

    ad1 = modelService.create(AddressModel.class);
    ad1.setOwner(customer);//from ww  w.jav  a  2  s . c  o  m
    ad1.setStreetname("1111");

    ad2 = modelService.create(AddressModel.class);
    ad2.setOwner(customer);
    ad2.setStreetname("2222");

    ad3 = modelService.create(AddressModel.class);
    ad3.setOwner(customer);
    ad3.setStreetname("3333");

    customer.setAddresses(Arrays.asList(ad1, ad2, ad3));
    customer.setDefaultPaymentAddress(ad1);
    customer.setDefaultShipmentAddress(ad2);

    //prepare Unsaved models with localized references
    cat1 = modelService.create(CategoryModel.class);
    keywEN1 = modelService.create(KeywordModel.class);
    keywEN2 = modelService.create(KeywordModel.class);
    keywDE1 = modelService.create(KeywordModel.class);
    keywDE2 = modelService.create(KeywordModel.class);
    cat1.setKeywords(Arrays.asList(keywEN1, keywEN2), Locale.ENGLISH);
    cat1.setKeywords(Arrays.asList(keywDE1, keywDE2), Locale.GERMAN);

    //prepare relations
    country1 = modelService.create(CountryModel.class);
    country1.setActive(Boolean.TRUE);
    country1.setIsocode("c1");
    region1 = modelService.create(RegionModel.class);
    region1.setActive(Boolean.TRUE);
    region1.setCountry(country1);
    region1.setIsocode("r1");
    region2 = modelService.create(RegionModel.class);
    region2.setActive(Boolean.TRUE);
    region2.setCountry(country1);
    region2.setIsocode("r2");
    country1.setRegions(Arrays.asList(region1, region2));
}

From source file:software.coolstuff.springframework.owncloud.service.impl.rest.OwncloudRestResourceServiceTest.java

@Override
protected void prepare_listRoot_OK(List<OwncloudTestResourceImpl> expectedOwncloudResources) throws Exception {
    List<DavResource> expectedDavResources = expectedOwncloudResources.stream()
            .map(owncloudResource -> createDavResourceFrom(owncloudResource, Locale.GERMAN))
            .collect(Collectors.toList());
    Mockito.when(sardine.list(getResourcePath())).thenReturn(expectedDavResources);
}

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

@Test
public void getWithLocale_passedLocaleIsResolved() {
    when(applicationContext.getMessage("myCode", new Object[] { "myArg" }, Locale.GERMAN))
            .thenReturn("myGermanMessage");
    when(applicationContext.getMessage("myCode", new Object[] { "myArg" }, Locale.US))
            .thenReturn("myUsMessage");

    Locale locale = Locale.GERMAN;
    assertEquals("myGermanMessage", i18n.getWithLocale("myCode", locale, "myArg"));
    locale = Locale.US;//w w  w  . j  ava 2s.  co  m
    assertEquals("myUsMessage", i18n.getWithLocale("myCode", locale, "myArg"));
}

From source file:me.vertretungsplan.parser.ParserUtils.java

static LocalDate parseDate(String string) {
    if (string == null)
        return null;
    reinitIfNeeded();/*from  ww  w.j av  a  2s.c  om*/

    string = string.replace("Stand:", "").replace("Import:", "").replaceAll(", Woche [A-Z]", "").trim();
    int i = 0;
    for (DateTimeFormatter f : dateFormatters) {
        try {
            LocalDate d = f.parseLocalDate(string);
            if (dateFormats[i].contains("yyyy")) {
                return d;
            } else {
                Duration currentYearDifference = abs(new Duration(DateTime.now(), d.toDateTimeAtCurrentTime()));
                Duration lastYearDifference = abs(
                        new Duration(DateTime.now(), d.minusYears(1).toDateTimeAtCurrentTime()));
                Duration nextYearDifference = abs(
                        new Duration(DateTime.now(), d.plusYears(1).toDateTimeAtCurrentTime()));
                if (lastYearDifference.isShorterThan(currentYearDifference)) {
                    return DateTimeFormat.forPattern(dateFormats[i]).withLocale(Locale.GERMAN)
                            .withDefaultYear(f.getDefaultYear() - 1).parseLocalDate(string);
                } else if (nextYearDifference.isShorterThan(currentYearDifference)) {
                    return DateTimeFormat.forPattern(dateFormats[i]).withLocale(Locale.GERMAN)
                            .withDefaultYear(f.getDefaultYear() + 1).parseLocalDate(string);
                } else {
                    return d;
                }
            }
        } catch (IllegalArgumentException e) {
            // Does not match this format, try the next one
        }
        i++;
    }
    // Does not match any known format :(
    return null;
}

From source file:test.be.fedict.eid.applet.PcscTest.java

@Test
public void pcscAuthnSignature() throws Exception {
    this.messages = new Messages(Locale.GERMAN);
    PcscEid pcscEid = new PcscEid(new TestView(), this.messages);
    if (false == pcscEid.isEidPresent()) {
        LOG.debug("insert eID card");
        pcscEid.waitForEidPresent();//w  w  w .  j av a  2  s .  com
    }
    byte[] challenge = "hello world".getBytes();
    byte[] signatureValue;
    List<X509Certificate> authnCertChain;
    try {
        // pcscEid.logoff();
        // pcscEid.selectBelpicJavaCardApplet();
        signatureValue = pcscEid.signAuthn(challenge);

        long t0 = System.currentTimeMillis();
        pcscEid.signAuthn(challenge);
        long t1 = System.currentTimeMillis();
        LOG.debug("dt: " + (t1 - t0));

        authnCertChain = pcscEid.getAuthnCertificateChain();
        LOG.debug("key size: " + authnCertChain.get(0).getPublicKey().getEncoded().length * 8);
        // pcscEid.logoff();
    } finally {
        pcscEid.close();
    }

    Signature signature = Signature.getInstance("SHA1withRSA");
    signature.initVerify(authnCertChain.get(0).getPublicKey());
    signature.update(challenge);
    boolean result = signature.verify(signatureValue);
    assertTrue(result);
    LOG.debug("sha1 hex: " + DigestUtils.shaHex(authnCertChain.get(0).getPublicKey().getEncoded()));
}

From source file:com.salesmanager.core.module.impl.application.currencies.GenericCurrencyModule.java

public String getFormatedAmount(BigDecimal amount) throws Exception {
    // TODO Auto-generated method stub
    NumberFormat nf = null;//  ww w .j  a v a2 s  . c  o  m

    Locale locale = Locale.US;

    if (this.decimalPoint == ',') {
        locale = Locale.GERMAN;
    }

    nf = NumberFormat.getInstance(locale);

    nf.setMaximumFractionDigits(Integer.parseInt(Character.toString(decimalCount)));
    nf.setMinimumFractionDigits(Integer.parseInt(Character.toString(decimalCount)));

    return nf.format(amount);
}

From source file:org.n52.oxf.render.sos.ProportionalCircleMapRenderer.java

private Image renderLegend(ObservationSeriesCollection obsValues, String observedProperty) {

    double lowestValue = (Double) obsValues.getMinimum(0);
    double highestValue = (Double) obsValues.getMaximum(0);

    double classDistance = (highestValue - lowestValue) / (NUMBER_OF_CLASSES - 2);
    int dotSizeDistance = (MAX_DOT_SIZE - MIN_DOT_SIZE) / (NUMBER_OF_CLASSES - 2);

    BufferedImage image = new BufferedImage(LEGEND_WIDTH, LEGEND_HEIGHT, BufferedImage.TYPE_INT_RGB);

    Graphics2D g = image.createGraphics();

    // draw white background:
    g.setColor(Color.WHITE);/*  ww w .  j a v a  2  s.c  o m*/
    g.fillRect(0, 0, LEGEND_WIDTH, LEGEND_HEIGHT);

    // draw information:
    observedProperty = observedProperty.split(":")[observedProperty.split(":").length - 1];
    g.setColor(Color.BLACK);
    g.drawString("Observed Property:   '" + observedProperty + "'", 25, 25);

    for (int i = 1; i <= NUMBER_OF_CLASSES; i++) {
        // draw text:
        int x_stringLocation = 100;
        int y_location = i * 60;
        g.setColor(Color.BLACK);

        DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(Locale.GERMAN);
        df.applyPattern("#,###,##0.00");

        double lowerBorder = lowestValue + classDistance * (i - 1);
        double upperBorder = lowestValue + classDistance * i;

        g.drawString(i + ". class: " + df.format(lowerBorder) + " - " + df.format(upperBorder),
                x_stringLocation, y_location + 10);

        // draw symbol:
        int x_symbolLocation = 30;
        g.setColor(POINT_INNER_COLOR);
        g.fillOval(x_symbolLocation, y_location, i * dotSizeDistance, i * dotSizeDistance);
    }

    return image;
}

From source file:de.iteratec.iteraplan.MockTestDataFactory.java

public <T> T generateTestObject(Class<T> clazz) {
    T obj = null;//w  w  w  . j  av a  2s. c  om
    try {
        obj = clazz.newInstance();

        for (Method m : clazz.getMethods()) {
            if (m.getName().startsWith("set") && !m.getName().endsWith("Id")
                    && (m.getParameterTypes().length == 1)) {
                int rn = random.nextInt() * 10000;
                Class<?> param = m.getParameterTypes()[0];
                String nm = param.getSimpleName();
                if (("String").equals(nm)) {
                    m.invoke(obj,
                            new Object[] {
                                    clazz.getSimpleName() + "." + m.getName().substring(3, 4).toLowerCase()
                                            + m.getName().substring(4) + "." + rn });
                } else if (("long").equals(nm) || ("int").equals(nm) || ("double").equals(nm)) {
                    m.invoke(obj, new Object[] { Integer.valueOf(rn) });
                } else if (("Long").equals(nm)) {
                    m.invoke(obj, new Object[] { Long.valueOf(rn) });
                } else if (("Integer").equals(nm)) {
                    m.invoke(obj, new Object[] { Integer.valueOf(rn) });
                } else if (("boolean").equals(nm)) {
                    m.invoke(obj, new Object[] { Boolean.TRUE });
                } else if (("Boolean").equals(nm)) {
                    m.invoke(obj, new Object[] { Boolean.TRUE });
                } else if (("Locale").equals(nm)) {
                    m.invoke(obj, new Object[] { Locale.GERMAN });
                } else if (("RuntimePeriod").equals(nm)) {
                    m.invoke(obj, new Object[] { new RuntimePeriod(new Date(), new Date()) });
                }
            }
        }
    } catch (InvocationTargetException e) {
        LOGGER.error(e);
    } catch (IllegalArgumentException e) {
        LOGGER.error(e);
    } catch (IllegalAccessException e) {
        LOGGER.error(e);
    } catch (InstantiationException e) {
        LOGGER.error(e);
    }
    return obj;
}