Example usage for com.liferay.portal.kernel.util LocaleUtil ENGLISH

List of usage examples for com.liferay.portal.kernel.util LocaleUtil ENGLISH

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util LocaleUtil ENGLISH.

Prototype

Locale ENGLISH

To view the source code for com.liferay.portal.kernel.util LocaleUtil ENGLISH.

Click Source Link

Usage

From source file:com.liferay.document.library.search.test.DLFileEntryIndexerLocalizedContentTest.java

License:Open Source License

@Test
public void testSiteLocale() throws Exception {
    Group testGroup = GroupTestUtil.addGroup();

    List<String> japaneseContentStrings = new ArrayList<>(Collections.singletonList("content_ja_JP"));
    List<String> englishContentStrings = new ArrayList<>(Collections.singletonList("content_en_US"));

    try {/*from  www.  j  av a 2  s  . c  o  m*/
        GroupTestUtil.updateDisplaySettings(_group.getGroupId(), null, LocaleUtil.JAPAN);
        GroupTestUtil.updateDisplaySettings(testGroup.getGroupId(), null, LocaleUtil.US);

        addFileEntry("locale_ja.txt", _group.getGroupId());
        addFileEntry("locale_en.txt", testGroup.getGroupId());

        Document japenseDocument = _search("?", LocaleUtil.JAPAN, _group.getGroupId());

        assertLocalization(japaneseContentStrings, japenseDocument);

        Document englishDocument = _search("Locale Test", LocaleUtil.ENGLISH, testGroup.getGroupId());

        assertLocalization(englishContentStrings, englishDocument);
    } finally {
        GroupLocalServiceUtil.deleteGroup(testGroup);
    }
}

From source file:com.liferay.dynamic.data.mapping.util.DDMFormDeepCopyTest.java

License:Open Source License

@Test
public void testSomeFieldProperties() throws Exception {
    DDMForm ddmForm = createDDMForm();//from   w ww.  ja va 2  s.  com

    DDMFormField nameDDMFormField = new DDMFormField("Name", "textarea");

    ddmForm.addDDMFormField(nameDDMFormField);

    nameDDMFormField.setFieldNamespace("namespace");
    nameDDMFormField.setIndexType("indexType");

    LocalizedValue label = new LocalizedValue(LocaleUtil.BRAZIL);

    label.addString(LocaleUtil.BRAZIL, "teste");

    nameDDMFormField.setLabel(label);

    nameDDMFormField.setLocalizable(true);
    nameDDMFormField.setMultiple(true);
    nameDDMFormField.setReadOnly(true);
    nameDDMFormField.setRepeatable(true);
    nameDDMFormField.setRequired(true);
    nameDDMFormField.setShowLabel(true);

    LocalizedValue style = new LocalizedValue(LocaleUtil.ENGLISH);

    style.addString(LocaleUtil.ENGLISH, "style");

    nameDDMFormField.setStyle(style);

    LocalizedValue tip = new LocalizedValue(LocaleUtil.FRANCE);

    tip.addString(LocaleUtil.FRANCE, "tip");

    nameDDMFormField.setTip(tip);

    nameDDMFormField.setVisibilityExpression("expression");

    DDMFormFieldOptions ddmFormFieldOptions = new DDMFormFieldOptions();

    ddmFormFieldOptions.setDefaultLocale(LocaleUtil.BRAZIL);

    ddmFormFieldOptions.addOptionLabel("teste", LocaleUtil.ENGLISH, "label");

    nameDDMFormField.setDDMFormFieldOptions(ddmFormFieldOptions);

    DDMForm copyDDMForm = BeanPropertiesUtil.deepCopyProperties(ddmForm);

    DDMFormField copyDDMFormField = copyDDMForm.getDDMFormFields().get(0);

    Assert.assertEquals("Name", copyDDMFormField.getName());
    Assert.assertEquals("textarea", copyDDMFormField.getType());
    Assert.assertEquals("namespace", copyDDMFormField.getFieldNamespace());
    Assert.assertEquals("indexType", copyDDMFormField.getIndexType());

    LocalizedValue copyLabel = copyDDMFormField.getLabel();

    Assert.assertEquals(LocaleUtil.BRAZIL, copyLabel.getDefaultLocale());
    Assert.assertEquals("teste", copyLabel.getString(LocaleUtil.BRAZIL));

    Assert.assertTrue(copyDDMFormField.isLocalizable());
    Assert.assertTrue(copyDDMFormField.isMultiple());
    Assert.assertTrue(copyDDMFormField.isReadOnly());
    Assert.assertTrue(copyDDMFormField.isRepeatable());
    Assert.assertTrue(copyDDMFormField.isRequired());
    Assert.assertTrue(copyDDMFormField.isShowLabel());

    LocalizedValue copyStyle = copyDDMFormField.getStyle();

    Assert.assertEquals(LocaleUtil.ENGLISH, copyStyle.getDefaultLocale());
    Assert.assertEquals("style", copyStyle.getString(LocaleUtil.ENGLISH));

    LocalizedValue copyTip = copyDDMFormField.getTip();

    Assert.assertEquals(LocaleUtil.FRANCE, copyTip.getDefaultLocale());
    Assert.assertEquals("tip", copyTip.getString(LocaleUtil.FRANCE));

    Assert.assertEquals("expression", copyDDMFormField.getVisibilityExpression());

    DDMFormFieldOptions copyDDMFormFieldOptions = copyDDMFormField.getDDMFormFieldOptions();

    Assert.assertEquals(LocaleUtil.BRAZIL, copyDDMFormFieldOptions.getDefaultLocale());

    Map<String, LocalizedValue> copyOptions = copyDDMFormFieldOptions.getOptions();

    Assert.assertTrue(copyOptions.containsKey("teste"));

    LocalizedValue copyTesteOptionLabel = copyOptions.get("teste");

    Assert.assertEquals("label", copyTesteOptionLabel.getString(LocaleUtil.ENGLISH));
}