List of usage examples for java.util Locale ITALIAN
Locale ITALIAN
To view the source code for java.util Locale ITALIAN.
Click Source Link
From source file:org.yccheok.jstock.gui.Utils.java
/** * Returns true if there are specified language files designed for this * locale. As in Java, when there are no specified language files for a * locale, a default language file will be used. * /*from w ww. j a v a2 s. co m*/ * @param locale the locale * @return true if there are specified language files designed for this * locale */ public static boolean hasSpecifiedLanguageFile(Locale locale) { // Please revise Statement's construct code, when adding in new language. // So that its language guessing algorithm will work as it is. if (Utils.isTraditionalChinese(locale)) { return true; } else if (Utils.isSimplifiedChinese(locale)) { return true; } else if (locale.getLanguage().equals(Locale.GERMAN.getLanguage())) { return true; } else if (locale.getLanguage().equals(Locale.ENGLISH.getLanguage())) { return true; } else if (locale.getLanguage().equals(Locale.ITALIAN.getLanguage())) { return true; } else if (locale.getLanguage().equals(Locale.FRENCH.getLanguage())) { return true; } return false; }
From source file:divya.myvision.TessActivity.java
public void setLang(String lang) { Locale locale;//from w ww . ja v a2 s . com if (lang.equals("Spanish")) { // Set up the Text To Speech engine. TextToSpeech.OnInitListener listener = new TextToSpeech.OnInitListener() { @Override public void onInit(final int status) { Locale locSpanish = new Locale("spa", "MEX"); tts.setLanguage(locSpanish); } }; tts = new TextToSpeech(this.getApplicationContext(), listener); locale = new Locale("spa", "MEX"); } else if (lang.equals("French")) { // Set up the Text To Speech engine. TextToSpeech.OnInitListener listener = new TextToSpeech.OnInitListener() { @Override public void onInit(final int status) { tts.setLanguage(Locale.FRENCH); } }; tts = new TextToSpeech(this.getApplicationContext(), listener); locale = new Locale("fr"); } else if (lang.equals("Japanese")) { // Set up the Text To Speech engine. TextToSpeech.OnInitListener listener = new TextToSpeech.OnInitListener() { @Override public void onInit(final int status) { tts.setLanguage(Locale.JAPANESE); } }; tts = new TextToSpeech(this.getApplicationContext(), listener); locale = new Locale("ja"); } else if (lang.equals("Chinese")) { // Set up the Text To Speech engine. TextToSpeech.OnInitListener listener = new TextToSpeech.OnInitListener() { @Override public void onInit(final int status) { tts.setLanguage(Locale.CHINESE); } }; tts = new TextToSpeech(this.getApplicationContext(), listener); locale = new Locale("zh"); } else if (lang.equals("German")) { // Set up the Text To Speech engine. TextToSpeech.OnInitListener listener = new TextToSpeech.OnInitListener() { @Override public void onInit(final int status) { tts.setLanguage(Locale.GERMAN); } }; tts = new TextToSpeech(this.getApplicationContext(), listener); locale = new Locale("de"); } else if (lang.equals("Italian")) { // Set up the Text To Speech engine. TextToSpeech.OnInitListener listener = new TextToSpeech.OnInitListener() { @Override public void onInit(final int status) { tts.setLanguage(Locale.ITALIAN); } }; tts = new TextToSpeech(this.getApplicationContext(), listener); locale = new Locale("it"); } else if (lang.equals("Korean")) { // Set up the Text To Speech engine. TextToSpeech.OnInitListener listener = new TextToSpeech.OnInitListener() { @Override public void onInit(final int status) { tts.setLanguage(Locale.KOREAN); } }; tts = new TextToSpeech(this.getApplicationContext(), listener); locale = new Locale("ko"); } else if (lang.equals("Hindi")) { // Set up the Text To Speech engine. TextToSpeech.OnInitListener listener = new TextToSpeech.OnInitListener() { @Override public void onInit(final int status) { Locale locHindhi = new Locale("hi"); tts.setLanguage(locHindhi); } }; tts = new TextToSpeech(this.getApplicationContext(), listener); locale = new Locale("hi"); } else if (lang.equals("Russian")) { // Set up the Text To Speech engine. TextToSpeech.OnInitListener listener = new TextToSpeech.OnInitListener() { @Override public void onInit(final int status) { Locale locHindhi = new Locale("ru"); tts.setLanguage(locHindhi); } }; tts = new TextToSpeech(this.getApplicationContext(), listener); locale = new Locale("ru"); } else { TextToSpeech.OnInitListener listener = new TextToSpeech.OnInitListener() { @Override public void onInit(final int status) { tts.setLanguage(Locale.US); } }; tts = new TextToSpeech(this.getApplicationContext(), listener); locale = new Locale("en"); } Locale.setDefault(locale); Configuration config = new Configuration(); config.setLocale(locale); this.getApplicationContext().getResources().updateConfiguration(config, null); }
From source file:it.gmariotti.android.examples.googleaccount.GDriveActivity.java
private void createFile() { Thread t = new Thread(new Runnable() { @Override//from w ww. jav a2 s . com public void run() { if (mService == null) initService(); try { // Create Folder if it doesn't exist File folder = _createFolder(); String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.ITALIAN).format(new Date()); File body = new File(); body.setTitle("Example file " + timeStamp); body.setMimeType(MIME_TEXT_PLAIN); body.setDescription("File Description"); String bodyText = " Lorem ipsum dolor sit amet, consectetur adipisici elit, sed eiusmod tempor incidunt " + "ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco labor...."; // Set the parent folder. body.setParents(Arrays.asList(new ParentReference().setId(folder.getId()))); ByteArrayContent content = ByteArrayContent.fromString("text/plain", bodyText); File file = mService.files().insert(body, content).execute(); if (file != null) { showToast("File created: " + file.getTitle()); } } catch (UserRecoverableAuthIOException e) { Intent intent = e.getIntent(); startActivityForResult(intent, REQUEST_AUTHORIZATION_FILE); } catch (IOException e) { Log.e("TAG", "Error in upload", e); } } }); t.start(); }
From source file:eu.trentorise.opendata.semtext.jackson.test.SemTextModuleTest.java
/** * Example with manual modules registration *///from w ww. ja v a2s . c o m @Test public void example1() throws JsonProcessingException, IOException { ObjectMapper om = new ObjectMapper(); om.registerModule(new GuavaModule()); om.registerModule(new OdtCommonsModule()); om.registerModule(new SemTextModule()); String json = om.writeValueAsString(SemText.of(Locale.ITALIAN, "ciao")); SemText reconstructedSemText = om.readValue(json, SemText.class); }
From source file:eu.trentorise.opendata.semtext.jackson.test.SemTextModuleTest.java
/** * Example with one line module registration *//*from ww w. jav a 2s. c o m*/ @Test public void example2() throws JsonProcessingException, IOException { ObjectMapper om = new ObjectMapper(); SemTextModule.registerModulesInto(om); String json = om.writeValueAsString(SemText.of(Locale.ITALIAN, "ciao")); SemText reconstructedSemText = om.readValue(json, SemText.class); }
From source file:org.terasoluna.gfw.web.exception.SystemExceptionResolverTest.java
@Test public void testDoResolveException_super_return_notnull() throws Exception { // do setup.//w w w . j ava2 s . c o m ResultMessages resultMessages = ResultMessages.error().add("code001"); BusinessException occurException = new BusinessException(resultMessages); // setup locale. Locale locale = Locale.ITALIAN; mockRequest.addPreferredLocale(locale); // setup FlashMap. FlashMap flashMap = new FlashMap(); mockRequest.setAttribute(DispatcherServlet.OUTPUT_FLASH_MAP_ATTRIBUTE, flashMap); // setup exception resolver. // setup default. testTarget.setDefaultErrorView("defaultErrorView"); testTarget.setDefaultStatusCode(444); // setup exception code resolver. SimpleMappingExceptionCodeResolver exceptionCodeResolver = new SimpleMappingExceptionCodeResolver(); exceptionCodeResolver.setDefaultExceptionCode("defaultExceptionCode"); testTarget.setExceptionCodeResolver(exceptionCodeResolver); // do test. ModelAndView actualModleAndView = testTarget.doResolveException(mockRequest, mockResponse, null, occurException); // do assert. assertThat(mockResponse.getStatus(), is(444)); assertThat((Integer) mockRequest.getAttribute(WebUtils.ERROR_STATUS_CODE_ATTRIBUTE), is(444)); assertSame(occurException, actualModleAndView.getModel().get(SimpleMappingExceptionResolver.DEFAULT_EXCEPTION_ATTRIBUTE)); assertThat(mockRequest.getAttribute("exceptionCode").toString(), is("defaultExceptionCode")); assertThat(mockResponse.getHeader("X-Exception-Code"), is("defaultExceptionCode")); assertSame(resultMessages, flashMap.get(ResultMessages.DEFAULT_MESSAGES_ATTRIBUTE_NAME)); }
From source file:eu.trentorise.opendata.semtext.jackson.test.SemTextModuleTest.java
@Test public void testMetadataSerializationComplex() throws JsonProcessingException, IOException { ObjectMapper om = new ObjectMapper(); // register all required modules into the Jackson Object Mapper SemTextModule.registerModulesInto(om); // declare that metadata under namespace 'testns' in SemText objects should be deserialized into a MyMetadata object SemTextModule.registerMetadata(SemText.class, "testns", MyMetadata.class); // Let's say MyMetadata is tricky to deserialize, so we tell Jackson how to deserialize it with a mixin annotation om.registerModule(new SimpleModule() { {//from www .ja va2s . c om setMixInAnnotation(MyMetadata.class, MyMetadataJackson.class); } }); String json = om.writeValueAsString( SemText.of(Locale.ITALIAN, "ciao").withMetadata("testns", MyMetadata.of("hello"))); SemText reconstructedSemText = om.readValue(json, SemText.class); MyMetadata reconstructedMetadata = (MyMetadata) reconstructedSemText.getMetadata("testns"); assert MyMetadata.of("hello").equals(reconstructedMetadata); }
From source file:it.gmariotti.android.examples.googleaccount.SmsBackupGDriveActivity.java
/** * Backup SMSs to GDrive//from w w w. j av a2s. c om */ private void backupSmsToGDrive() { // Check for use data folder CheckBox checkbox = (CheckBox) findViewById(R.id.appdatafolder); if (checkbox != null && checkbox.isChecked()) useDataFolder = true; else useDataFolder = false; Thread t = new Thread(new Runnable() { @Override public void run() { try { showToast("Start process"); // Retrieve sms JSONObject messages = readSmsInbox(); Log.i(TAG, messages.toString()); // Create sms backup Folder File folder = null; if (mService == null) initService(); if (!useDataFolder) folder = createBackupFolder(); // File's metadata. String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.ITALIAN).format(new Date()); File body = new File(); body.setTitle("Sms Backup " + timeStamp); body.setMimeType("text/plain"); body.setDescription("Backup sms"); // Set the parent folder. if (useDataFolder) body.setParents(Arrays.asList(new ParentReference().setId("appdata"))); else body.setParents(Arrays.asList(new ParentReference().setId(folder.getId()))); ByteArrayContent content = ByteArrayContent.fromString("text/plain", messages.toString()); File file = mService.files().insert(body, content).execute(); if (file != null) { showToast("Sms backup uploaded: " + file.getTitle()); } } catch (UserRecoverableAuthIOException e) { Intent intent = e.getIntent(); startActivityForResult(intent, REQUEST_AUTHORIZATION_FOLDER); } catch (IOException e) { Log.e("TAG", "Error in backup", e); } catch (JSONException e) { Log.e("TAG", "Error in backup", e); } } private File createBackupFolder() { File folder = null; try { folder = _createFolder(); } catch (UserRecoverableAuthIOException e) { Intent intent = e.getIntent(); startActivityForResult(intent, REQUEST_AUTHORIZATION_FOLDER); } catch (IOException e) { Log.e(TAG, "Error in create folder", e); } return folder; } }); t.start(); }
From source file:alfio.manager.WaitingQueueProcessorIntegrationTest.java
private Pair<String, Event> initSoldOutEvent(boolean withUnboundedCategory) throws InterruptedException { int boundedCategorySize = AVAILABLE_SEATS - (withUnboundedCategory ? 1 : 0); List<TicketCategoryModification> categories = new ArrayList<>(); categories.add(new TicketCategoryModification(null, "default", boundedCategorySize, new DateTimeModification(LocalDate.now().minusDays(1), LocalTime.now()), new DateTimeModification(LocalDate.now().plusDays(2), LocalTime.now()), DESCRIPTION, BigDecimal.ZERO, false, "", true, null, null, null, null, null)); if (withUnboundedCategory) { categories.add(new TicketCategoryModification(null, "unbounded", 0, new DateTimeModification(LocalDate.now().minusDays(1), LocalTime.now()), new DateTimeModification(LocalDate.now().plusDays(2), LocalTime.now()), DESCRIPTION, BigDecimal.ZERO, false, "", false, null, null, null, null, null)); }/*from w ww. j a v a 2 s .co m*/ Pair<Event, String> pair = initEvent(categories, organizationRepository, userManager, eventManager, eventRepository); Event event = pair.getKey(); List<TicketCategory> ticketCategories = eventManager.loadTicketCategories(event); TicketCategory bounded = ticketCategories.stream().filter(t -> t.getName().equals("default")).findFirst() .orElseThrow(IllegalStateException::new); List<Integer> boundedReserved = ticketRepository.selectFreeTicketsForPreReservation(event.getId(), 20, bounded.getId()); assertEquals(boundedCategorySize, boundedReserved.size()); List<Integer> reserved = new ArrayList<>(boundedReserved); String reservationId = UUID.randomUUID().toString(); ticketReservationRepository.createNewReservation(reservationId, DateUtils.addHours(new Date(), 1), null, Locale.ITALIAN.getLanguage(), event.getId(), event.getVat(), event.isVatIncluded()); List<Integer> reservedForUpdate = withUnboundedCategory ? reserved.subList(0, 19) : reserved; ticketRepository.reserveTickets(reservationId, reservedForUpdate, bounded.getId(), Locale.ITALIAN.getLanguage(), 0); if (withUnboundedCategory) { TicketCategory unbounded = ticketCategories.stream().filter(t -> t.getName().equals("unbounded")) .findFirst().orElseThrow(IllegalStateException::new); List<Integer> unboundedReserved = ticketRepository .selectNotAllocatedFreeTicketsForPreReservation(event.getId(), 20); assertEquals(1, unboundedReserved.size()); reserved.addAll(unboundedReserved); ticketRepository.reserveTickets(reservationId, reserved.subList(19, 20), unbounded.getId(), Locale.ITALIAN.getLanguage(), 0); } ticketRepository.updateTicketsStatusWithReservationId(reservationId, Ticket.TicketStatus.ACQUIRED.name()); //sold-out waitingQueueManager.subscribe(event, new CustomerName("Giuseppe Garibaldi", "Giuseppe", "Garibaldi", event), "peppino@garibaldi.com", null, Locale.ENGLISH); Thread.sleep(100L);//we are testing ordering, not concurrency... waitingQueueManager.subscribe(event, new CustomerName("Nino Bixio", "Nino", "Bixio", event), "bixio@mille.org", null, Locale.ITALIAN); List<WaitingQueueSubscription> subscriptions = waitingQueueRepository.loadAll(event.getId()); assertTrue(waitingQueueRepository.countWaitingPeople(event.getId()) == 2); assertTrue(subscriptions.stream() .allMatch(w -> w.getSubscriptionType().equals(WaitingQueueSubscription.Type.SOLD_OUT))); //the following call shouldn't have any effect waitingQueueSubscriptionProcessor.distributeAvailableSeats(event); assertTrue(waitingQueueRepository.countWaitingPeople(event.getId()) == 2); return Pair.of(reservationId, event); }
From source file:alfio.manager.system.DataMigratorIntegrationTest.java
@Test public void testUpdateGender() { List<TicketCategoryModification> categories = Collections.singletonList(new TicketCategoryModification(null, "default", AVAILABLE_SEATS, new DateTimeModification(LocalDate.now(), LocalTime.now()), new DateTimeModification(LocalDate.now(), LocalTime.now()), DESCRIPTION, BigDecimal.TEN, false, "", false, null, null, null, null, null)); Pair<Event, String> eventUsername = initEvent(categories); Event event = eventUsername.getKey(); try {//w w w. j ava 2 s .com TicketReservationModification trm = new TicketReservationModification(); trm.setAmount(2); trm.setTicketCategoryId(eventManager.loadTicketCategories(event).get(0).getId()); TicketReservationWithOptionalCodeModification r = new TicketReservationWithOptionalCodeModification(trm, Optional.empty()); Date expiration = DateUtils.addDays(new Date(), 1); String reservationId = ticketReservationManager.createTicketReservation(event, Collections.singletonList(r), Collections.emptyList(), expiration, Optional.empty(), Optional.empty(), Locale.ENGLISH, false); ticketReservationManager.confirm("TOKEN", null, event, reservationId, "email@email.ch", new CustomerName("Full Name", "Full", "Name", event), Locale.ENGLISH, null, new TotalPrice(1000, 10, 0, 0), Optional.empty(), Optional.of(PaymentProxy.ON_SITE), false, null, null, null); List<Ticket> tickets = ticketRepository.findTicketsInReservation(reservationId); UpdateTicketOwnerForm first = new UpdateTicketOwnerForm(); first.setEmail("email@email.ch"); //first.setTShirtSize("SMALL"); //first.setGender("F"); first.setFirstName("Full"); first.setLastName("Name"); UpdateTicketOwnerForm second = new UpdateTicketOwnerForm(); //second.setTShirtSize("SMALL-F"); second.setEmail("email@email.ch"); second.setFirstName("Full"); second.setLastName("Name"); PartialTicketPDFGenerator generator = TemplateProcessor.buildPartialPDFTicket(Locale.ITALIAN, event, ticketReservationManager.findById(reservationId).get(), ticketCategoryRepository.getByIdAndActive(tickets.get(0).getCategoryId(), event.getId()), organizationRepository.getById(event.getOrganizationId()), templateManager, fileUploadManager, ""); ticketReservationManager.updateTicketOwner(tickets.get(0), Locale.ITALIAN, event, first, (t) -> "", (t) -> "", Optional.empty()); ticketReservationManager.updateTicketOwner(tickets.get(1), Locale.ITALIAN, event, second, (t) -> "", (t) -> "", Optional.empty()); //FIXME //dataMigrator.fillTicketsGender(); //ticketRepository.findTicketsInReservation(reservationId).forEach(t -> assertEquals("F", t.getGender())); } finally { eventManager.deleteEvent(event.getId(), eventUsername.getValue()); } }