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:software.coolstuff.springframework.owncloud.service.impl.rest.OwncloudRestResourceServiceTest.java

@Override
protected void prepare_findFile_OK(URI searchPath, OwncloudTestFileResourceImpl expectedResource)
        throws Exception {
    List<DavResource> davResources = Lists.newArrayList(createDavResourceFrom(expectedResource, Locale.GERMAN));
    Mockito.when(sardine.list(getResourcePath(searchPath), 0)).thenReturn(davResources);
}

From source file:de.geeksfactory.opacclient.apis.WebOpacAt.java

static LocalDate parseCopyReturn(String str) {
    DateTimeFormatter fmt = DateTimeFormat.forPattern("dd.MM.yyyy").withLocale(Locale.GERMAN);
    final Matcher matcher = Pattern.compile("[0-9.-]{4,}").matcher(str);
    if (matcher.find()) {
        return fmt.parseLocalDate(matcher.group());
    } else {/*from  w w w . jav  a 2s .  co  m*/
        return null;
    }
}

From source file:at.asitplus.regkassen.core.base.util.CashBoxUtils.java

/**
 * get double value from arbitrary String represent a double (0,00) or (0.00)
 *
 * @param taxSetValue double value as String
 * @return double value/*from   ww w  .  ja  va 2  s  . c  o m*/
 * @throws Exception
 */
public static double getDoubleFromTaxSet(String taxSetValue) throws Exception {
    //try format ("0,00")
    NumberFormat nf = NumberFormat.getNumberInstance(Locale.GERMAN);
    DecimalFormat decimalFormat = (DecimalFormat) nf;
    Exception parseException;
    try {
        return decimalFormat.parse(taxSetValue).doubleValue();
    } catch (ParseException ignored) {
    }
    //if Austrian/German format fail, try US format (0.00)
    nf = NumberFormat.getNumberInstance(Locale.US);
    decimalFormat = (DecimalFormat) nf;
    try {
        return decimalFormat.parse(taxSetValue).doubleValue();
    } catch (ParseException e) {
        parseException = e;
    }
    throw parseException;
}

From source file:de.geeksfactory.opacclient.apis.Littera.java

static LocalDate parseCopyReturn(String str) {
    if (str == null)
        return null;
    DateTimeFormatter fmt = DateTimeFormat.forPattern("dd.MM.yyyy").withLocale(Locale.GERMAN);
    final Matcher matcher = Pattern.compile("[0-9.-]{4,}").matcher(str);
    if (matcher.find()) {
        return fmt.parseLocalDate(matcher.group());
    } else {/*www.j a v  a  2s. c  o  m*/
        return null;
    }
}

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

