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:uk.q3c.krail.i18n.PropertiesBundleWriterTest.java

@Test
public void write() throws IOException {
    //given/*from  w  w  w  .  j a v  a  2s .c  om*/
    File testOutDir = new File(ResourceUtils.userTempDirectory(), "testOut");
    if (testOutDir.exists()) {
        FileUtils.deleteQuietly(testOutDir);
    }
    File targetDir = new File(ResourceUtils.userTempDirectory(), "testOut/codeModel");
    writer.setOptionWritePath(targetDir);
    Set<Locale> locales = new LinkedHashSet<>();
    locales.add((Locale.ITALIAN));
    locales.add((Locale.GERMAN));
    File referenceFile_de = new File(TestResource.testResourceRootDir("krail"), "TestLabels_de.properties_ref");
    File targetFile_de = new File(targetDir, "TestLabels_de.properties");
    File referenceFile_it = new File(TestResource.testResourceRootDir("krail"), "TestLabels_it.properties_ref");
    File targetFile_it = new File(targetDir, "TestLabels_it.properties");
    //when
    utility.writeOut(writer, TestLabelKey.class, locales, Optional.empty());
    //then
    assertThat(FileTestUtil.compare(referenceFile_de, targetFile_de, 1)).isEqualTo(Optional.empty());
    assertThat(FileTestUtil.compare(referenceFile_it, targetFile_it, 1)).isEqualTo(Optional.empty());
}

From source file:uk.q3c.krail.i18n.DefaultPatternUtilityTest.java

@Test
public void writeOut_locales_provided_all_keys() throws IOException {
    //        given

    File testOutDir = new File(ResourceUtils.userTempDirectory(), "testOut");
    if (testOutDir.exists()) {
        FileUtils.deleteQuietly(testOutDir);
    }/*from   www . j  a  v a2 s.com*/
    File targetDir = new File(ResourceUtils.userTempDirectory(), "testOut/codeModel");
    writer.setOptionWritePath(targetDir);

    Set<Locale> locales = new HashSet<>();
    locales.add(Locale.GERMAN);
    locales.add(Locale.ITALIAN);
    locales.add(Locale.UK);
    locales.add(Locale.forLanguageTag(""));
    File referenceFile = new File(TestResource.testResourceRootDir("krail"), "Labels.ref");
    File targetFile = new File(targetDir, "Labels.java");
    File referenceFile_de = new File(TestResource.testResourceRootDir("krail"), "Labels_de.ref");
    File targetFile_de = new File(targetDir, "Labels_de.java");
    File referenceFile_it = new File(TestResource.testResourceRootDir("krail"), "Labels_it.ref");
    File targetFile_it = new File(targetDir, "Labels_it.java");
    File referenceFile_en_GB = new File(TestResource.testResourceRootDir("krail"), "Labels_en_GB.ref");
    File targetFile_en_GB = new File(targetDir, "Labels_en_GB.java");
    // this is to make sure that setting the default does not mess things up
    Locale.setDefault(Locale.CANADA_FRENCH);

    //when
    utility.writeOut(writer, LabelKey.class, locales, Optional.empty());
    //then line 4 is the timestamp
    assertThat(FileTestUtil.compare(referenceFile, targetFile, 4)).isEqualTo(Optional.empty());
    assertThat(FileTestUtil.compare(referenceFile_de, targetFile_de, 4)).isEqualTo(Optional.empty());
    assertThat(FileTestUtil.compare(referenceFile_it, targetFile_it, 4)).isEqualTo(Optional.empty());
    assertThat(FileTestUtil.compare(referenceFile_en_GB, targetFile_en_GB, 4)).isEqualTo(Optional.empty());
}

From source file:test.unit.be.fedict.eid.applet.MessagesTest.java

@Test
public void testGermanMessages() throws Exception {
    Locale locale = Locale.GERMAN;
    Messages messages = new Messages(locale);
    String message = messages.getMessage(Messages.MESSAGE_ID.INSERT_CARD_QUESTION);
    LOG.debug("message: " + message);
    LOG.debug("connectReader: " + messages.getMessage(Messages.MESSAGE_ID.CONNECT_READER));
}

From source file:de.bessonov.BaseTest.java

@SuppressWarnings("unchecked")
@Before//from  w ww  .  ja v  a2 s.c om
public void setUp() {
    // create new application and init Spring DI
    WicketApplication app = new WicketApplication() {
        @Override
        protected void initSpring() {
            // Bind Spring DI
            getComponentInstantiationListeners().add(new SpringComponentInjector(this, applicationContext));
        };
    };
    tester = new WicketTester(app);
    //tester.setupRequestAndResponse();
    session = (UserSession<UserModel>) tester.getSession();
    session.setLocale(Locale.GERMAN);

    // create test user
    user = new UserModel();
    user.setEmail("test@test.test");
    user.setPassword(userPassword);
}

From source file:test.integ.be.fedict.commons.eid.client.BeIDCardManagerTest.java

