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:MainClass.java

public static void main(String args[]) throws Exception {

    JFrame frame = new JFrame("Number Input");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Font font = new Font("SansSerif", Font.BOLD, 16);

    JLabel label;//  www. ja  va2  s.  com
    JFormattedTextField input;
    JPanel panel;

    BoxLayout layout = new BoxLayout(frame.getContentPane(), BoxLayout.Y_AXIS);
    frame.setLayout(layout);

    Format integer = NumberFormat.getIntegerInstance(Locale.ITALIAN);
    label = new JLabel("Italian integer:");
    input = new JFormattedTextField(integer);
    input.setValue(2424.50);
    input.setColumns(20);
    input.setFont(font);
    panel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
    panel.add(label);
    panel.add(input);
    frame.add(panel);

    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static GregorianCalendar getCalFromString(String data) {
    dateFormat = new SimpleDateFormat("dd/MM/yyyy", Locale.ITALIAN);
    try {//from  w ww.ja  va  2 s  . co  m
        Date dateTime = dateFormat.parse(data);
        GregorianCalendar gregCalendar = new GregorianCalendar();
        gregCalendar.setTime(dateTime);
        return gregCalendar;
    } catch (ParseException e) {
        e.printStackTrace();
        return null;
    }
}

From source file:eu.trentorise.smartcampus.commons.test.TestSemanticHelper.java

@BeforeClass
public static void setupClient() {
    client = SCWebApiClient.getInstance(Locale.ITALIAN, SE_HOST, SE_PORT);

}

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

@Test
public void testToFromJsonDefaultMapper() throws IOException {
    LocalizedString ls = LocalizedString.of(Locale.ITALIAN, "ciao");
    assertEquals(ls, Jacksonizer.of().fromJson(Jacksonizer.of().toJson(ls), LocalizedString.class));
}

From source file:com.carlomicieli.jtrains.value.objects.LocalizedFieldSerializationTests.java

@Test
public void shouldDeserializeLocalizedFieldsContainStrings() throws IOException {
    LocalizedField<String> field = parseLocalizedField("{\"en\": \"Hello\", \"it\": \"Ciao\"}", String.class);
    assertThat(field).hasSize(2).containsEntry(Locale.ENGLISH, "Hello").containsEntry(Locale.ITALIAN, "Ciao");
}

From source file:com.carlomicieli.jtrains.value.objects.LocalizedFieldSerializationTests.java

@Test
public void shouldDeserializeLocalizedFieldsContainNumbers() throws IOException {
    LocalizedField<Integer> field = parseLocalizedField("{\"en\": 24, \"it\": 42}", Integer.class);
    assertThat(field).hasSize(2).containsEntry(Locale.ENGLISH, 24).containsEntry(Locale.ITALIAN, 42);
}

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

@Test
public void write() throws IOException {
    //given/*  ww  w.  jav  a2s .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);
    Set<Locale> locales = new LinkedHashSet<>();
    locales.add((Locale.ITALIAN));
    locales.add((Locale.GERMAN));
    File referenceFile_de = new File(TestResource.testResourceRootDir("krail"), "TestLabels_de.properties_ref");
    File targetFile_de = new File(targetDir, "TestLabels_de.properties");
    File referenceFile_it = new File(TestResource.testResourceRootDir("krail"), "TestLabels_it.properties_ref");
    File targetFile_it = new File(targetDir, "TestLabels_it.properties");
    //when
    utility.writeOut(writer, TestLabelKey.class, locales, Optional.empty());
    //then
    assertThat(FileTestUtil.compare(referenceFile_de, targetFile_de, 1)).isEqualTo(Optional.empty());
    assertThat(FileTestUtil.compare(referenceFile_it, targetFile_it, 1)).isEqualTo(Optional.empty());
}

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

@Test
public void writeOut_locales_provided_all_keys() throws IOException {
    //        given

    File testOutDir = new File(ResourceUtils.userTempDirectory(), "testOut");
    if (testOutDir.exists()) {
        FileUtils.deleteQuietly(testOutDir);
    }/*from  w  w w .  ja  v a  2  s . c  o  m*/
    File targetDir = new File(ResourceUtils.userTempDirectory(), "testOut/codeModel");
    writer.setOptionWritePath(targetDir);

    Set<Locale> locales = new HashSet<>();
    locales.add(Locale.GERMAN);
    locales.add(Locale.ITALIAN);
    locales.add(Locale.UK);
    locales.add(Locale.forLanguageTag(""));
    File referenceFile = new File(TestResource.testResourceRootDir("krail"), "Labels.ref");
    File targetFile = new File(targetDir, "Labels.java");
    File referenceFile_de = new File(TestResource.testResourceRootDir("krail"), "Labels_de.ref");
    File targetFile_de = new File(targetDir, "Labels_de.java");
    File referenceFile_it = new File(TestResource.testResourceRootDir("krail"), "Labels_it.ref");
    File targetFile_it = new File(targetDir, "Labels_it.java");
    File referenceFile_en_GB = new File(TestResource.testResourceRootDir("krail"), "Labels_en_GB.ref");
    File targetFile_en_GB = new File(targetDir, "Labels_en_GB.java");
    // this is to make sure that setting the default does not mess things up
    Locale.setDefault(Locale.CANADA_FRENCH);

    //when
    utility.writeOut(writer, LabelKey.class, locales, Optional.empty());
    //then line 4 is the timestamp
    assertThat(FileTestUtil.compare(referenceFile, targetFile, 4)).isEqualTo(Optional.empty());
    assertThat(FileTestUtil.compare(referenceFile_de, targetFile_de, 4)).isEqualTo(Optional.empty());
    assertThat(FileTestUtil.compare(referenceFile_it, targetFile_it, 4)).isEqualTo(Optional.empty());
    assertThat(FileTestUtil.compare(referenceFile_en_GB, targetFile_en_GB, 4)).isEqualTo(Optional.empty());
}

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

@Test
public void testToFromJson() {
    ObjectMapper objectMapper = new ObjectMapper();
    TodCommonsModule.registerModulesInto(objectMapper);
    LocalizedString ls = LocalizedString.of(Locale.ITALIAN, "ciao");
    assertEquals(ls, Jacksonizer.of().fromJson(Jacksonizer.of(objectMapper).toJson(ls), LocalizedString.class));

    try {//from www  .  j  a  va2  s. c  o m
        Jacksonizer.of().toJson(new MyNastyClass());
        Assert.fail();
    } catch (IllegalArgumentException ex) {

    }

    try {
        Jacksonizer.of().fromJson("garbage", MyNastyClass.class);
        Assert.fail();
    } catch (IllegalArgumentException ex) {

    }

}

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

/**
 * A stopword filter annotator, that removes Grams from the blackboard
 * that start with forbidden words./*from   ww w  .java 2 s  .c o  m*/
 */
public StopwordSimpleFilterAnnotator() {
    stopwordsPath = new HashMap<>();
    stopwords = new HashSet<>();

    stopwordsPath.put(Locale.ENGLISH,
            getClass().getClassLoader().getResource("ailab/stopwords/generic.txt").getFile());
    stopwordsPath.put(Locale.ITALIAN,
            getClass().getClassLoader().getResource("ailab/stopwords/generic.txt").getFile());
}