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:ar.com.zauber.commons.xmpp.message.XMPPMessageTest.java

/** multiples lenguajes */
@Test/*  w w  w.  j  av a2  s  . co  m*/
public final void testMultiLang() throws Exception {
    final XMPPMessage c = new XMPPMessage("body", "title");
    final Map<Locale, Resource> msgs = new HashMap<Locale, Resource>();
    msgs.put(new Locale("es"), new StringResource("hola!"));
    msgs.put(Locale.ITALIAN, new StringResource("pronto!"));
    c.setLangBodies(msgs);
    org.jivesoftware.smack.packet.Message m = c.getXMPPMessage("juan");
    m.setPacketID("0");
    Assert.assertEquals(getResult("multilang.xml"), m.toXML());
}

From source file:it.govpay.web.utils.Utils.java

public static Utils getInstance() {
    if (Utils.instance == null)
        init();
    return Utils.instance.get(Locale.ITALIAN.getLanguage());
}

From source file:it.govpay.web.utils.Utils.java

public static Utils getInstance(Locale locale) {
    if (Utils.instance == null)
        init();/*from www  .  ja  v  a2  s .  com*/

    if (locale == null)
        locale = Locale.ITALIAN;

    Utils utils = Utils.instance.get(locale.getLanguage());

    return utils != null ? utils : getInstance();
}

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

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

    testJsonConv(objectMapper, LOG, LocalizedString.of(Locale.FRENCH, "a"));

    String json = changeField(objectMapper, LOG, LocalizedString.of(Locale.ITALIAN, "a"), "string",
            NullNode.instance);//from w w w .j  av a  2 s .  c  om

    try {
        objectMapper.readValue(json, LocalizedString.class);
        Assert.fail("Should not accept null values!");
    } catch (Exception ex) {

    }

    try {
        objectMapper.readValue("{\"string\":\"a\"}", LocalizedString.class);
        Assert.fail("Should have failed because no locale field was provided!");
    } catch (Exception ex) {

    }

}

From source file:it.govpay.web.utils.Utils.java

public static Utils getInstance(String locale) {
    if (Utils.instance == null)
        init();/*from  ww w. ja v a2  s .co  m*/

    if (locale == null)
        locale = Locale.ITALIAN.getLanguage();

    Utils utils = Utils.instance.get(locale);

    return utils != null ? utils : getInstance();
}

From source file:ar.com.zauber.commons.xmpp.message.XMPPMessageTest.java

/** multiples lenguajes */
@Test/*from w  w  w .  jav  a2  s  .com*/
public final void testXHTML() throws Exception {
    final XMPPMessage c = new XMPPMessage("body", "title");
    final Map<Locale, Resource> msgs = new HashMap<Locale, Resource>();
    msgs.put(new Locale("es"), new StringResource("hola!"));
    msgs.put(Locale.ITALIAN, new StringResource("pronto!"));
    c.setLangBodies(msgs);
    c.setHtmlMessage(new StringResource("<body><strong>html!</strong></body>"));
    org.jivesoftware.smack.packet.Message m = c.getXMPPMessage("juan");
    m.setPacketID("0");

    // sin setear conection no deberia haber mensaje html 
    Assert.assertEquals(getResult("multilang.xml"), m.toXML());
}

From source file:it.govpay.web.utils.Utils.java

public Utils() {
    this.locale = Locale.ITALIAN;
}

From source file:eu.trentorise.opendata.semtext.jackson.test.SemTextModuleTest.java

@Test
public void testUnregisteredMetadata() throws IOException {

    Meaning m1 = Meaning.of("a", MeaningKind.ENTITY, 0.2, Dict.of(Locale.ITALIAN, "a"),
            Dict.of(Locale.FRENCH, "b"), ImmutableMap.of("testns", Dict.of("s")));
    try {/*from www. j  av  a 2s  .c  om*/
        OdtJacksonTester.testJsonConv(objectMapper, LOG, m1);
        Assert.fail("Should have complained about unregistered namespace!");
    } catch (Exception ex) {

    }
    try {
        SemTextModule.getMetadataTypeReference(Sentence.class, "a");
        Assert.fail();
    } catch (NotFoundException ex) {

    }
}

From source file:ar.com.zauber.commons.xmpp.message.XMPPMessageTest.java

/** todo lo anterior + form extensions! */
@Test/*from  w w w .j ava  2  s  .c o m*/
public final void testFormExtension() throws Exception {
    final XMPPMessage c = new XMPPMessage("body", "title");
    final Map<Locale, Resource> msgs = new HashMap<Locale, Resource>();
    msgs.put(new Locale("es"), new StringResource("hola!"));
    msgs.put(Locale.ITALIAN, new StringResource("pronto!"));
    c.setLangBodies(msgs);
    final Form form = new Form(Form.TYPE_FORM);
    form.setInstructions("instructions");
    form.setTitle("Observaciones");
    final FormField field = new FormField("date");
    field.setType(FormField.TYPE_HIDDEN);
    field.setDescription("fecha que se esta observando");
    field.addValue("2009-06-20");
    form.addField(field);
    c.setExtensions(Arrays.asList(new PacketExtension[] { form.getDataFormToSend() }));
    org.jivesoftware.smack.packet.Message m = c.getXMPPMessage("juan");
    m.setPacketID("0");
    // sin setear conection no deberia haber mensaje html 
    Assert.assertEquals(getResult("extension-form.xml"), m.toXML());
}

From source file:it.govpay.web.utils.Utils.java

private synchronized static void init() {
    if (Utils.instance == null) {
        List<Locale> listaLingueDisponibili = Utils.getListaLingueDisponibili();
        Utils.instance = new HashMap<String, Utils>();
        if (listaLingueDisponibili != null && listaLingueDisponibili.size() > 0) {
            for (int i = 0; i < listaLingueDisponibili.size(); i++) {
                Locale locale = listaLingueDisponibili.get(i);
                Utils.instance.put(locale.getLanguage(), new Utils(locale));
            }// www.  ja va 2 s . c om
        } else {
            // italiano sempre presente
            Utils.instance.put(Locale.ITALIAN.getLanguage(), new Utils(Locale.ITALIAN));
        }
    }
}