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:de.jfachwert.bank.Waehrung.java
/** * Ermittelt die Waehrung. Urspruenglich wurde die Default-Currency ueber * <pre>//from w w w.j av a 2 s .c o m * Currency.getInstance(Locale.getDefault()) * </pre> * ermittelt. Dies fuehrte aber auf der Sun zu Problemen, da dort * die Currency fuer die Default-Locale folgende Exception hervorrief: * <pre> * java.lang.IllegalArgumentException * at java.util.Currency.getInstance(Currency.java:384) * at de.jfachwert.bank.Geldbetrag.<clinit> * ... * </pre> * * @return normalerweise die deutsche Currency */ private static Currency getDefaultCurrency() { Locale[] locales = { Locale.getDefault(), Locale.GERMANY, Locale.GERMAN }; for (Locale loc : locales) { try { return Currency.getInstance(loc); } catch (IllegalArgumentException iae) { LOG.log(Level.INFO, "No currency for locale '" + loc + "' available on this machine - will try next one.", iae); } } return Currency.getAvailableCurrencies().iterator().next(); }
From source file:de.ingrid.portal.portlets.mdek.MdekPortalAdminPortlet.java
public void doViewNew(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response) throws PortletException, IOException { setDefaultViewPage(TEMPLATE_NEW);// w w w . j av a 2 s. co m Context context = getContext(request); List<String> plugIdList = getUnconnectedPlugIdList(request); List<String> userNameList = getUnconnectedUserList(); Collections.sort(plugIdList); Collections.sort(userNameList, Collator.getInstance(Locale.GERMAN)); ResourceBundle resourceBundle = getPortletConfig().getResourceBundle(request.getLocale()); context.put("MESSAGES", resourceBundle); PortletPreferences prefs = request.getPreferences(); String myTitleKey = prefs.getValue("titleKey", "mdek.title.portaladmin"); response.setTitle(resourceBundle.getString(myTitleKey)); context.put("plugIdList", plugIdList); context.put("userNameList", userNameList); }
From source file:controllers.nwbib.Application.java
private static List<String> cleanSortUnique(List<JsonNode> topics) { List<String> filtered = topics.stream().map(topic -> topic.textValue().replaceAll("\\([\\d,]+\\)$", "")) .filter(topic -> !topic.trim().startsWith(":")).map(v -> v.trim()).collect(Collectors.toList()); SortedSet<String> sortedUnique = new TreeSet<>( (s1, s2) -> Collator.getInstance(Locale.GERMAN).compare(s1, s2)); sortedUnique.addAll(filtered);/*from w ww. j a v a 2 s . c om*/ return new ArrayList<>(sortedUnique); }
From source file:org.projectforge.business.fibu.datev.BuchungssatzImportRow.java
/** * Achtung: Diese Klasse ruft ggf. korrigierend und ndernd check() auf. * @see java.lang.Object#toString()/*from w ww .jav a 2 s . c o m*/ * @see #check() */ public String toString() { check(); // Leider muss dieser modifizierende check() ausgefhrt werden, da auf die aufrufende Klasse ExcelImport kein Einfluss // genommen werden kann. String txt = StringUtils.abbreviate(text, 30); DayHolder day = new DayHolder(datum); return StringUtils.leftPad(NumberHelper.getAsString(satzNr), 4) + " " + StringUtils.leftPad(day.isoFormat(), 10) + StringUtils.leftPad( NumberHelper.getAsString(betrag, NumberHelper.getCurrencyFormat(Locale.GERMAN)), 12) + " " + kost1 != null ? StringUtils.leftPad(kost1.toString(), 12) : "- " + " " + kost2 != null ? StringUtils.leftPad(kost2.toString(), 12) : "- " + " " + StringUtils.rightPad(txt, 30); }
From source file:test.be.fedict.eid.applet.PcscTest.java
@Test public void pcscMSE_SET() 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 ww. ja va2s .co m } CardChannel cardChannel = pcscEid.getCardChannel(); try { CommandAPDU setApdu = new CommandAPDU(0x00, 0x22, 0x41, 0xB6, new byte[] { 0x04, // length of following data (byte) 0x80, // algo ref // 0x01, // rsa pkcs#1 // 0x02, // PKCS1-SHA1 // 0x04, // PKCS1-MD5 // 0x08, // PKCS1-SHA256 // 0x10, // PKCS1-PSS-SHA1 0x20, // PKCS1-PSS-SHA256 // (byte) 0xfb, // foobar (byte) 0x84, // tag for private key ref PcscEid.AUTHN_KEY_ID }); ResponseAPDU responseAPDU = cardChannel.transmit(setApdu); assertEquals(0x9000, responseAPDU.getSW()); } finally { pcscEid.close(); } }
From source file:sernet.verinice.search.JsonBuilder.java
private static String getNullValue() { if (Locale.GERMAN.equals(Locale.getDefault()) || Locale.GERMANY.equals(Locale.getDefault())) { return "unbearbeitet"; } else {/*from ww w . ja v a2 s .com*/ return "unedited"; } }
From source file:de.ingrid.portal.scheduler.jobs.IngridMonitorAbstractJob.java
private void sendEmail(JobDetail job, String email) { if (log.isDebugEnabled()) { log.debug("Try to sent alert email to " + email); }// w ww . j a v a2 s . co m HashMap<String, Object> mailData = new HashMap<String, Object>(); mailData.put("JOB", job); ResourceBundle resources = ResourceBundle.getBundle("de.ingrid.portal.resources.AdminPortalResources", Locale.GERMAN); mailData.put("MESSAGES", new IngridResourceBundle(resources, Locale.GERMAN)); URL url = Thread.currentThread().getContextClassLoader() .getResource("../templates/administration/monitor_alert_email.vm"); String templatePath = url.getPath(); String emailSubject = PortalConfig.getInstance() .getString(PortalConfig.COMPONENT_MONITOR_ALERT_EMAIL_SUBJECT, "ingrid component monitor alert"); emailSubject = emailSubject.concat(" [").concat(job.getJobDataMap().getString(PARAM_COMPONENT_TITLE)) .concat("]"); if (job.getJobDataMap().getInt(PARAM_STATUS) == STATUS_OK) { emailSubject = emailSubject.concat("[OK]"); } else { emailSubject = emailSubject.concat("[FAILED]"); } String from = PortalConfig.getInstance().getString(PortalConfig.COMPONENT_MONITOR_ALERT_EMAIL_SENDER, "foo@bar.com"); String to = email; String text = Utils.mergeTemplate(templatePath, mailData, "map"); Utils.sendEmail(from, emailSubject, new String[] { to }, text, null); if (log.isDebugEnabled()) { log.debug("Sent alert email to " + to); } }
From source file:org.projectforge.fibu.datev.BuchungssatzExcelImporter.java
private ImportedSheet<BuchungssatzDO> importBuchungssaetze(final ExcelImport<BuchungssatzImportRow> imp, final HSSFSheet sheet, final int month) throws Exception { final ImportedSheet<BuchungssatzDO> importedSheet = new ImportedSheet<BuchungssatzDO>(); imp.setNameRowIndex(ROW_COLUMNNAMES); imp.setStartingRowIndex(ROW_COLUMNNAMES + 1); imp.setRowClass(BuchungssatzImportRow.class); final Map<String, String> map = new HashMap<String, String>(); map.put("SatzNr.", "satzNr"); map.put("Satz-Nr.", "satzNr"); map.put("Betrag", "betrag"); map.put("SH", "sh"); // Nicht eindeutig! map.put("Konto", "konto"); map.put("Kostenstelle/-trger", "kost2"); map.put("Kost2", "kost2"); map.put("Menge", "menge"); map.put("SH2", "sh2"); map.put("Beleg", "beleg"); map.put("Datum", "datum"); map.put("Gegenkonto", "gegenkonto"); map.put("Text", "text"); map.put("Alt.-Kst.", "kost1"); map.put("Kost1", "kost1"); map.put("Beleg 2", "beleg2"); map.put("KR-BSNr.", "kr_bsnr"); map.put("ZI", "zi"); map.put("Kommentar", "comment"); map.put("Bemerkung", "comment"); imp.setColumnMapping(map);/*from www . j a va 2 s . co m*/ BuchungssatzImportRow[] rows = new BuchungssatzImportRow[0]; rename2ndSH(sheet); rows = imp.convertToRows(BuchungssatzImportRow.class); if (rows == null || rows.length == 0) { return null; } int year = 0; for (int i = 0; i < rows.length; i++) { ImportedElement<BuchungssatzDO> element; try { element = convertBuchungssatz(rows[i]); } catch (final RuntimeException ex) { throw new RuntimeException( "Im Blatt '" + sheet.getSheetName() + "', in Zeile " + (i + 2) + ": " + ex.getMessage(), ex); } if (element == null) { // Empty row: continue; } final BuchungssatzDO satz = element.getValue(); final DateHolder date = new DateHolder(satz.getDatum(), DatePrecision.DAY, Locale.GERMAN); if (year == 0) { year = date.getYear(); } else if (year != date.getYear()) { final String msg = "Not supported: Buchungsstze innerhalb eines Excel-Sheets liegen in verschiedenen Jahren."; actionLog.logError(msg); throw new UserException(msg); } if (date.getMonth() > month) { final String msg = "Buchungsstze knnen nicht in die Zukunft fr den aktuellen Monat '" + KostFormatter.formatBuchungsmonat(year, date.getMonth()) + " gebucht werden! " + satz; actionLog.logError(msg); throw new RuntimeException(msg); } else if (date.getMonth() < month) { final String msg = "Buchungssatz liegt vor Monat '" + KostFormatter.formatBuchungsmonat(year, month) + "' (OK): " + satz; actionLog.logInfo(msg); } satz.setYear(year); satz.setMonth(month); importedSheet.addElement(element); log.debug(satz); } importedSheet.setName(KostFormatter.formatBuchungsmonat(year, month)); importedSheet.setProperty("year", year); importedSheet.setProperty("month", month); return importedSheet; }
From source file:com.salesmanager.core.module.impl.application.currencies.GenericCurrencyModule.java
public String getMeasure(BigDecimal measure, String currencycode) throws Exception { NumberFormat nf = null;// w w w . j a v a 2s .co m Locale locale = Locale.US; if (this.decimalPoint == ',') { locale = Locale.GERMAN; } nf = NumberFormat.getInstance(locale); nf.setMaximumFractionDigits(1); nf.setMinimumFractionDigits(1); measure.setScale(1, BigDecimal.ROUND_HALF_UP); return nf.format(measure); }
From source file:org.talend.designer.core.ui.preferences.I18nPreferencePage.java
@Override protected void createFieldEditors() { // Adds a combo for language selection. String spanish = "Espa\u00F1ol"; //$NON-NLS-1$ byte[] utf8Bytes; try {// www . j a v a 2 s. c om utf8Bytes = spanish.getBytes("UTF8"); //$NON-NLS-1$ spanish = new String(utf8Bytes, "UTF8"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e1) { // could be translated, but it's only in case of error when change UTF8 characters. spanish = "Spanish"; //$NON-NLS-1$ } String russian = "\u0420\u0443\u0441\u0441\u043A\u0438\u0439"; //$NON-NLS-1$ try { utf8Bytes = russian.getBytes("UTF8"); //$NON-NLS-1$ russian = new String(utf8Bytes, "UTF8"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e1) { // could be translated, but it's only in case of error when change UTF8 characters. russian = "Russian"; //$NON-NLS-1$ } String greek = "\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac"; //$NON-NLS-1$ try { utf8Bytes = greek.getBytes("UTF8"); //$NON-NLS-1$ greek = new String(utf8Bytes, "UTF8"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e1) { // could be translated, but it's only in case of error when change UTF8 characters. greek = "Greek"; //$NON-NLS-1$ } String arabic = "\u0627\u0644\u0639\u0631\u0628\u064a\u0647"; //$NON-NLS-1$ try { utf8Bytes = arabic.getBytes("UTF8"); //$NON-NLS-1$ arabic = new String(utf8Bytes, "UTF8"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e1) { // could be translated, but it's only in case of error when change UTF8 characters. arabic = "Arabic"; //$NON-NLS-1$ } String serbian = "\u0421\u0440\u043f\u0441\u043a\u0438"; //$NON-NLS-1$ try { utf8Bytes = serbian.getBytes("UTF8"); //$NON-NLS-1$ serbian = new String(utf8Bytes, "UTF8"); //$NON-NLS-1$ } catch (UnsupportedEncodingException e1) { // could be translated, but it's only in case of error when change UTF8 characters. serbian = "Serbian"; //$NON-NLS-1$ } String[][] entryNamesAndValues = { { Locale.ENGLISH.getDisplayLanguage(Locale.ENGLISH), Locale.ENGLISH.getLanguage() }, { Locale.FRENCH.getDisplayLanguage(Locale.FRENCH), Locale.FRENCH.getLanguage() }, { Locale.CHINESE.getDisplayLanguage(Locale.CHINESE), "zh_CN" }, { Locale.GERMAN.getDisplayLanguage(Locale.GERMAN), Locale.GERMAN.getLanguage() }, { Locale.JAPANESE.getDisplayLanguage(Locale.JAPANESE), Locale.JAPANESE.getLanguage() }, { Locale.ITALIAN.getDisplayLanguage(Locale.ITALIAN), Locale.ITALIAN.getLanguage() }, { "Brasil", "pt_BR" }, //$NON-NLS-1$ //$NON-NLS-2$ { spanish, "es" }, { russian, "ru" }, //$NON-NLS-1$ //$NON-NLS-2$ { Locale.KOREA.getDisplayLanguage(Locale.KOREA), "kr" }, { "Turkish", "tr" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ { greek, "el" }, { "Hrvatski", "hr" }, { arabic, "ar" }, { serbian, "sr" }, { "Polski", "pl" }, { "Romanian", "ro" }, { "Netherlands", "nl" } }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ // /$NON-NLS-7$ languageSelectionEditor = new OneLineComboFieldEditor(ITalendCorePrefConstants.LANGUAGE_SELECTOR, Messages.getString("I18nPreferencePage.needRestart"), entryNamesAndValues, getFieldEditorParent()); //$NON-NLS-1$ addField(languageSelectionEditor); Composite composite = getFieldEditorParent(); LabelFieldEditor importAll = new LabelFieldEditor( Messages.getString("I18nPreferencePage.translationInformation"), //$NON-NLS-1$ composite); addField(importAll); Button allUpdate = new Button(composite, SWT.FLAT); allUpdate.setText(Messages.getString("I18nPreferencePage.importBabili")); //$NON-NLS-1$ allUpdate.setLayoutData(new GridData()); allUpdate.addSelectionListener(new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { // import all update from Babili // select the .zip file FileDialog fd = new FileDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OPEN); fd.setText("Open"); //$NON-NLS-1$ fd.setFilterPath("C:" + fs); //$NON-NLS-1$ String[] filterExtensions = { "*.zip" }; //$NON-NLS-1$ fd.setFilterExtensions(filterExtensions); String selected = fd.open(); if (selected != null) { isBabiliButtonClicked = true; runProgressMonitorDialog(selected); if (MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.getString("I18nPreferencePage.restart"), //$NON-NLS-1$ Messages.getString("I18nPreferencePage.restartButton"))) { PlatformUI.getWorkbench().restart(); } } } @Override public void widgetDefaultSelected(SelectionEvent e) { // Nothing to do } }); // added by nma Button restoredefault = new Button(composite, SWT.FLAT); restoredefault.setText("Restore Defaults"); //$NON-NLS-1$ restoredefault.setLayoutData(new GridData()); restoredefault.addSelectionListener(new SelectionListener() { @Override public void widgetDefaultSelected(SelectionEvent e) { // Nothing to do } @Override public void widgetSelected(SelectionEvent e) { isBabiliButtonClicked = true; runProgressMonitorDialog(Messages.getString("I18nPreferencePage.restoreDefault")); //$NON-NLS-1$ if (MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.getString("I18nPreferencePage.restart"), Messages.getString("I18nPreferencePage.restartButton"))) { PlatformUI.getWorkbench().restart(); } } }); }