Example usage for java.util Locale ITALIAN

List of usage examples for java.util Locale ITALIAN

Introduction

In this page you can find the example usage for java.util Locale ITALIAN.

Prototype

Locale ITALIAN

To view the source code for java.util Locale ITALIAN.

Click Source Link

Document

Useful constant for language.

Usage

From source file:it.uniud.ailab.dcore.annotation.annotators.SimpleNGramGeneratorAnnotator.java

/**
 * Initializes the nGram generator.//from www . ja  va2 s.  c o  m
 */
public SimpleNGramGeneratorAnnotator() {

    validPOSPatterns = new HashMap<>();
    posDatabasePaths = new HashMap<>();
    maxGramSize = DEFAULT_MAX_NGRAM_SIZE;

    posDatabasePaths.put(Locale.ENGLISH,
            getClass().getClassLoader().getResource("ailab/posPatterns/en-penn.json").getFile());
    posDatabasePaths.put(Locale.ITALIAN,
            getClass().getClassLoader().getResource("ailab/posPatterns/it-tanl.json").getFile());
}

From source file:org.liberty.android.fantastischmemo.AMActivity.java

private void updateInterfaceLanguage() {
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this);
    String localeSetting = settings.getString(AMPrefKeys.INTERFACE_LOCALE_KEY, "AUTO");
    Locale locale;//from  w  ww. ja  va 2s  .co  m
    /* Force to use the a language */
    if (localeSetting.equals("EN")) {
        locale = Locale.US;
    } else if (localeSetting.equals("SC")) {
        locale = Locale.SIMPLIFIED_CHINESE;
    } else if (localeSetting.equals("TC")) {
        locale = Locale.TRADITIONAL_CHINESE;
    } else if (localeSetting.equals("CS")) {
        locale = new Locale("CS");
    } else if (localeSetting.equals("PL")) {
        locale = new Locale("PL");
    } else if (localeSetting.equals("RU")) {
        locale = new Locale("RU");
    } else if (localeSetting.equals("DE")) {
        locale = new Locale("DE");
    } else if (localeSetting.equals("KO")) {
        locale = new Locale("KO");
    } else if (localeSetting.equals("FR")) {
        locale = new Locale("FR");
    } else if (localeSetting.equals("PT")) {
        locale = new Locale("PT");
    } else if (localeSetting.equals("JA")) {
        locale = new Locale("JA");
    } else if (localeSetting.equals("ES")) {
        locale = new Locale("ES");
    } else if (localeSetting.equals("IT")) {
        locale = Locale.ITALIAN;
    } else {
        locale = Locale.getDefault();
    }
    Configuration config = new Configuration();
    config.locale = locale;
    getBaseContext().getResources().updateConfiguration(config,
            getBaseContext().getResources().getDisplayMetrics());
}

From source file:eu.trentorise.opendata.commons.test.jackson.OdtCommonsModuleTest.java

@Test
public void example1() throws JsonProcessingException, IOException {

    ObjectMapper om = new ObjectMapper();
    om.registerModule(new GuavaModule());
    om.registerModule(new OdtCommonsModule());

    String json = om.writeValueAsString(LocalizedString.of(Locale.ITALIAN, "ciao"));
    LocalizedString reconstructedLocalizedString = om.readValue(json, LocalizedString.class);
}

From source file:org.syncope.console.pages.Login.java

