List of usage examples for com.liferay.portal.kernel.util LocaleUtil SPAIN
Locale SPAIN
To view the source code for com.liferay.portal.kernel.util LocaleUtil SPAIN.
Click Source Link
From source file:com.liferay.asset.service.test.AssetVocabularyServiceTest.java
License:Open Source License
@Test public void testLocalizedSiteAddDefaultVocabulary() throws Exception { LocaleThreadLocal.setSiteDefaultLocale(LocaleUtil.SPAIN); AssetVocabulary vocabulary = AssetVocabularyLocalServiceUtil.addDefaultVocabulary(_group.getGroupId()); Assert.assertEquals(PropsValues.ASSET_VOCABULARY_DEFAULT, vocabulary.getTitle(LocaleUtil.US, true)); }
From source file:com.liferay.asset.service.test.AssetVocabularyServiceTest.java
License:Open Source License
@Test public void testLocalizedSiteAddLocalizedVocabulary() throws Exception { LocaleThreadLocal.setSiteDefaultLocale(LocaleUtil.SPAIN); String title = RandomTestUtil.randomString(); Map<Locale, String> titleMap = new HashMap<>(); titleMap.put(LocaleUtil.US, title + "_US"); titleMap.put(LocaleUtil.SPAIN, title + "_ES"); String description = RandomTestUtil.randomString(); Map<Locale, String> descriptionMap = new HashMap<>(); descriptionMap.put(LocaleUtil.SPAIN, description + "_ES"); descriptionMap.put(LocaleUtil.US, description + "_US"); ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId()); AssetVocabulary vocabulary = AssetVocabularyLocalServiceUtil.addVocabulary(TestPropsValues.getUserId(), _group.getGroupId(), StringPool.BLANK, titleMap, descriptionMap, StringPool.BLANK, serviceContext); Assert.assertEquals(titleMap.get(LocaleUtil.SPAIN), vocabulary.getName()); Assert.assertEquals(titleMap.get(LocaleUtil.SPAIN), vocabulary.getTitle(LocaleUtil.GERMANY, true)); Assert.assertEquals(titleMap.get(LocaleUtil.SPAIN), vocabulary.getTitle(LocaleUtil.SPAIN, true)); Assert.assertEquals(titleMap.get(LocaleUtil.US), vocabulary.getTitle(LocaleUtil.US, true)); Assert.assertEquals(descriptionMap.get(LocaleUtil.SPAIN), vocabulary.getDescription(LocaleUtil.GERMANY, true)); Assert.assertEquals(descriptionMap.get(LocaleUtil.SPAIN), vocabulary.getDescription(LocaleUtil.SPAIN, true)); Assert.assertEquals(descriptionMap.get(LocaleUtil.US), vocabulary.getDescription(LocaleUtil.US, true)); }
From source file:com.liferay.asset.service.test.AssetVocabularyServiceTest.java
License:Open Source License
@Test public void testLocalizedSiteAddVocabulary() throws Exception { LocaleThreadLocal.setSiteDefaultLocale(LocaleUtil.SPAIN); String title = RandomTestUtil.randomString(); ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(_group.getGroupId()); AssetVocabulary vocabulary = AssetVocabularyLocalServiceUtil.addVocabulary(TestPropsValues.getUserId(), serviceContext.getScopeGroupId(), title, serviceContext); Assert.assertEquals(title, vocabulary.getTitle(LocaleUtil.US, true)); Assert.assertEquals(title, vocabulary.getName()); }
From source file:com.liferay.calendar.service.test.CalendarBookingLocalServiceTest.java
License:Open Source License
@Test public void testUpdateCalendarBookingPreservesDescriptionTranslations() throws Exception { ServiceContext serviceContext = createServiceContext(); Calendar calendar = CalendarTestUtil.addCalendar(_user, serviceContext); Map<Locale, String> oldDescriptionMap = new HashMap<>(); oldDescriptionMap.put(LocaleUtil.BRAZIL, RandomTestUtil.randomString()); oldDescriptionMap.put(LocaleUtil.GERMANY, RandomTestUtil.randomString()); oldDescriptionMap.put(LocaleUtil.SPAIN, RandomTestUtil.randomString()); oldDescriptionMap.put(LocaleUtil.US, RandomTestUtil.randomString()); long startTime = System.currentTimeMillis(); CalendarBooking calendarBooking = CalendarBookingTestUtil.addRegularCalendarBookingWithTitleAndDescription( _user, calendar, RandomTestUtil.randomLocaleStringMap(), oldDescriptionMap, startTime, startTime + (Time.HOUR * 10), serviceContext); Map<Locale, String> newDescriptionMap = new HashMap<>(); newDescriptionMap.put(LocaleUtil.GERMANY, ""); newDescriptionMap.put(LocaleUtil.SPAIN, RandomTestUtil.randomString()); newDescriptionMap.put(LocaleUtil.US, oldDescriptionMap.get(LocaleUtil.US)); calendarBooking = CalendarBookingLocalServiceUtil.updateCalendarBooking(_user.getUserId(), calendarBooking.getCalendarBookingId(), calendar.getCalendarId(), new long[0], RandomTestUtil.randomLocaleStringMap(), newDescriptionMap, RandomTestUtil.randomString(), startTime, startTime + (Time.HOUR * 10), false, null, 0, null, 0, null, serviceContext); calendarBooking = CalendarBookingLocalServiceUtil .fetchCalendarBooking(calendarBooking.getCalendarBookingId()); Assert.assertEquals(oldDescriptionMap.get(LocaleUtil.BRAZIL), calendarBooking.getDescription(LocaleUtil.BRAZIL)); Assert.assertEquals(newDescriptionMap.get(LocaleUtil.SPAIN), calendarBooking.getDescription(LocaleUtil.SPAIN)); Assert.assertEquals(newDescriptionMap.get(LocaleUtil.US), calendarBooking.getDescription(LocaleUtil.US)); Map<Locale, String> descriptionMap = calendarBooking.getDescriptionMap(); Assert.assertFalse(descriptionMap.containsKey(LocaleUtil.GERMANY)); }
From source file:com.liferay.calendar.service.test.CalendarBookingLocalServiceTest.java
License:Open Source License
@Test public void testUpdateCalendarBookingPreservesTitleTranslations() throws Exception { ServiceContext serviceContext = createServiceContext(); Calendar calendar = CalendarTestUtil.addCalendar(_user, serviceContext); Map<Locale, String> oldTitleMap = new HashMap<>(); oldTitleMap.put(LocaleUtil.BRAZIL, RandomTestUtil.randomString()); oldTitleMap.put(LocaleUtil.GERMANY, RandomTestUtil.randomString()); oldTitleMap.put(LocaleUtil.SPAIN, RandomTestUtil.randomString()); oldTitleMap.put(LocaleUtil.US, RandomTestUtil.randomString()); long startTime = System.currentTimeMillis(); CalendarBooking calendarBooking = CalendarBookingTestUtil.addRegularCalendarBookingWithTitleAndDescription( _user, calendar, oldTitleMap, RandomTestUtil.randomLocaleStringMap(), startTime, startTime + (Time.HOUR * 10), serviceContext); Map<Locale, String> newTitleMap = new HashMap<>(); newTitleMap.put(LocaleUtil.GERMANY, ""); newTitleMap.put(LocaleUtil.SPAIN, RandomTestUtil.randomString()); newTitleMap.put(LocaleUtil.US, oldTitleMap.get(LocaleUtil.US)); calendarBooking = CalendarBookingLocalServiceUtil.updateCalendarBooking(_user.getUserId(), calendarBooking.getCalendarBookingId(), calendar.getCalendarId(), new long[0], newTitleMap, RandomTestUtil.randomLocaleStringMap(), RandomTestUtil.randomString(), startTime, startTime + (Time.HOUR * 10), false, null, 0, null, 0, null, serviceContext); calendarBooking = CalendarBookingLocalServiceUtil .fetchCalendarBooking(calendarBooking.getCalendarBookingId()); Assert.assertEquals(oldTitleMap.get(LocaleUtil.BRAZIL), calendarBooking.getTitle(LocaleUtil.BRAZIL)); Assert.assertEquals(newTitleMap.get(LocaleUtil.SPAIN), calendarBooking.getTitle(LocaleUtil.SPAIN)); Assert.assertEquals(oldTitleMap.get(LocaleUtil.US), calendarBooking.getTitle(LocaleUtil.US)); Map<Locale, String> titleMap = calendarBooking.getTitleMap(); Assert.assertFalse(titleMap.containsKey(LocaleUtil.GERMANY)); }
From source file:com.liferay.content.targeting.service.test.lar.BasePortletExportImportTestCase.java
License:Open Source License
@Test public void testExportImportInvalidAvailableLocales() throws Exception { testExportImportAvailableLocales(new Locale[] { LocaleUtil.US, LocaleUtil.SPAIN }, new Locale[] { LocaleUtil.US, LocaleUtil.GERMANY }, true); }
From source file:com.liferay.content.targeting.service.test.lar.BasePortletExportImportTestCase.java
License:Open Source License
@Test public void testExportImportValidAvailableLocales() throws Exception { testExportImportAvailableLocales(new Locale[] { LocaleUtil.US, LocaleUtil.SPAIN }, new Locale[] { LocaleUtil.US, LocaleUtil.SPAIN, LocaleUtil.GERMANY }, false); }
From source file:com.liferay.document.library.service.test.DLFileEntryTypeServiceTest.java
License:Open Source License
@Test public void testLocalizedSiteAddFileEntryType() throws Exception { Group group = GroupTestUtil.addGroup(); ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(group.getGroupId()); Locale locale = LocaleThreadLocal.getSiteDefaultLocale(); try {//from w w w . ja v a2 s .c o m LocaleThreadLocal.setSiteDefaultLocale(LocaleUtil.SPAIN); String name = RandomTestUtil.randomString(); String description = RandomTestUtil.randomString(); DDMStructure ddmStructure = DDMStructureTestUtil.addStructure(DLFileEntryMetadata.class.getName(), new Locale[] { LocaleUtil.SPAIN }, LocaleUtil.SPAIN); DLFileEntryType dlFileEntryType = DLFileEntryTypeLocalServiceUtil.addFileEntryType( TestPropsValues.getUserId(), group.getGroupId(), name, description, new long[] { ddmStructure.getStructureId() }, serviceContext); Assert.assertEquals(name, dlFileEntryType.getName(LocaleUtil.US, true)); Assert.assertEquals(description, dlFileEntryType.getDescription(LocaleUtil.US, true)); } finally { LocaleThreadLocal.setSiteDefaultLocale(locale); } }
From source file:com.liferay.document.library.service.test.DLFileEntryTypeServiceTest.java
License:Open Source License
@Test public void testLocalizedSiteUpdateFileEntryType() throws Exception { Group group = GroupTestUtil.addGroup(); ServiceContext serviceContext = ServiceContextTestUtil.getServiceContext(group.getGroupId()); Locale locale = LocaleThreadLocal.getSiteDefaultLocale(); try {//from w ww.j a v a2s.co m LocaleThreadLocal.setSiteDefaultLocale(LocaleUtil.SPAIN); String name = RandomTestUtil.randomString(); String description = RandomTestUtil.randomString(); DDMStructure ddmStructure = DDMStructureTestUtil.addStructure(DLFileEntryMetadata.class.getName(), new Locale[] { LocaleUtil.SPAIN }, LocaleUtil.SPAIN); DLFileEntryType dlFileEntryType = DLFileEntryTypeLocalServiceUtil.addFileEntryType( TestPropsValues.getUserId(), group.getGroupId(), name, description, new long[] { ddmStructure.getStructureId() }, serviceContext); name = RandomTestUtil.randomString(); description = RandomTestUtil.randomString(); DLFileEntryTypeLocalServiceUtil.updateFileEntryType(TestPropsValues.getUserId(), dlFileEntryType.getFileEntryTypeId(), name, description, new long[] { ddmStructure.getStructureId() }, serviceContext); dlFileEntryType = DLFileEntryTypeLocalServiceUtil .getFileEntryType(dlFileEntryType.getFileEntryTypeId()); Assert.assertEquals(name, dlFileEntryType.getName(LocaleUtil.US, true)); Assert.assertEquals(description, dlFileEntryType.getDescription(LocaleUtil.US, true)); } finally { LocaleThreadLocal.setSiteDefaultLocale(locale); } }
From source file:com.liferay.dynamic.data.mapping.BaseDDMTestCase.java
License:Open Source License
protected void setUpLanguageUtil() { Set<Locale> availableLocales = SetUtil .fromArray(new Locale[] { LocaleUtil.BRAZIL, LocaleUtil.SPAIN, LocaleUtil.US }); whenLanguageGetAvailableLocalesThen(availableLocales); whenLanguageGet(LocaleUtil.BRAZIL, "no", "No"); whenLanguageGet(LocaleUtil.BRAZIL, "yes", "Sim"); whenLanguageGet(LocaleUtil.SPAIN, "latitude", "Latitud"); whenLanguageGet(LocaleUtil.SPAIN, "longitude", "Longitud"); whenLanguageGet(LocaleUtil.US, "latitude", "Latitude"); whenLanguageGet(LocaleUtil.US, "longitude", "Longitude"); whenLanguageGet(LocaleUtil.US, "no", "No"); whenLanguageGet(LocaleUtil.US, "yes", "Yes"); whenLanguageGetLanguageId(LocaleUtil.BRAZIL, "pt_BR"); whenLanguageGetLanguageId(LocaleUtil.SPAIN, "es_ES"); whenLanguageGetLanguageId(LocaleUtil.US, "en_US"); whenLanguageIsAvailableLocale("en_US"); whenLanguageIsAvailableLocale("es_ES"); whenLanguageIsAvailableLocale("pt_BR"); whenLanguageIsAvailableLocale(LocaleUtil.BRAZIL); whenLanguageIsAvailableLocale(LocaleUtil.SPAIN); whenLanguageIsAvailableLocale(LocaleUtil.US); LanguageUtil languageUtil = new LanguageUtil(); languageUtil.setLanguage(language);/*from w w w . jav a 2s. c om*/ }