List of usage examples for java.util Locale GERMAN
Locale GERMAN
To view the source code for java.util Locale GERMAN.
Click Source Link
From source file:org.echocat.velma.Resources.java
@Nonnull protected ResourceBundles loadBundles(@Nonnull Class<?> inRelationTo) { final ResourceBundlesFactory factory = new ResourceBundlesFactory(new RecursiveResourceBundleFactory()); factory.setLocales(newHashSet(null, Locale.GERMAN)); return factory.getFor(inRelationTo); }
From source file:org.techytax.helper.AmountHelper.java
public static String format(int amount) { DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.GERMAN); otherSymbols.setDecimalSeparator(','); otherSymbols.setGroupingSeparator('.'); DecimalFormat df = new DecimalFormat("###,###,###,##0", otherSymbols); return df.format(amount); }
From source file:me.vertretungsplan.parser.ParserUtils.java
static LocalDateTime parseDateTime(String string) { if (string == null) return null; reinitIfNeeded();/*from w ww. java 2s . c om*/ string = string.replace("Stand:", "").replace("Import:", "").trim(); int i = 0; for (DateTimeFormatter f : dateTimeFormatters) { try { LocalDateTime dt = f.parseLocalDateTime(string); if (dateTimeFormats[i].contains("yyyy")) { return dt; } else { Duration currentYearDifference = abs(new Duration(DateTime.now(), dt.toDateTime())); Duration lastYearDifference = abs(new Duration(DateTime.now(), dt.minusYears(1).toDateTime())); Duration nextYearDifference = abs(new Duration(DateTime.now(), dt.plusYears(1).toDateTime())); if (lastYearDifference.isShorterThan(currentYearDifference)) { return DateTimeFormat.forPattern(dateTimeFormats[i]).withLocale(Locale.GERMAN) .withDefaultYear(f.getDefaultYear() - 1).parseLocalDateTime(string); } else if (nextYearDifference.isShorterThan(currentYearDifference)) { return DateTimeFormat.forPattern(dateTimeFormats[i]).withLocale(Locale.GERMAN) .withDefaultYear(f.getDefaultYear() + 1).parseLocalDateTime(string); } else { return dt; } } } catch (IllegalArgumentException e) { // Does not match this format, try the next one } i++; } // Does not match any known format :( return null; }
From source file:de.fhg.iais.asc.workflow.AbstractScan.java
@Override public final boolean acceptFile(File file) { if (this.config == null) { return true; }/*from www .j a v a 2s . c o m*/ StringBuffer pathBuffer = new StringBuffer(File.separator); String sourceFolder = this.config.get(AscConfiguration.SOURCE_FOLDER, this.config.get(AscConfiguration.FORMAT, "")); if (!StringUtils.isEmpty(sourceFolder)) { pathBuffer.append(sourceFolder).append(File.separator); } String event = this.config.get(AscConfiguration.INGEST_EVENT, ""); if (!StringUtils.isEmpty(event) && !event.contains("*")) { pathBuffer.append(event).append(File.separator); } String pathToTest = pathBuffer.toString(); String absolutePath = file.getAbsolutePath(); boolean result = absolutePath.contains(pathToTest) && !file.getName().startsWith("toc_") && absolutePath.toLowerCase(Locale.GERMAN).endsWith(".xml"); // Ensure maxfiles handling if (result && this.maxfiles > 0 && this.counter >= this.maxfiles) { return false; } this.counter++; return result; }
From source file:de.fhg.iais.commons.fs.FileSystemScanner.java
private void expandFileMask(String[] in) { if (in == null) { return;//from www.j a v a2 s . c om } this.patterns = new Pattern[in.length]; for (int i = 0; i < in.length; i++) { String p = in[i].toLowerCase(Locale.GERMAN); p = StringUtils.replace(p, ".", "\\."); p = StringUtils.replace(p, "?", ".?"); p = StringUtils.replace(p, "*", ".*"); this.patterns[i] = Pattern.compile(p); } }
From source file:com.robestone.hudson.compactcolumns.CompactColumnsTest.java
public void testDateTimeFormats() { doTestDateTimeFormats(Locale.US, DateFormat.SHORT, DateFormat.SHORT, "6/24/10 2:56 PM"); doTestDateTimeFormats(Locale.US, DateFormat.MEDIUM, DateFormat.SHORT, "Jun 24, 2010 2:56 PM"); doTestDateTimeFormats(Locale.GERMAN, DateFormat.SHORT, DateFormat.SHORT, "24.06.10 14:56"); }
From source file:org.techytax.helper.AmountHelper.java
public static String format(BigInteger amount) { if (amount == null) { return null; }/* www . j ava 2 s. c om*/ DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.GERMAN); otherSymbols.setDecimalSeparator(','); otherSymbols.setGroupingSeparator('.'); DecimalFormat df = new DecimalFormat("###,###,###,##0", otherSymbols); return df.format(amount); }
From source file:org.dspace.content.LicenseUtilsTest.java
/** * Test of getLicenseText method, of class LicenseUtils. *//*from w ww . jav a 2 s.c om*/ @Test public void testGetLicenseText_5args() throws SQLException, AuthorizeException { //parameters for the test Locale locale = null; Collection collection = null; Item item = null; EPerson person = null; Map<String, Object> additionalInfo = null; // We don't test attribute 4 as this is the date, and the date often differs between when the test // is executed, and when the LicenceUtils code gets the current date/time which causes the test to fail String template = "Template license: %1$s %2$s %3$s %5$s %6$s"; String templateLong = "Template license: %1$s %2$s %3$s %5$s %6$s %8$s %9$s %10$s %11$s"; String templateResult = "Template license: first name last name test@email.com "; String templateLongResult = "Template license: first name last name test@email.com arg1 arg2 arg3 arg4"; String defaultLicense = ConfigurationManager.getDefaultSubmissionLicense(); context.turnOffAuthorisationSystem(); //TODO: the tested method doesn't verify the input, will throw NPE if any parameter is null //testing for default license locale = Locale.ENGLISH; collection = Collection.create(context); item = Item.create(context); person = EPerson.create(context); person.setFirstName("first name"); person.setLastName("last name"); person.setEmail("test@email.com"); additionalInfo = null; assertThat("testGetLicenseText_5args 0", LicenseUtils.getLicenseText(locale, collection, item, person, additionalInfo), equalTo(defaultLicense)); locale = Locale.GERMAN; collection = Collection.create(context); item = Item.create(context); person = EPerson.create(context); person.setFirstName("first name"); person.setLastName("last name"); person.setEmail("test@email.com"); additionalInfo = null; assertThat("testGetLicenseText_5args 1", LicenseUtils.getLicenseText(locale, collection, item, person, additionalInfo), equalTo(defaultLicense)); locale = Locale.ENGLISH; collection = Collection.create(context); item = Item.create(context); person = EPerson.create(context); person.setFirstName("first name"); person.setLastName("last name"); person.setEmail("test@email.com"); additionalInfo = new HashMap<String, Object>(); additionalInfo.put("arg1", "arg1"); additionalInfo.put("arg2", "arg2"); additionalInfo.put("arg3", "arg3"); assertThat("testGetLicenseText_5args 2", LicenseUtils.getLicenseText(locale, collection, item, person, additionalInfo), equalTo(defaultLicense)); //test collection template locale = Locale.ENGLISH; collection = Collection.create(context); collection.setLicense(template); item = Item.create(context); person = EPerson.create(context); person.setFirstName("first name"); person.setLastName("last name"); person.setEmail("test@email.com"); additionalInfo = null; assertThat("testGetLicenseText_5args 3", LicenseUtils.getLicenseText(locale, collection, item, person, additionalInfo), equalTo(templateResult)); locale = Locale.GERMAN; collection = Collection.create(context); collection.setLicense(template); item = Item.create(context); person = EPerson.create(context); person.setFirstName("first name"); person.setLastName("last name"); person.setEmail("test@email.com"); additionalInfo = null; assertThat("testGetLicenseText_5args 4", LicenseUtils.getLicenseText(locale, collection, item, person, additionalInfo), equalTo(templateResult)); locale = Locale.ENGLISH; collection = Collection.create(context); collection.setLicense(templateLong); item = Item.create(context); person = EPerson.create(context); person.setFirstName("first name"); person.setLastName("last name"); person.setEmail("test@email.com"); additionalInfo = new LinkedHashMap<String, Object>(); additionalInfo.put("arg1", "arg1"); additionalInfo.put("arg2", "arg2"); additionalInfo.put("arg3", "arg3"); additionalInfo.put("arg4", "arg4"); assertThat("testGetLicenseText_5args 5", LicenseUtils.getLicenseText(locale, collection, item, person, additionalInfo), equalTo(templateLongResult)); context.restoreAuthSystemState(); }
From source file:de.meisl.eisstockitems.ImportTest.java
@Test public void importJahreskennbuchstaben() throws IOException, ParseException { List<String> readLines = FileUtils.readLines(new File("data/jahreskennbuchstaben.csv"), "UTF-8"); for (String line : readLines) { DateFormat format = new SimpleDateFormat("dd.MM.yyyy", Locale.GERMAN); String[] split = line.split(",", -1); Date year = format.parse(split[0]); String character = split[1]; String remark = split[2]; List<YearCharacter> category = yearCharRepository.findByYear(year); if (category.isEmpty()) { log.info(String.format("Add new YearCharacter '%s' for year '%s'", character, year)); YearCharacter item = new YearCharacter(); item.setYearCharacter(character); item.setYear(year);//from w w w. ja va 2s . c o m item.setRemark(remark); item = yearCharRepository.save(item); log.info("Created YearCharacter for RegNr '" + character + "': " + item); } } }
From source file:de.uni_tuebingen.ub.ixTheo.handler.component.FacetPrefixSortComponent.java
/** * Choose the collator according to the selected language *///w w w . ja v a2 s . com private void setCollator(final String langCode) { Locale locale = Locale.GERMAN; String transformedLangCode = ""; // Rewrite lang parameter to required layout Matcher m = LANG_CODE_TRANSFORMATION_PATTERN.matcher(langCode); StringBuffer sb = new StringBuffer(langCode.length()); while (m.find()) { if (m.group(1) != null) sb.append(m.group(1).toLowerCase()); if (m.group(2) != null) sb.append(m.group(2).equals("-") ? "_" : ""); if (m.group(3) != null) sb.append(m.group(3).toUpperCase()); transformedLangCode = sb.toString(); } try { locale = LocaleUtils.toLocale(transformedLangCode); } catch (IllegalArgumentException e) { } if (LocaleUtils.isAvailableLocale(locale)) collator = Collator.getInstance(locale); else collator = Collator.getInstance(Locale.GERMAN); }