public Login(final PageParameters parameters) {
    super(parameters);

    form = new Form("login");

    userIdField = new TextField("userId", new Model());
    userIdField.setMarkupId("userId");
    form.add(userIdField);//from   ww  w . j a  v  a  2  s  .  co  m

    passwordField = new PasswordTextField("password", new Model());
    passwordField.setMarkupId("password");
    form.add(passwordField);

    languageSelect = new LocaleDropDown("language",
            Arrays.asList(new Locale[] { Locale.ENGLISH, Locale.ITALIAN }));

    form.add(languageSelect);

    Button submitButton = new Button("submit", new Model(getString("submit"))) {

        private static final long serialVersionUID = 429178684321093953L;

        @Override
        public void onSubmit() {
            String[] entitlements = authenticate(userIdField.getRawInput(), passwordField.getRawInput());

            if (entitlements == null) {
                error(getString("login-error"));
            } else {
                SyncopeSession.get().setUserId(userIdField.getRawInput());
                SyncopeSession.get().setEntitlements(entitlements);
                SyncopeSession.get().setCoreVersion(getCoreVersion());

                setResponsePage(WelcomePage.class, parameters);
            }
        }
    };

    submitButton.setDefaultFormProcessing(false);
    form.add(submitButton);

    add(form);
    add(new FeedbackPanel("feedback"));

    // Modal window for self registration
    final ModalWindow editProfileModalWin = new ModalWindow("selfRegModal");
    editProfileModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    editProfileModalWin.setInitialHeight(SELF_REG_WIN_HEIGHT);
    editProfileModalWin.setInitialWidth(SELF_REG_WIN_WIDTH);
    editProfileModalWin.setCookieName("self-reg-modal");
    add(editProfileModalWin);

    Fragment selfRegFrag;
    if (isSelfRegistrationAllowed()) {
        selfRegFrag = new Fragment("selfRegistration", "selfRegAllowed", this);

        AjaxLink selfRegLink = new IndicatingAjaxLink("link") {

            private static final long serialVersionUID = -7978723352517770644L;

            @Override
            public void onClick(final AjaxRequestTarget target) {
                editProfileModalWin.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        return new UserRequestModalPage(Login.this.getPageReference(), editProfileModalWin,
                                new UserTO());
                    }
                });

                editProfileModalWin.show(target);
            }
        };
        selfRegLink.add(new Label("linkTitle", getString("selfRegistration")));

        Panel panel = new LinkPanel("selfRegistration", new ResourceModel("selfRegistration"));
        panel.add(selfRegLink);
        selfRegFrag.add(panel);
    } else {
        selfRegFrag = new Fragment("selfRegistration", "selfRegNotAllowed", this);
    }
    add(selfRegFrag);
}

From source file:uk.q3c.krail.i18n.DefaultPatternUtilityTest.java

@Test
public void writeOutExclusive() throws IOException {
    //given//  w w  w .j  a va 2 s  . c o m
    File testOutDir = new File(ResourceUtils.userTempDirectory(), "testOut");
    if (testOutDir.exists()) {
        FileUtils.deleteQuietly(testOutDir);
    }
    File targetDir = new File(ResourceUtils.userTempDirectory(), "testOut/codeModel");
    writer.setOptionWritePath(targetDir);

    File referenceFile_it = new File(TestResource.testResourceRootDir("krail"), "Labels_it.ref_exc");
    File targetFile_it = new File(targetDir, "Labels_it.java");
    //when
    utility.writeOutExclusive("class", writer, LabelKey.class, Locale.ITALIAN, Optional.empty());
    //then
    assertThat(FileTestUtil.compare(referenceFile_it, targetFile_it, 4)).isEqualTo(Optional.empty());
}

From source file:eu.trentorise.opendata.commons.test.jackson.OdtCommonsModuleTest.java

@Test
public void example2() throws JsonProcessingException, IOException {

    ObjectMapper om = new ObjectMapper();
    OdtCommonsModule.registerModulesInto(om);

    String json = om.writeValueAsString(LocalizedString.of(Locale.ITALIAN, "ciao"));
    LocalizedString reconstructedLocalizedString = om.readValue(json, LocalizedString.class);
}

From source file:uk.q3c.krail.i18n.DefaultPatternUtilityTest.java

@Test
public void writeOutExclusive_renamed() throws IOException {
    //given/*from  www .  jav a  2s  .  com*/
    File testOutDir = new File(ResourceUtils.userTempDirectory(), "testOut");
    if (testOutDir.exists()) {
        FileUtils.deleteQuietly(testOutDir);
    }
    File targetDir = new File(ResourceUtils.userTempDirectory(), "testOut/codeModel");
    writer.setOptionWritePath(targetDir);

    File referenceFile_it = new File(TestResource.testResourceRootDir("krail"), "NewBundle_it.ref_exc");
    File targetFile_it = new File(targetDir, "NewBundle_it.java");
    //when
    utility.writeOutExclusive("class", writer, LabelKey.class, Locale.ITALIAN, Optional.of("NewBundle"));
    //then
    assertThat(FileTestUtil.compare(referenceFile_it, targetFile_it, 4)).isEqualTo(Optional.empty());
}

From source file:alfio.manager.WaitingQueueProcessorIntegrationTest.java

