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:cec.easyshop.core.batch.task.BatchIntegrationTest.java

@Test
public void testBasicProduct() throws Exception {
    final ProductModel product = processFile(productId, "base_product-", new ProductContent());
    Assert.assertEquals("name", product.getName(Locale.ENGLISH));
    Assert.assertNull("name", product.getName(Locale.GERMAN));
    Assert.assertEquals("description", product.getDescription(Locale.ENGLISH));
    Assert.assertNull("description", product.getDescription(Locale.GERMAN));
    Assert.assertEquals("ean", product.getEan());
    Assert.assertEquals("manufacturer", product.getManufacturerName());
    Assert.assertEquals("manufacturerAID", product.getManufacturerAID());
    Assert.assertEquals("pieces", product.getUnit().getName());
    Assert.assertEquals("approved", product.getApprovalStatus().getCode());
    Assert.assertEquals("eu-vat-half", product.getEurope1PriceFactory_PTG().getCode());
    Assert.assertEquals(sequenceId, product.getSequenceId());
    Assert.assertEquals("Staged", product.getCatalogVersion().getVersion());
    Assert.assertEquals("apparelProductCatalog", product.getCatalogVersion().getCatalog().getId());
}

From source file:org.mili.core.resource.ResourceUtilImpl.java

private void loadDevResources(Locale locale, URL url, String realBaseName, String baseName) {
    if ((locale.equals(Locale.GERMAN) || locale.equals(Locale.GERMANY)) && url != null) {
        InputStream is = null;//  w  w  w.j a  v a2  s  . c  om
        try {
            is = FileUtil.getInputStream(url.getPath() + "/" + baseName + "_dev.properties");
            copyPropertiesInResMap(PropUtil.readProperties(is), realBaseName, locale);
        } catch (Exception e) {
            // eat it
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (IOException e) { // eat it!
                }
            }
        }
    }
}

From source file:com.cubusmail.mail.util.MessageUtils.java

/**
 * Format the date.//  w  w w .  j a  va2 s.c  o m
 * 
 * @param date
 * @return
 */
public static String formatMailDate(Date date) {

    if (date != null) {
        DateFormat format = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.MEDIUM,
                SimpleDateFormat.SHORT, Locale.GERMAN);

        return format.format(date);
    } else {
        return "";
    }
}

From source file:it.sasabz.android.sasabus.fragments.WayFragment.java

public WayFragment(String line, String from, String to, String orario_part, String orario_arr)
        throws Exception {
    String lang = "it";
    if ((Locale.getDefault().getLanguage()).indexOf(Locale.GERMAN.toString()) != -1)
        lang = "de";
    Log.v("SHOW-WAY-ACTIVITY", "Partenza: " + from);
    Log.v("SHOW-WAY-ACTIVITY", "Arrivo: " + to);
    departure = PalinaList.getTranslation(from.trim(), lang);
    arrival = PalinaList.getTranslation(to.trim(), lang);
    if (departure == null || arrival == null) {
        throw new Exception();
    }//from  w  w  w .  jav  a2  s .  co  m
    bacino = BacinoList.getBacino(departure.getName_de(), arrival.getName_de(), line);
    if (bacino == null) {
        throw new Exception();
    }
    linea = LineaList.getByNumLin(line, bacino.getTable_prefix());
    if (linea == null) {
        throw new Exception();
    }
    orario = PassaggioList.getPassaggio(linea.getId(), departure.getName_de(), arrival.getName_de(),
            orario_part, orario_arr, bacino.getTable_prefix());
    if (orario == null) {
        throw new Exception();
    }
}

From source file:it.sasabz.android.sasabus.classes.dialogs.SelectFavoritenDialog.java