@Test
public void testExceptionsInListener() throws Exception {
    final TestLogger logger = new TestLogger();
    final BeIDCardManager beIDCardManager = new BeIDCardManager(logger);
    beIDCardManager.setLocale(Locale.GERMAN);
    final Object waitObject = new Object();
    beIDCardManager//w w  w . j a v a 2  s  .c o m
            .addBeIDCardEventListener(new BeIDCardEventsTestListener(beIDCardManager, waitObject, true, false));
    beIDCardManager.addBeIDCardEventListener(
            new BeIDCardEventsTestListener(beIDCardManager, waitObject, false, false));
    beIDCardManager
            .addBeIDCardEventListener(new BeIDCardEventsTestListener(beIDCardManager, waitObject, false, true));
    beIDCardManager.start();
    synchronized (waitObject) {
        waitObject.wait();
    }
}

From source file:test.unit.be.fedict.eid.tsl.EtsiTslLifecycleTest.java

@Test
public void testLC001() throws Exception {
    // setup//w w w .jav a  2  s .  c om
    TrustServiceList trustServiceList = TrustServiceListFactory.newInstance();

    // scheme operator name
    trustServiceList.setSchemeOperatorName("EN:SchemeOperatorName", Locale.ENGLISH);
    trustServiceList.setSchemeOperatorName("NL:SchemeOperatorName", new Locale("nl"));
    trustServiceList.setSchemeOperatorName("FR:SchemeOperatorName", Locale.FRENCH);
    trustServiceList.setSchemeOperatorName("DE:SchemeOperatorName", Locale.GERMAN);

    // scheme operator postal address
    PostalAddressType schemeOperatorPostalAddress = new PostalAddressType();
    schemeOperatorPostalAddress.setStreetAddress("Maria-Theresiastraat 1/3");
    schemeOperatorPostalAddress.setLocality("Brussels");
    schemeOperatorPostalAddress.setStateOrProvince("Brussels");
    schemeOperatorPostalAddress.setPostalCode("1000");
    schemeOperatorPostalAddress.setCountryName("Belgium");
    trustServiceList.setSchemeOperatorPostalAddress(schemeOperatorPostalAddress, Locale.ENGLISH);

    schemeOperatorPostalAddress.setStreetAddress("Maria-Theresiastraat 1/3");
    schemeOperatorPostalAddress.setLocality("Brussel");
    schemeOperatorPostalAddress.setStateOrProvince("Brussel");
    schemeOperatorPostalAddress.setPostalCode("1000");
    schemeOperatorPostalAddress.setCountryName("Belgi");
    trustServiceList.setSchemeOperatorPostalAddress(schemeOperatorPostalAddress, new Locale("nl"));

    // scheme operator electronic address
    /*
    List<String> electronicAddresses = new LinkedList<String>();
    electronicAddresses.add("http://www.fedict.belgium.be/");
    electronicAddresses.add("mailto://eid@belgium.be");
    */
    trustServiceList.setSchemeOperatorElectronicAddresses(Locale.ENGLISH, "http://www.fedict.belgium.be/");
    trustServiceList.setSchemeOperatorElectronicAddresses(Locale.ENGLISH, "http://www.fedict.belgium.be/");

    // scheme name
    trustServiceList.setSchemeName(
            "BE:Supervision/Accreditation Status List of certification services from Certification Service Providers, which are supervised/accredited by the referenced Scheme Operator Member State for compliance with the relevant provisions laid down in  Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures",
            Locale.ENGLISH);

    // scheme information URIs
    trustServiceList.addSchemeInformationUri("https://www.e-contract.be/tsl/", Locale.ENGLISH);

    // status determination approach
    trustServiceList.setStatusDeterminationApproach(TrustServiceList.STATUS_DETERMINATION_APPROPRIATE);

    // scheme type
    /*
     * The Scheme Type URIs can actually be visited. We should provide some
     * information to ETSI for the BE schemerules.
     */
    trustServiceList.addSchemeType(TrustServiceList.SCHEME_RULE_COMMON, Locale.ENGLISH);
    /*
     * The BE schemerules MUSH be provided. We can add extra paths for
     * language. For example: http://
     * uri.etsi.org/TrstSvc/eSigDir-1999-93-EC-TrustedList/schemerules/BE/nl
     */
    trustServiceList.addSchemeType("http://uri.etsi.org/TrstSvc/eSigDir-1999-93-EC-TrustedList/schemerules/BE",
            Locale.ENGLISH);

    // scheme territory
    trustServiceList.setSchemeTerritory("BE");

    // legal notice
    trustServiceList.addLegalNotice(
            "The applicable legal framework for the present TSL implementation of the Trusted List of supervised/accredited Certification Service Providers for Belgium is the Directive 1999/93/EC of the European Parliament and of the Council of 13 December 1999 on a Community framework for electronic signatures and its implementation in Belgian laws.",
            Locale.ENGLISH);

    // historical information period
    /*
     * Volgens de wet van 9 JULI 2001.  Wet houdende vaststelling van
     * bepaalde regels in verband met het juridisch kader voor elektronische
     * handtekeningen en certificatiediensten: Bijlage II - punt i) alle
     * relevante informatie over een gekwalificeerd certificaat te
     * registreren gedurende de nuttige termijn van dertig jaar, in het
     * bijzonder om een certificatiebewijs te kunnen voorleggen bij
     * gerechtelijke procedures.
     */
    trustServiceList.setHistoricalInformationPeriod(3653 * 3);

    // list issue date time
    DateTime listIssueDateTime = new DateTime();
    trustServiceList.setListIssueDateTime(listIssueDateTime);

    // next update
    DateTime nextUpdateDateTime = listIssueDateTime.plusMonths(6);
    trustServiceList.setNextUpdate(nextUpdateDateTime);

    // distribution point
    File tslFile = File.createTempFile("tsl-LC001-", ".xml");
    trustServiceList.addDistributionPoint("https://www.e-contract.be/tsl/" + tslFile.getName());

    // sign TSL
    KeyPair keyPair = TrustTestUtils.generateKeyPair(2048);
    PrivateKey privateKey = keyPair.getPrivate();
    DateTime notBefore = new DateTime();
    DateTime notAfter = notBefore.plusYears(1);
    X509Certificate certificate = TrustTestUtils.generateSelfSignedCertificate(keyPair,
            "C=BE, CN=Belgium Trust List Scheme Operator", notBefore, notAfter);
    trustServiceList.sign(privateKey, certificate);

    // save TSL
    trustServiceList.saveAs(tslFile);
    LOG.debug("TSL file: " + tslFile.getAbsolutePath());
}