SubstitutionScheduleDay parseIndiwareDay(Element doc, boolean html) throws IOException {
    SubstitutionScheduleDay day = new SubstitutionScheduleDay();

    DataSource ds;//ww w. j a  va 2s  .  c om
    if (html) {
        ds = new HTMLDataSource(doc);
    } else {
        ds = new XMLDataSource(doc);
    }

    Matcher matcher = datePattern.matcher(ds.titel().text());
    if (!matcher.find())
        throw new IOException("malformed date: " + ds.titel().text());
    String date = matcher.group();
    day.setDate(
            DateTimeFormat.forPattern("EEEE, dd. MMMM yyyy").withLocale(Locale.GERMAN).parseLocalDate(date));

    String lastChange = ds.datum().text();
    day.setLastChange(DateTimeFormat.forPattern("dd.MM.yyyy, HH:mm").withLocale(Locale.GERMAN)
            .parseLocalDateTime(lastChange));

    if (ds.kopfinfos().size() > 0) {
        for (Element kopfinfo : ds.kopfinfos()) {
            String title = html ? kopfinfo.select("th").text() : kopfinfoTitle(kopfinfo.tagName()) + ":";

            StringBuilder message = new StringBuilder();
            if (title != null && !title.isEmpty()) {
                message.append("<b>").append(title).append("</b>").append(" ");
            }
            message.append(html ? kopfinfo.select("td").text() : kopfinfo.text());

            day.addMessage(message.toString());
        }
    }

    if (ds.fuss() != null) {
        StringBuilder message = new StringBuilder();
        boolean first = true;
        for (Element fusszeile : ds.fusszeilen()) {
            if (first) {
                first = false;
            } else {
                message.append("\n");
            }
            message.append(fusszeile.text());
        }
        day.addMessage(message.toString());
    }

    List<String> columnTypes = null;
    if (html) {
        columnTypes = new ArrayList<>();
        for (Element th : ((HTMLDataSource) ds).headers()) {
            columnTypes.add(th.className().replace("thplan", "").replace("thlplan", ""));
        }
    }

    for (Element aktion : ds.aktionen()) {
        Substitution substitution = new Substitution();
        String type = "Vertretung";
        String course = null;
        int i = 0;
        for (Element info : aktion.children()) {
            String value = info.text().replace("\u00a0", "");
            if (value.equals("---")) {
                i++;
                continue;
            }
            final String columnType = html ? columnTypes.get(i) : info.tagName();
            switch (columnType) {
            case "klasse":
                Set<String> classes = new HashSet<>();
                for (String klasse : value.split(",")) {
                    Matcher courseMatcher = coursePattern.matcher(klasse);
                    if (courseMatcher.matches()) {
                        classes.add(courseMatcher.group(1));
                        course = courseMatcher.group(2);
                    } else {
                        classes.add(klasse);
                    }
                }
                substitution.setClasses(classes);
                break;
            case "stunde":
                substitution.setLesson(value);
                break;
            case "fach":
                String subject = subjectAndCourse(course, value);
                if (columnTypes != null && columnTypes.contains("vfach")) {
                    substitution.setPreviousSubject(subject);
                } else {
                    substitution.setSubject(subject);
                }
                break;
            case "vfach":
                substitution.setSubject(subjectAndCourse(course, value));
            case "lehrer":
                Matcher bracesMatcher = bracesPattern.matcher(value);
                if (bracesMatcher.matches())
                    value = bracesMatcher.group(1);
                substitution.setTeacher(value);
                break;
            case "raum":
                if (columnTypes != null && columnTypes.contains("vraum")) {
                    substitution.setPreviousRoom(value);
                } else {
                    substitution.setRoom(value);
                }
                break;
            case "vraum":
                substitution.setRoom(value);
            case "info":
                Matcher substitutionMatcher = substitutionPattern.matcher(value);
                Matcher cancelMatcher = cancelPattern.matcher(value);
                Matcher delayMatcher = delayPattern.matcher(value);
                Matcher selfMatcher = selfPattern.matcher(value);
                if (substitutionMatcher.matches()) {
                    substitution.setPreviousSubject(substitutionMatcher.group(1));
                    substitution.setPreviousTeacher(substitutionMatcher.group(2));
                    if (!substitutionMatcher.group(3).isEmpty()) {
                        substitution.setDesc(substitutionMatcher.group(3));
                    }
                } else if (cancelMatcher.matches()) {
                    type = "Entfall";
                    substitution.setPreviousSubject(cancelMatcher.group(1));
                    substitution.setPreviousTeacher(cancelMatcher.group(2));
                } else if (delayMatcher.matches()) {
                    type = "Verlegung";
                    substitution.setPreviousSubject(delayMatcher.group(1));
                    substitution.setPreviousTeacher(delayMatcher.group(2));
                    substitution.setDesc(delayMatcher.group(3));
                } else if (selfMatcher.matches()) {
                    type = "selbst.";
                    if (!selfMatcher.group(1).isEmpty())
                        substitution.setDesc(selfMatcher.group(1));
                } else if (value.equals("fllt aus") || value.equals("Klausur") || value.equals("Aufg.")) {
                    type = value;
                } else {
                    substitution.setDesc(value);
                }
                break;
            }
            i++;
        }
        substitution.setType(type);
        substitution.setColor(colorProvider.getColor(substitution.getType()));
        if (course != null && substitution.getSubject() == null) {
            substitution.setSubject(course);
        }
        day.addSubstitution(substitution);
    }

    return day;
}

From source file:com.seajas.search.codex.service.social.SocialProfileServiceTest.java