@Override
public void onItemClick(AdapterView<?> av, View l, int position, long id) {
    Favorit fav = list.get(position);//from www  .jav a2s . co m
    String namefrom = fav.getPartenza();
    String nameto = fav.getDestinazione();

    String namefromloc = "";
    String nametoloc = "";

    if ((Locale.getDefault().getLanguage()).indexOf(Locale.GERMAN.toString()) != -1) {
        String italienischfrom = namefrom.substring(0, namefrom.indexOf("-")).trim();
        Palina stationfrom = PalinaList.getTranslation(italienischfrom, "it");
        if (stationfrom != null) {
            namefromloc = stationfrom.getName_de();
            namefromloc = namefromloc.substring(1, namefromloc.indexOf(")")) + " - "
                    + namefromloc.substring(namefromloc.indexOf(")") + 1).trim();
        } else {
            String geteilt = namefrom.substring(namefrom.indexOf("-") + 1).trim();
            namefromloc = geteilt.substring(1, geteilt.indexOf(")")) + " - "
                    + geteilt.substring(geteilt.indexOf(")") + 1).trim();
        }
        String italienischto = nameto.substring(0, nameto.indexOf("-")).trim();
        Palina stationto = PalinaList.getTranslation(italienischto, "it");
        if (stationto != null) {
            nametoloc = stationto.getName_de();
            nametoloc = nametoloc.substring(1, nametoloc.indexOf(")")) + " - "
                    + nametoloc.substring(nametoloc.indexOf(")") + 1).trim();
        } else {
            String geteilt = nameto.substring(nameto.indexOf("-") + 1).trim();
            nametoloc = geteilt.substring(1, geteilt.indexOf(")")) + " - "
                    + geteilt.substring(geteilt.indexOf(")") + 1).trim();
        }
    } else {
        String geteiltfrom = namefrom.substring(0, namefrom.indexOf("-")).trim();
        namefromloc = geteiltfrom.substring(1, geteiltfrom.indexOf(")")) + " - "
                + geteiltfrom.substring(geteiltfrom.indexOf(")") + 1).trim();
        String geteiltto = nameto.substring(0, namefrom.indexOf("-")).trim();
        nametoloc = geteiltto.substring(1, geteiltto.indexOf(")")) + " - "
                + geteiltto.substring(geteiltto.indexOf(")") + 1).trim();
    }

    View result = fragment.getResult();
    AutoCompleteTextView from = (AutoCompleteTextView) result.findViewById(R.id.from_text);
    AutoCompleteTextView to = (AutoCompleteTextView) result.findViewById(R.id.to_text);

    from.setText(namefromloc);
    to.setText(nametoloc);

    this.dismiss();
}

From source file:com.robestone.hudson.compactcolumns.CompactColumnsTest.java

public void testShowDate() {
    doTestShowDate(Locale.GERMAN, "14:56", "24.06.2010");
    doTestShowDate(Locale.US, "2:56 PM", "6/24/2010");
}

From source file:com.graphhopper.util.InstructionListTest.java

