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

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

Introduction

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

Prototype

Locale FRANCE

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

Click Source Link

Usage

From source file:com.liferay.asset.test.util.BaseAssetSearchTestCase.java

License:Open Source License

@Test
public void testOrderByTitleAsc() throws Exception {
    AssetEntryQuery assetEntryQuery = AssetEntryQueryTestUtil.createAssetEntryQuery(_group1.getGroupId(),
            new String[] { getBaseModelClassName() });

    String[] defaultTitles = { "open", "liferay", "content", "social", "osgi", "life" };

    String[] frenchTitles = { "ouvert", "liferay", "content", "social", "osgi", "vie" };

    List<Map<Locale, String>> titleMaps = new ArrayList<>();

    for (int i = 0; i < defaultTitles.length; i++) {
        Map<Locale, String> titleMap = new HashMap<>();

        titleMap.put(LocaleUtil.getDefault(), defaultTitles[i]);
        titleMap.put(LocaleUtil.FRANCE, frenchTitles[i]);

        titleMaps.add(titleMap);/*from www  .java  2  s.c o m*/
    }

    String[] defaultOrderedTitles = { "content", "life", "liferay", "open", "osgi", "social" };

    String[] frenchOrderedTitles = { "content", "liferay", "osgi", "ouvert", "social", "vie" };

    List<Map<Locale, String>> orderedTitleMaps = new ArrayList<>();

    for (int i = 0; i < defaultOrderedTitles.length; i++) {
        Map<Locale, String> titleMap = new HashMap<>();

        titleMap.put(LocaleUtil.getDefault(), defaultOrderedTitles[i]);

        String orderedTitle = frenchOrderedTitles[i];

        if (!isLocalizableTitle()) {
            orderedTitle = defaultOrderedTitles[i];
        }

        titleMap.put(LocaleUtil.FRANCE, orderedTitle);

        orderedTitleMaps.add(titleMap);
    }

    testOrderByTitle(assetEntryQuery, "asc", titleMaps, orderedTitleMaps,
            new Locale[] { LocaleUtil.getDefault(), LocaleUtil.FRANCE });
}

From source file:com.liferay.asset.test.util.BaseAssetSearchTestCase.java

License:Open Source License

@Test
public void testOrderByTitleDesc() throws Exception {
    AssetEntryQuery assetEntryQuery = AssetEntryQueryTestUtil.createAssetEntryQuery(_group1.getGroupId(),
            new String[] { getBaseModelClassName() });

    String[] defaultTitles = { "open", "liferay", "content", "social", "osgi", "life" };

    String[] frenchTitles = { "ouvert", "liferay", "content", "social", "osgi", "vie" };

    List<Map<Locale, String>> titleMaps = new ArrayList<>();

    for (int i = 0; i < defaultTitles.length; i++) {
        Map<Locale, String> titleMap = new HashMap<>();

        titleMap.put(LocaleUtil.getDefault(), defaultTitles[i]);
        titleMap.put(LocaleUtil.FRANCE, frenchTitles[i]);

        titleMaps.add(titleMap);/*from  www . j a v  a 2 s. c o m*/
    }

    String[] defaultOrderedTitles = { "social", "osgi", "open", "liferay", "life", "content" };

    String[] frenchOrderedTitles = { "vie", "social", "ouvert", "osgi", "liferay", "content" };

    List<Map<Locale, String>> orderedTitleMaps = new ArrayList<>();

    for (int i = 0; i < defaultOrderedTitles.length; i++) {
        Map<Locale, String> titleMap = new HashMap<>();

        titleMap.put(LocaleUtil.getDefault(), defaultOrderedTitles[i]);

        String orderedTitle = frenchOrderedTitles[i];

        if (!isLocalizableTitle()) {
            orderedTitle = defaultOrderedTitles[i];
        }

        titleMap.put(LocaleUtil.FRANCE, orderedTitle);

        orderedTitleMaps.add(titleMap);
    }

    testOrderByTitle(assetEntryQuery, "desc", titleMaps, orderedTitleMaps,
            new Locale[] { LocaleUtil.getDefault(), LocaleUtil.FRANCE });
}

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

License:Open Source License

@Test
public void testSomeFieldProperties() throws Exception {
    DDMForm ddmForm = createDDMForm();/* w w w. j  a  va  2  s . co m*/

    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));
}