From source file:de.interseroh.report.domain.visitors.RequestParamsBuilderTest.java

@Test
public void testConversionService() throws Exception {
    LocaleContextHolder.setLocale(Locale.GERMAN);

    ParameterForm form = buildTestData();
    parameterFormFormatter.format(form);

    String requestParams = requestParamsBuilder.asRequestParams(form);

    assertThat(requestParams,//from  www .  j a v a 2 s  . co  m
            is("?double=55.5&boolean=false&string=value&dateTime=05.09.15&scalarMULTI=1&scalarMULTI=2"));
}

From source file:org.techytax.helper.AmountHelper.java

public static String formatWithEuroSymbol(BigInteger amount) {
    DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.GERMAN);
    otherSymbols.setDecimalSeparator(',');
    otherSymbols.setGroupingSeparator('.');
    DecimalFormat df = new DecimalFormat(" ###,###,###,##0", otherSymbols);
    return df.format(amount.doubleValue());
}

From source file:de.qaware.chronix.importer.csv.FileImporter.java

/**
 * Constructs a file importer//from   ww w.  j  av a 2 s .c om
 *
 * @param dateFormat  the date format: long for ms since 1970, 'instant' for java 8 instant,
 *                    otherwise simple date format
 * @param numberLocal the number local, e.g. ENGLISH, GERMAN, ...
 */
public FileImporter(String dateFormat, String numberLocal, String csvDelimiter) {
    this.dateFormat = dateFormat;

    if (dateFormat.equalsIgnoreCase("long")) {
        longDate = true;
    } else if (dateFormat.equalsIgnoreCase("instant")) {
        instantDate = true;
    } else {
        sdfDate = true;
    }

    if (numberLocal.equalsIgnoreCase("german")) {
        this.numberLocal = Locale.GERMAN;
    } else {
        this.numberLocal = Locale.ENGLISH;
    }

    this.csvDelimiter = csvDelimiter;

}

From source file:org.openehealth.coala.util.PXSDateConverterImpl.java

/**
 * Converts a PXS date representation into an {@link Date}. The String needs
 * to be at least the length of shortpattern (defined in
 * coala-document.properties).//from   w ww  . jav  a2  s  .co  m
 * 
 * @param pxsDate
 *            the pxs dates string. Must be at least the length of
 *            shortpattern (defined in coala-document.properties) only
 *            contain numbers
 * @return A {@link Date} that represents the same time as the date string
 */
public Date stringToDate(String pxsDate) {
    // Basic Checks
    if (pxsDate == null)
        throw new IllegalArgumentException("pxsDate cannot be null");
    if (pxsDate.length() < shortPattern.length())
        throw new IllegalArgumentException("pxsDate must be at least eight digits long");
    if (!StringUtils.isNumeric(pxsDate))
        throw new IllegalArgumentException("pxsDate must be strictly numeric");

    // Fill pxsDate with trailing zeroes if too short
    while (pxsDate.length() < longPattern.length())
        pxsDate += "0";

    try {
        SimpleDateFormat sdf = new SimpleDateFormat(longPattern, Locale.GERMAN);
        Date result = sdf.parse(pxsDate);
        return result;
    } catch (Exception e) {
        throw new RuntimeException(
                "Could not convert PXS Date representation to java Date. Invalid DateString was: " + pxsDate,
                e);
    }

}