@SuppressWarnings("unchecked")
@Test//from   ww  w .j  a v a  2  s. com
public void testWayList() {
    Graph g = new GraphBuilder(carManager).create();
    // 0-1-2
    // | | |
    // 3-4-5  9-10
    // | | |  |
    // 6-7-8--*
    NodeAccess na = g.getNodeAccess();
    na.setNode(0, 1.2, 1.0);
    na.setNode(1, 1.2, 1.1);
    na.setNode(2, 1.2, 1.2);
    na.setNode(3, 1.1, 1.0);
    na.setNode(4, 1.1, 1.1);
    na.setNode(5, 1.1, 1.2);
    na.setNode(9, 1.1, 1.3);
    na.setNode(10, 1.1, 1.4);

    na.setNode(6, 1.0, 1.0);
    na.setNode(7, 1.0, 1.1);
    na.setNode(8, 1.0, 1.2);
    g.edge(0, 1, 10000, true).setName("0-1");
    g.edge(1, 2, 11000, true).setName("1-2");

    g.edge(0, 3, 11000, true);
    g.edge(1, 4, 10000, true).setName("1-4");
    g.edge(2, 5, 11000, true).setName("5-2");

    g.edge(3, 6, 11000, true).setName("3-6");
    g.edge(4, 7, 10000, true).setName("4-7");
    g.edge(5, 8, 10000, true).setName("5-8");

    g.edge(6, 7, 11000, true).setName("6-7");
    EdgeIteratorState iter = g.edge(7, 8, 10000, true);
    PointList list = new PointList();
    list.add(1.0, 1.15);
    list.add(1.0, 1.16);
    iter.setWayGeometry(list);
    iter.setName("7-8");
    // missing edge name
    g.edge(9, 10, 10000, true);
    EdgeIteratorState iter2 = g.edge(8, 9, 20000, true);
    list.clear();
    list.add(1.0, 1.3);
    iter2.setName("8-9");
    iter2.setWayGeometry(list);

    Path p = new Dijkstra(g, carEncoder, new ShortestWeighting(carEncoder), tMode).calcPath(0, 10);
    InstructionList wayList = p.calcInstructions(usTR);
    List<String> tmpList = pick("text", wayList.createJson());
    assertEquals(Arrays.asList("Continue onto 0-1", "Turn right onto 1-4", "Continue onto 4-7",
            "Turn left onto 7-8", "Continue onto 8-9", "Turn right", "Finish!"), tmpList);

    wayList = p.calcInstructions(trMap.getWithFallBack(Locale.GERMAN));
    tmpList = pick("text", wayList.createJson());
    assertEquals(
            Arrays.asList("Geradeaus auf 0-1", "Rechts abbiegen auf 1-4", "Geradeaus auf 4-7",
                    "Links abbiegen auf 7-8", "Geradeaus auf 8-9", "Rechts abbiegen", "Ziel erreicht!"),
            tmpList);

    assertEquals(70000.0, sumDistances(wayList), 1e-1);

    List<GPXEntry> gpxes = wayList.createGPXList();
    assertEquals(10, gpxes.size());
    // check order of tower nodes        
    assertEquals(1, gpxes.get(0).getLon(), 1e-6);
    assertEquals(1.4, gpxes.get(gpxes.size() - 1).getLon(), 1e-6);

    // check order of pillar nodes        
    assertEquals(1.15, gpxes.get(4).getLon(), 1e-6);
    assertEquals(1.16, gpxes.get(5).getLon(), 1e-6);
    assertEquals(1.16, gpxes.get(5).getLon(), 1e-6);

    compare(Arrays.asList(asL(1.2d, 1.0d), asL(1.2d, 1.1), asL(1.1d, 1.1), asL(1.0, 1.1), asL(1.0, 1.2),
            asL(1.1, 1.3), asL(1.1, 1.4)), wayList.createStartPoints());

    p = new Dijkstra(g, carEncoder, new ShortestWeighting(carEncoder), tMode).calcPath(6, 2);
    assertEquals(42000, p.getDistance(), 1e-2);
    assertEquals(Helper.createTList(6, 7, 8, 5, 2), p.calcNodes());

    wayList = p.calcInstructions(usTR);
    tmpList = pick("text", wayList.createJson());
    assertEquals(Arrays.asList("Continue onto 6-7", "Continue onto 7-8", "Turn left onto 5-8",
            "Continue onto 5-2", "Finish!"), tmpList);

    compare(Arrays.asList(asL(1d, 1d), asL(1d, 1.1), asL(1d, 1.2), asL(1.1, 1.2), asL(1.2, 1.2)),
            wayList.createStartPoints());

    // special case of identical start and end
    p = new Dijkstra(g, carEncoder, new ShortestWeighting(carEncoder), tMode).calcPath(0, 0);
    wayList = p.calcInstructions(usTR);
    assertEquals(1, wayList.size());
    assertEquals("Finish!", wayList.get(0).getTurnDescription(usTR));
}

From source file:de.xwic.appkit.webbase.table.DefaultColumnLabelProvider.java