@Test
public void testSearchFacebookProfileSuggestions() throws Exception {
    List<Reference> profileReferences = Lists.newArrayList(new Reference("id", "testPerson"),
            new Reference("id2", "anotherPerson"));

    when(socialFacadeMock.searchFacebookProfiles("testPerson")).thenReturn(profileReferences);

    FacebookProfile fbp1 = new FacebookProfile("id", "username", "testPerson", "first", "last", "gender",
            Locale.GERMAN);
    FacebookProfile fbp2 = new FacebookProfile("id2", "username", "anotherPerson", "first", "last", "gender",
            Locale.GERMAN);/*  www  .  j ava2s . co m*/

    when(socialFacadeMock.getFacebookProfiles(Lists.newArrayList("id", "id2")))
            .thenReturn(Lists.newArrayList(fbp1, fbp2));

    List<SocialProfileDto> dtos = socialProfileService.searchFacebookProfiles("testPerson", true);

    List profiles = Lists.newArrayList(SocialProfileDto.translate(fbp1));
    Assert.assertEquals(profiles, dtos);
    verify(mediaServiceMock).storeUrl(anyString(), (String) isNull(), eq("image"));
}

From source file:edu.ku.brc.specify.tools.l10nios.StrLocalizerAppForiOS.java

/**
 * @param hideExisting//from w  ww .java 2  s .  c om
 * @return
 */
private Locale doChooseLangLocale(final Locale hideLocale) {
    Vector<Locale> locales = new Vector<Locale>();
    Collections.addAll(locales, Locale.getAvailableLocales());

    String[] langs = { "es", "sv", "sq", "fr" };
    Vector<Locale> destLocales = new Vector<Locale>();
    destLocales.add(Locale.GERMAN);
    for (String lang : langs) {
        appendLocale(locales, destLocales, lang);
    }

    Vector<String> localeNames = new Vector<String>();
    for (Locale l : destLocales) {
        localeNames.add(l.getDisplayName());
    }

    ToggleButtonChooserDlg<String> chooser = new ToggleButtonChooserDlg<String>((Frame) null, "CHOOSE_LOCALE",
            localeNames, ToggleButtonChooserPanel.Type.RadioButton);
    chooser.setUseScrollPane(true);
    UIHelper.centerAndShow(chooser);

    if (!chooser.isCancelled()) {
        return destLocales.get(chooser.getSelectedIndex());
    }
    return null;
}

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

@Override
protected void prepare_findRootDirectory_OK(OwncloudTestResourceImpl expectedResource) throws Exception {
    List<DavResource> davResources = Lists.newArrayList(createDavResourceFrom(expectedResource, Locale.GERMAN));
    Mockito.when(sardine.list(getResourcePath(), 0)).thenReturn(davResources);
}

From source file:de.tor.tribes.ui.windows.DSWorkbenchSplashScreen.java

/**
 * @param args the command line arguments
 *//*from  w ww .  j  a  v  a 2 s .  c  o  m*/
public static void main(String args[]) {
    Locale.setDefault(Locale.GERMAN);
    int mode = -1;
    int minimal = 0;
    boolean ssd = false;
    if (args != null) {
        for (String arg : args) {
            switch (arg) {
            case "-d":
            case "--debug":
                //debug mode
                mode = 0;
                SystrayHelper.showInfoMessage("Running in debug mode");
                break;
            case "-m":
                minimal = 1;
                break;
            case "-ssd":
                ssd = true;
                break;
            }
        }
    }
    Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler());
    System.setProperty("sun.awt.exception.handler", ExceptionHandler.class.getName());

    if (mode == 0) {
        Configurator.setAllLevels(LogManager.getRootLogger().getName(), Level.DEBUG);
    }
    GlobalOptions.setMinimalVersion(minimal == 1);

    try {
        GlobalDefaults.initialize();
        GlobalOptions.initialize();
        //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
        logger.error("Failed to setup LnF", e);
    }

    final boolean useSSD = ssd;

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            try {
                DSWorkbenchSplashScreen.getSingleton().setLocationRelativeTo(null);
                if (useSSD) {
                    DSWorkbenchSplashScreen.getSingleton().initializeSuperSpecialDebugFeatures();
                }
                DSWorkbenchSplashScreen.getSingleton().setVisible(true);
            } catch (Exception e) {
                logger.error("Fatal application error", e);
            }
        }
    });
}

From source file:de.micromata.genome.gwiki.auth.GWikiAuthorizationBase.java

public Locale getLocaleByLang(String lang) {
    if (StringUtils.isEmpty(lang) == true) {
        return null;
    }//  www  .  j  av a2s . c om
    if (lang.equals("en") == true || lang.equals("eng") == true) {
        return Locale.ENGLISH;
    } else if (lang.equals("de") == true || lang.equals("deu") == true) {
        return Locale.GERMAN;
    }
    return new Locale(lang);
}