@Test
public void testPreRegistration() {
    List<TicketCategoryModification> categories = Collections.singletonList(new TicketCategoryModification(null,
            "default", 10, new DateTimeModification(LocalDate.now().plusDays(1), LocalTime.now()),
            new DateTimeModification(LocalDate.now().plusDays(2), LocalTime.now()), DESCRIPTION, BigDecimal.TEN,
            false, "", false, null, null, null, null, null));
    Pair<Event, String> pair = initEvent(categories, organizationRepository, userManager, eventManager,
            eventRepository);//w w  w.  j a va  2 s. c  o m
    Event event = pair.getKey();
    waitingQueueManager.subscribe(event, new CustomerName("Giuseppe Garibaldi", "Giuseppe", "Garibaldi", event),
            "peppino@garibaldi.com", null, Locale.ENGLISH);
    waitingQueueManager.subscribe(event, new CustomerName("Nino Bixio", "Nino", "Bixio", event),
            "bixio@mille.org", null, Locale.ITALIAN);
    assertTrue(waitingQueueRepository.countWaitingPeople(event.getId()) == 2);

    waitingQueueSubscriptionProcessor.distributeAvailableSeats(event);
    assertEquals(18, ticketRepository.findFreeByEventId(event.getId()).size());

    TicketCategoryModification tcm = new TicketCategoryModification(null, "default", 10,
            new DateTimeModification(LocalDate.now().minusDays(1), LocalTime.now()),
            new DateTimeModification(LocalDate.now().plusDays(5), LocalTime.now()), DESCRIPTION, BigDecimal.TEN,
            false, "", true, null, null, null, null, null);
    eventManager.insertCategory(event.getId(), tcm, pair.getValue());

    waitingQueueSubscriptionProcessor.distributeAvailableSeats(event);

    List<WaitingQueueSubscription> subscriptions = waitingQueueRepository.loadAll(event.getId());
    assertEquals(2, subscriptions.stream().filter(w -> StringUtils.isNotBlank(w.getReservationId())).count());
    assertTrue(subscriptions.stream()
            .allMatch(w -> w.getStatus().equals(WaitingQueueSubscription.Status.PENDING)));
    assertTrue(subscriptions.stream()
            .allMatch(w -> w.getSubscriptionType().equals(WaitingQueueSubscription.Type.PRE_SALES)));

}

From source file:org.tylproject.data.mongo.NumeratorTest.java

/**
 * test the use of the key of the TylModelErrorCode included in the TylModelException as key for the
 * localized message.The message includes the code nd
 *
 *///from  w  ww.j a  va2 s . c o m
@Test
public void testNumericNumeratorOutOfRangeCatched() {
    try {
        assertEquals(234, numeratorRep.getNextNum("invNum", new DateTime(2999, 4, 12, 0, 0)));
    } catch (TylModelException e) {
        if (e.getErrorCode().equals(BasicsError.NO_NUMERATOR)) {
            String italianMessage = context.getMessage(e.getErrorCode().getKey(),
                    new Object[] { "invNum",
                            new DateTime(2999, 4, 12, 0, 0).toString(DateTimeFormat.shortDate()) },
                    Locale.ITALIAN);
            String englishMessage = context.getMessage(e.getErrorCode().getKey(),
                    new Object[] { "invNum",
                            new DateTime(2999, 4, 12, 0, 0).toString(DateTimeFormat.shortDate()) },
                    Locale.ENGLISH);
            String itmsg = String.format("Nessun numeratore trovato per numeratore con codice %s alla data %s",
                    e.get("code"), ((DateTime) e.get("date")).toString(DateTimeFormat.shortDate()));
            assertEquals(italianMessage, itmsg);
            String enmsg = String.format("No numerator found for code %s and date %s", e.get("code"),
                    ((DateTime) e.get("date")).toString(DateTimeFormat.shortDate()));
            assertEquals(englishMessage, enmsg);
            System.out.println(itmsg);
        }
    }
}

From source file:it.f2informatica.webapp.test.context.WebApplicationContextTest.java

@Test
public void messageSource() {
    ReloadableResourceBundleMessageSource messageSource = webApplicationConfig.messageSource();
    String englishMessage = messageSource.getMessage("message.test", new Object[] {}, Locale.ENGLISH);
    assertThat(englishMessage).isEqualTo("Message in English");
    String italianMessage = messageSource.getMessage("message.test", new Object[] {}, Locale.ITALIAN);
    assertThat(italianMessage).isEqualTo("Messaggio in Italiano");
}