@Override
public void initialize(TimeZone timeZone, Locale locale, String dateFormat, String timeFormat, Column col) {
    this.locale = locale;
    this.column = col.getListColumn();
    this.entityClass = col.getEntityClass();
    this.customProperty = column.getPropertyId().startsWith("#");

    final Property finalProperty = column.getFinalProperty();
    if (customProperty && null == finalProperty) {
        return;//  ww  w .j  ava  2s .c  om
    }
    if (finalProperty.isEntity() && finalProperty.getEntityType().equals(IPicklistEntry.class.getName())) {
        isPicklistEntry = true;
    }

    switch (finalProperty.getDateType()) {
    case Property.DATETYPE_DATETIME:
        if (dateFormat != null && timeFormat != null) {
            dateFormatter = new SimpleDateFormat(dateFormat + " " + timeFormat);
        } else if (Locale.GERMAN.getLanguage().equals(locale.getLanguage())) {
            dateFormatter = new SimpleDateFormat("dd.MM.yyyy HH:mm");
        } else {
            dateFormatter = new SimpleDateFormat("dd-MMM-yyyy hh:mm a", locale);
        }
        dateFormatter.setTimeZone(timeZone);
        break;
    case Property.DATETYPE_TIME:
        if (timeFormat != null) {
            dateFormatter = new SimpleDateFormat(timeFormat);
        } else if (Locale.GERMAN.getLanguage().equals(locale.getLanguage())) {
            dateFormatter = new SimpleDateFormat("HH:mm");
        } else {
            dateFormatter = new SimpleDateFormat("hh:mm a");
        }
        dateFormatter.setTimeZone(timeZone);
        break;
    default:
        if (dateFormat != null) {
            dateFormatter = new SimpleDateFormat(dateFormat);
        } else if (Locale.GERMAN.getLanguage().equals(locale.getLanguage())) {
            dateFormatter = new SimpleDateFormat("dd.MM.yyyy");
        } else {
            dateFormatter = new SimpleDateFormat("dd-MMM-yyyy", locale);
        }
        break;

    }
}

From source file:it.sasabz.android.sasabus.fragments.OnlineSelectFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    if (!XMLRequest.haveNetworkConnection()) {
        Toast.makeText(getContext(), R.string.no_network_connection, Toast.LENGTH_LONG).show();
        getFragmentManager().popBackStack();
        return null;
    }/*from   w w  w.j  av  a 2 s. com*/

    String lang = "it";
    if ((Locale.getDefault().getLanguage()).indexOf(Locale.GERMAN.toString()) != -1)
        lang = "de";
    fromPalina = PalinaList.getTranslation(from, lang);
    toPalina = PalinaList.getTranslation(to, lang);
    SimpleDateFormat simple = new SimpleDateFormat("dd.MM.yyyy HH:mm");
    boolean plus12 = false;
    if (date.contains("PM")) {
        plus12 = true;
    }
    try {
        datum = simple.parse(date);
        if (plus12)
            datum.setHours(datum.getHours() + 12);
    } catch (Exception e) {
        Log.v("Datumsfehler", "Das Datum hat eine falsche Formatierung angenommen!!!");
        Toast.makeText(getContext(), "ERROR", Toast.LENGTH_LONG).show();
        getFragmentManager().popBackStack();
        return null;
    }

    if (from == "" || to == "") {
        Toast.makeText(getContext(), "ERROR", Toast.LENGTH_LONG).show();
        Log.v("SELECT STOP ERROR", "From: " + from + " | To: " + to);
        getFragmentManager().popBackStack();
        return null;
    }

    progress = new ProgressDialog(getContext());
    progress.setMessage(getResources().getText(R.string.waiting));
    progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    progress.setCancelable(false);
    progress.show();

    statlist = new XMLStationList(this);
    if (toPalina != null) {
        to = toPalina.getHaltestelle();
        Log.v("ONLINE-SELECT-TO", to);
    }
    if (fromPalina != null) {
        from = fromPalina.getHaltestelle();
        Log.v("ONLINE-SELECT-FROM", from);
    }
    statlist.execute(from, to);
    result = inflater.inflate(R.layout.online_select_layout, container, false);
    result.setVisibility(View.INVISIBLE);
    return result;
}

From source file:utilities.itext.Turnover.java

private static Image createPieChart(HashMap<String, BigDecimal> map, String title) throws Exception {
    DefaultPieDataset data = new DefaultPieDataset();

    for (String key : map.keySet()) {
        data.setValue(key, map.get(key).doubleValue());
    }//  www .  ja  v  a2 s  . co m

    JFreeChart pieChart = ChartFactory.createPieChart(title, data, true, false, Locale.GERMAN);
    //        PiePlot plot = (PiePlot) pieChart.getPlot();
    //        plot.setLabelGenerator(null);

    BufferedImage pie = pieChart.createBufferedImage(500, 500);
    File tempPie = File.createTempFile("png", null);
    ImageIO.write(pie, "png", tempPie);
    Image img = Image.getInstance(tempPie.getPath());

    return img;
}