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.iteratec.iteraplan.businesslogic.exchange.nettoExport.NettoCSVTransformerTest.java
/** * Creates the Table Structure for SpreadSheet test in this class * @return the SpreadsheetReportTableStructure *//*from w w w .j a v a 2 s . co m*/ private TableStructure createSimpleSpreadsheetReportTableStructure() { List<ColumnEntry> cols = new ArrayList<ColumnEntry>(); cols.add(new ColumnEntry("hierarchicalName", COLUMN_TYPE.INHERITED, "global.nameversion")); cols.add(new ColumnEntry("description", COLUMN_TYPE.DESCRIPTION, "global.description")); cols.add(new ColumnEntry("runtimePeriod.start", COLUMN_TYPE.DATE, "global.from")); cols.add(new ColumnEntry("runtimePeriod.end", COLUMN_TYPE.DATE, "global.to")); cols.add(new ColumnEntry("typeOfStatus", COLUMN_TYPE.TYPE_OF_STATUS, "global.type_of_status")); cols.add(new ColumnEntry(numberAT.getId().toString(), COLUMN_TYPE.ATTRIBUTE, numberAT.getName())); ViewConfiguration viewConfiguration = new ViewConfiguration(TypeOfBuildingBlock.INFORMATIONSYSTEMRELEASE, Locale.GERMAN); viewConfiguration.setVisibleColumns(cols); return new SpreadsheetReportTableStructure(viewConfiguration); }
From source file:de.iteratec.iteraplan.businesslogic.service.legacyExcel.ExcelImportServiceAttributesIntegrationTest.java
/** * Tests if the attributes of the {@link InformationSystemInterface} will be imported and updated. * /*from w ww. j av a2 s .c om*/ * @throws Exception if an exception occurs */ @Test public void testAttributesExistAfterInterfaceImport() { InformationSystem isA = testDataHelper.createInformationSystem("I1"); InformationSystemRelease isrA = testDataHelper.createInformationSystemRelease(isA, "i1", TEST_DESCRIPTION, "1.1.2005", "31.12.2005", InformationSystemRelease.TypeOfStatus.CURRENT); InformationSystem isB = testDataHelper.createInformationSystem("I2"); InformationSystemRelease isrB = testDataHelper.createInformationSystemRelease(isB, "i2", TEST_DESCRIPTION, "1.1.2006", "31.12.2006", InformationSystemRelease.TypeOfStatus.CURRENT); InformationSystemInterface informationSystemInterface = testDataHelper .createInformationSystemInterfaceWithNameDirection("", "-", "Interface description", isrA, isrB, null); assertNotNull(informationSystemInterface); TextAV textAV1 = createTextAttribute("1"); TextAV textAV2 = createTextAttribute("2"); TextAV textAV3 = createTextAttribute("3"); testDataHelper.createAVA(informationSystemInterface, textAV1); testDataHelper.createAVA(informationSystemInterface, textAV2); testDataHelper.createAVA(informationSystemInterface, textAV3); final HSSFWorkbook workbook = new HSSFWorkbook(); final HSSFSheet sheet = workbook.createSheet(); final HSSFRow row = sheet.createRow(0); final Cell cell1 = row.createCell(0); final Cell cell2 = row.createCell(0); final Cell cell3 = row.createCell(0); cell1.setCellValue(UPDATED_TEXT_AV1); cell2.setCellValue(isrA.getNonHierarchicalName()); cell3.setCellValue(isrB.getNonHierarchicalName()); final Map<String, Cell> attributesMap = Maps.newHashMap(); attributesMap.put("TextAT1", cell1); final Map<String, Cell> contentMap = Maps.newHashMap(); contentMap.put("Informationssystem A", cell2); contentMap.put("Informationssystem B", cell3); LandscapeData landscapeData = new LandscapeData(); landscapeData.addRelation(informationSystemInterface, contentMap, attributesMap); landscapeData.setLocale(Locale.GERMAN); excelImportService.importLandscapeData(landscapeData); InformationSystemInterface isiLoadedFromDb = isiService.loadObjectById(informationSystemInterface.getId()); Set<AttributeValueAssignment> attributeValueAssignments = isiLoadedFromDb.getAttributeValueAssignments(); assertEquals("Some attribute value assignments were deleted.", 3, attributeValueAssignments.size()); checkAttributeValues(attributeValueAssignments, textAV1.getAbstractAttributeType(), UPDATED_TEXT_AV1); checkAttributeValues(attributeValueAssignments, textAV2.getAbstractAttributeType(), "Text Value2"); checkAttributeValues(attributeValueAssignments, textAV3.getAbstractAttributeType(), "Text Value3"); }
From source file:de.dekarlab.moneybuilder.view.AnalyticsView.java
/** * Create pie chart./*from w w w. j a v a2 s.com*/ * * @param dataset * @param title * @return */ protected JFreeChart createBarChart(final CategoryDataset dataset, final String title) { final JFreeChart chart = ChartFactory.createBarChart("", // chart title App.getGuiProp("report.period.lbl"), // domain axis label App.getGuiProp("report.value.lbl"), // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips false // urls ); final CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setNoDataMessage(App.getGuiProp("report.nodata.msg")); plot.setBackgroundPaint(Color.white); ((NumberAxis) plot.getRangeAxis()).setAutoRangeIncludesZero(false); ((CategoryAxis) plot.getDomainAxis()).setMaximumCategoryLabelLines(10); ((CategoryAxis) plot.getDomainAxis()).setCategoryLabelPositions(CategoryLabelPositions.DOWN_90); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.gray); plot.setRangeGridlinePaint(Color.gray); plot.setRangeGridlinesVisible(true); plot.setRangeZeroBaselinePaint(Color.black); plot.setRangeZeroBaselineVisible(true); int color = 0; ((BarRenderer) plot.getRenderer()).setBarPainter(new StandardBarPainter()); CategoryItemRenderer renderer = plot.getRenderer(); for (int ser = 0; ser < dataset.getColumnCount(); ser++) { renderer.setSeriesPaint(ser, COLORS[color]); renderer.setSeriesItemLabelGenerator(ser, new StandardCategoryItemLabelGenerator("{2}", NumberFormat.getInstance(Locale.GERMAN))); renderer.setSeriesItemLabelsVisible(ser, true); color++; if (COLORS.length == color) { color = 0; } } return chart; }
From source file:de.iteratec.turm.servlets.TurmServlet.java
/** * Determines the current Locale, stores it in the session and returns it. * //www. j a v a 2s . co m * It first checks, if a request parameter contains the current locale. This * means the user has selected a different locale. Otherwise, it tries to * retrieve the locale from the session. If that doesn't exist, the current * locale is taken from the request itself. * * @param request The current Serlvet Request * @return The current Locale as set by the user, or as stored in the session. */ private Locale setAndStoreCurrentLocale(HttpServletRequest request) { HttpSession session = request.getSession(); Locale currentLocaleToSet; if (request.getParameter(CURRENT_LOCALE_KEY) != null) { String parameterLocale = request.getParameter(CURRENT_LOCALE_KEY); if (parameterLocale.equals("de")) { currentLocaleToSet = Locale.GERMAN; } else { currentLocaleToSet = Locale.ENGLISH; } LOGGER.debug("Locale created from HTTP parameter: " + currentLocaleToSet); } else if (session.getAttribute(CURRENT_LOCALE_KEY) != null) { currentLocaleToSet = (Locale) session.getAttribute(CURRENT_LOCALE_KEY); LOGGER.debug("Locale loaded from session: " + currentLocaleToSet); } else { currentLocaleToSet = request.getLocale(); if (currentLocaleToSet.getLanguage().toUpperCase().matches(".*DE.*")) { currentLocaleToSet = Locale.GERMAN; } else { currentLocaleToSet = Locale.ENGLISH; } LOGGER.debug( "Locale loaded from HTTP request header. Language is: " + currentLocaleToSet.getLanguage()); } this.currentLocale = currentLocaleToSet; session.setAttribute(CURRENT_LOCALE_KEY, currentLocale); return currentLocale; }
From source file:net.yacy.cora.language.phonetic.ColognePhonetic.java
/** * Converts the string to upper case and replaces germanic characters as defined in {@link #PREPROCESS_MAP}. *///from ww w. j a va 2 s . c o m private String preprocess(String text) { text = text.toUpperCase(Locale.GERMAN); char[] chrs = text.toCharArray(); for (int index = 0; index < chrs.length; index++) { if (chrs[index] > 'Z') { for (char[] element : PREPROCESS_MAP) { if (chrs[index] == element[0]) { chrs[index] = element[1]; break; } } } } return new String(chrs); }
From source file:com.seajas.search.codex.service.social.SocialProfileServiceTest.java
@Test public void testSearchFacebookPages() throws Exception { List<Reference> pageReferences = Lists.newArrayList(new Reference("id3", "name3")); FacebookProfile fbp3 = new FacebookProfile("id", "username", "name", "first", "last", "gender", Locale.GERMAN); when(socialFacadeMock.searchFacebookPages("testPerson")).thenReturn(pageReferences); when(socialFacadeMock.getFacebookPages(Lists.newArrayList("id3"))).thenReturn(Lists.newArrayList(fbp3)); List<SocialProfileDto> dtos = socialProfileService.searchFacebookPages("testPerson", false); verify(mediaServiceMock, times(1)).storeUrl(anyString(), (String) isNull(), eq("image")); List profiles = Lists.newArrayList(SocialProfileDto.translate(fbp3)); Assert.assertEquals(profiles, dtos); }
From source file:com.acc.core.batch.task.BatchIntegrationTest.java
@Test public void testVariant() throws Exception { processFile(productId, "base_product-", new ProductContent() { @Override/*from w w w .j a v a2 s . c om*/ public void writeContent(final PrintWriter writer) throws IOException { writer.print("ApparelSizeVariantProduct"); super.writeContent(writer); } }); final Long variantId = Long.valueOf(Math.abs(random.nextLong())); final ProductModel product = processFile(productId, "variant-", new FileContent() { @Override public void writeContent(final PrintWriter writer) throws IOException { writer.print(variantId); writer.print(SEPARATOR); writer.print(SEPARATOR); writer.print("black"); writer.print(SEPARATOR); writer.print("L"); } }); final ApparelSizeVariantProductModel variant = (ApparelSizeVariantProductModel) productService .getProductForCode(variantId.toString()); Assert.assertEquals("ApparelSizeVariantProduct", product.getVariantType().getCode()); Assert.assertEquals(product, variant.getBaseProduct()); Assert.assertEquals("black", variant.getStyle(Locale.ENGLISH)); Assert.assertNull(variant.getStyle(Locale.GERMAN)); Assert.assertEquals("L", variant.getSize(Locale.ENGLISH)); Assert.assertNull(variant.getSize(Locale.GERMAN)); }
From source file:org.alfresco.repo.node.NodeServiceTest.java
@Test public void testLocaleSupport() throws Exception { // Ensure that the root node has the default locale Locale locale = (Locale) nodeService.getProperty(rootNodeRef, ContentModel.PROP_LOCALE); assertNotNull("Locale property must occur on every node", locale); assertEquals("Expected default locale on the root node", I18NUtil.getLocale(), locale); assertTrue("Every node must have sys:localized", nodeService.hasAspect(rootNodeRef, ContentModel.ASPECT_LOCALIZED)); // Now switch to a specific locale and create a new node I18NUtil.setLocale(Locale.CANADA_FRENCH); // Create a node using an explicit locale NodeRef nodeRef1 = nodeService/*from w ww. ja v a2 s . c om*/ .createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, this.getClass().getName()), ContentModel.TYPE_CONTAINER, Collections.singletonMap(ContentModel.PROP_LOCALE, (Serializable) Locale.GERMAN)) .getChildRef(); assertTrue("Every node must have sys:localized", nodeService.hasAspect(nodeRef1, ContentModel.ASPECT_LOCALIZED)); assertEquals("Didn't set the explicit locale during create. ", Locale.GERMAN, nodeService.getProperty(nodeRef1, ContentModel.PROP_LOCALE)); // Create a node using the thread's locale NodeRef nodeRef2 = nodeService.createNode(rootNodeRef, ContentModel.ASSOC_CHILDREN, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, this.getClass().getName()), ContentModel.TYPE_CONTAINER).getChildRef(); assertTrue("Every node must have sys:localized", nodeService.hasAspect(nodeRef2, ContentModel.ASPECT_LOCALIZED)); assertEquals("Didn't set the locale during create. ", Locale.CANADA_FRENCH, nodeService.getProperty(nodeRef2, ContentModel.PROP_LOCALE)); // Switch Locale and modify ml:text property I18NUtil.setLocale(Locale.CHINESE); nodeService.setProperty(nodeRef2, ContentModel.PROP_DESCRIPTION, "Chinese description"); I18NUtil.setLocale(Locale.FRENCH); nodeService.setProperty(nodeRef2, ContentModel.PROP_DESCRIPTION, "French description"); // Expect that we have MLText (if we are ML aware) boolean wasMLAware = MLPropertyInterceptor.setMLAware(true); try { MLText checkDescription = (MLText) nodeService.getProperty(nodeRef2, ContentModel.PROP_DESCRIPTION); assertEquals("Chinese description", checkDescription.getValue(Locale.CHINESE)); assertEquals("French description", checkDescription.getValue(Locale.FRENCH)); } finally { MLPropertyInterceptor.setMLAware(wasMLAware); } // But the node locale must not have changed assertEquals("Node modification should not affect node locale. ", Locale.CANADA_FRENCH, nodeService.getProperty(nodeRef2, ContentModel.PROP_LOCALE)); // Now explicitly set the node's locale nodeService.setProperty(nodeRef2, ContentModel.PROP_LOCALE, Locale.ITALY); assertEquals("Node locale must be settable. ", Locale.ITALY, nodeService.getProperty(nodeRef2, ContentModel.PROP_LOCALE)); // But mltext must be unchanged assertEquals("Canada-French must be closest to French. ", "French description", nodeService.getProperty(nodeRef2, ContentModel.PROP_DESCRIPTION)); // Finally, ensure that setting Locale to 'null' is takes the node back to its original locale nodeService.setProperty(nodeRef2, ContentModel.PROP_LOCALE, null); assertEquals("Node locale set to 'null' does nothing. ", Locale.ITALY, nodeService.getProperty(nodeRef2, ContentModel.PROP_LOCALE)); nodeService.removeProperty(nodeRef2, ContentModel.PROP_LOCALE); assertEquals("Node locale removal does nothing. ", Locale.ITALY, nodeService.getProperty(nodeRef2, ContentModel.PROP_LOCALE)); // Mass-set the properties, changing the locale in the process Map<QName, Serializable> props = nodeService.getProperties(nodeRef2); props.put(ContentModel.PROP_LOCALE, Locale.GERMAN); nodeService.setProperties(nodeRef2, props); assertEquals("Node locale not set in setProperties(). ", Locale.GERMAN, nodeService.getProperty(nodeRef2, ContentModel.PROP_LOCALE)); }
From source file:cec.easyshop.core.batch.task.BatchIntegrationTest.java
@Test public void testVariant() throws Exception { processFile(productId, "base_product-", new ProductContent() { @Override/*from w w w . j ava 2 s . co m*/ public void writeContent(final PrintWriter writer) throws IOException { writer.print("ApparelSizeVariantProduct"); super.writeContent(writer); } }); final Long variantId = Long.valueOf(Math.abs((long) random.nextInt())); final ProductModel product = processFile(productId, "variant-", new FileContent() { @Override public void writeContent(final PrintWriter writer) throws IOException { writer.print(variantId); writer.print(SEPARATOR); writer.print(SEPARATOR); writer.print("black"); writer.print(SEPARATOR); writer.print("L"); } }); final ApparelSizeVariantProductModel variant = (ApparelSizeVariantProductModel) productService .getProductForCode(variantId.toString()); Assert.assertEquals("ApparelSizeVariantProduct", product.getVariantType().getCode()); Assert.assertEquals(product, variant.getBaseProduct()); Assert.assertEquals("black", variant.getStyle(Locale.ENGLISH)); Assert.assertNull(variant.getStyle(Locale.GERMAN)); Assert.assertEquals("L", variant.getSize(Locale.ENGLISH)); Assert.assertNull(variant.getSize(Locale.GERMAN)); }
From source file:marytts.language.de.JPhonemiser.java
/** * Phonemise the word text. This starts with a simple lexicon lookup, * followed by some heuristics, and finally applies letter-to-sound rules * if nothing else was successful. /*from ww w .j av a 2 s . co m*/ * @param text the textual (graphemic) form of a word. * @param g2pMethod This is an awkward way to return a second * String parameter via a StringBuilder. If a phonemisation of the text is * found, this parameter will be filled with the method of phonemisation * ("lexicon", ... "rules"). * @return a phonemisation of the text if one can be generated, or * null if no phonemisation method was successful. */ @Override public String phonemise(String text, String pos, StringBuilder g2pMethod) { // First, try a simple userdict and lexicon lookup: String result = userdictLookup(text, pos); if (result != null) { g2pMethod.append("userdict"); return result; } result = lexiconLookup(text, pos); if (result != null) { g2pMethod.append("lexicon"); return result; } /** // Not found? Try a compound "analysis": result = compoundSearch(text); //logger.debug("Compound here: "+compoundSearch(text)); if (result != null) { g2pMethod.append("compound"); return result; }**/ // Lookup attempts failed. Try normalising exotic letters // (diacritics on vowels, etc.), look up again: String normalised = MaryUtils.normaliseUnicodeLetters(text, Locale.GERMAN); if (!normalised.equals(text)) { // First, try a simple userdict and lexicon lookup: result = userdictLookup(normalised, pos); if (result != null) { g2pMethod.append("userdict"); return result; } result = lexiconLookup(normalised, pos); if (result != null) { g2pMethod.append("lexicon"); return result; } /** // Not found? Try a compound "analysis": result = compoundSearch(normalised); if (result != null) { g2pMethod.append("compound"); return result; }**/ } // plain English word must be looked up in English lexicon before phonemiseDenglish starts if (usEnglishLexicon != null) { String englishTranscription = phonemiseEn(text); if (englishTranscription != null) { g2pMethod.append("foreign:en"); logger.debug(text + " is English"); if (logEnglishFileName != null) { String englishText = text.trim(); if (english2Frequency.containsKey(englishText)) { int textFreq = english2Frequency.get(englishText); textFreq++; english2Frequency.put(englishText, textFreq); } else { english2Frequency.put(englishText, 1); } } return englishTranscription; } } Result resultingWord = phonemiseDenglish.processWord(text, usEnglishLexicon != null); result = resultingWord.getTranscription(); boolean usedOtherLanguageToPhonemise = resultingWord.isUsedOtherLanguageToPhonemise(); //logger.debug("input for PD: "+text); if (result != null) { result = allophoneSet.splitAllophoneString(result); if (usedOtherLanguageToPhonemise) { g2pMethod.append("phonemiseDenglish"); return result; } else { g2pMethod.append("compound"); return result; } } // Cannot find it in the lexicon -- apply letter-to-sound rules // to the normalised form String phones = lts.predictPronunciation(normalised); result = lts.syllabify(phones); if (result != null) { if (logUnknownFileName != null) { String unknownText = text.trim(); if (unknown2Frequency.containsKey(unknownText)) { int textFreq = unknown2Frequency.get(unknownText); textFreq++; unknown2Frequency.put(unknownText, textFreq); } else { unknown2Frequency.put(unknownText, new Integer(1)); } } g2pMethod.append("rules"); return result; } return null; }