List of usage examples for com.liferay.portal.kernel.util LocaleUtil JAPAN
Locale JAPAN
To view the source code for com.liferay.portal.kernel.util LocaleUtil JAPAN.
Click Source Link
From source file:com.liferay.calendar.search.test.CalendarBookingIndexerLocalizedContentTest.java
License:Open Source License
@Test public void testJapaneseTitle() throws Exception { String originalName = "entity name"; String japaneseName = "??"; String description = StringUtil.toLowerCase(RandomTestUtil.randomString()); addCalendarBooking(new LocalizedValuesMap() { {//from ww w. j av a 2 s.c o m put(LocaleUtil.US, originalName); put(LocaleUtil.JAPAN, japaneseName); } }, new LocalizedValuesMap() { { put(LocaleUtil.US, originalName); put(LocaleUtil.JAPAN, japaneseName); } }, new LocalizedValuesMap() { { put(LocaleUtil.US, description); put(LocaleUtil.JAPAN, description); } }); Map<String, String> titleMap = new HashMap<String, String>() { { put("title_en_US", originalName); put("title_ja_JP", japaneseName); } }; String word1 = "?"; String word2 = "?"; String prefix1 = ""; String prefix2 = ""; Stream<String> stream = Stream.of(word1, word2, prefix1, prefix2); stream.forEach(keywords -> assertFieldValues("title", LocaleUtil.JAPAN, titleMap, keywords)); }
From source file:com.liferay.calendar.search.test.CalendarBookingIndexerLocalizedContentTest.java
License:Open Source License
@Test public void testJapaneseTitleFullWordOnly() throws Exception { String full = "??"; String partial1 = ""; String partial2 = "?"; Stream<String> titlesStream = Stream.of(full, partial1, partial2); String description = StringUtil.toLowerCase(RandomTestUtil.randomString()); titlesStream.forEach(title -> {//from w w w . j av a 2s .c o m addCalendarBooking(new LocalizedValuesMap() { { put(LocaleUtil.JAPAN, title); } }, new LocalizedValuesMap() { { put(LocaleUtil.US, description); put(LocaleUtil.HUNGARY, description); } }, new LocalizedValuesMap() { { put(LocaleUtil.US, description); put(LocaleUtil.HUNGARY, description); } }); }); Map<String, String> titleMap = new HashMap<String, String>() { { put("title_ja_JP", "??"); } }; String word1 = "?"; String word2 = "?"; Stream<String> keywordsStream = Stream.of(word1, word2); keywordsStream.forEach(keywords -> assertFieldValues("title", LocaleUtil.JAPAN, titleMap, keywords)); }
From source file:com.liferay.calendar.search.test.CalendarBookingIndexerTest.java
License:Open Source License
@Test public void testJapaneseTitle() throws Exception { setUpSearchContext(_group, TestPropsValues.getUser()); String title = "??"; addCalendarBooking(new LocalizedValuesMap() { {//ww w .jav a 2 s . c o m put(LocaleUtil.JAPAN, title); } }); String word1 = "?"; String word2 = "?"; String prefix1 = ""; String prefix2 = ""; Stream<String> searchTerms = Stream.of(word1, word2, prefix1, prefix2); searchTerms.forEach(searchTerm -> { assertSearchHitsLength(searchTerm, 1, LocaleUtil.JAPAN); }); }
From source file:com.liferay.calendar.search.test.CalendarBookingIndexerTest.java
License:Open Source License
@Test public void testJapaneseTitleFullWordOnly() throws Exception { setUpSearchContext(_group, TestPropsValues.getUser()); String full = "??"; String partial1 = ""; String partial2 = "?"; Stream<String> titles = Stream.of(full, partial1, partial2); titles.forEach(title -> {//from ww w. ja va2 s . c o m addCalendarBooking(new LocalizedValuesMap() { { put(LocaleUtil.JAPAN, title); } }); }); String word1 = "?"; String word2 = "?"; Stream<String> searchTerms = Stream.of(word1, word2); searchTerms.forEach(searchTerm -> { assertSearchHitsLength(searchTerm, 1, LocaleUtil.JAPAN); }); }
From source file:com.liferay.calendar.search.test.CalendarIndexerLocalizedContentTest.java
License:Open Source License
@Test public void testJapaneseName() throws Exception { String originalName = "entity name"; String japaneseName = "??"; String description = StringUtil.toLowerCase(RandomTestUtil.randomString()); addCalendar(new LocalizedValuesMap() { {//from www . j ava 2 s . c o m put(LocaleUtil.US, originalName); put(LocaleUtil.JAPAN, japaneseName); } }, new LocalizedValuesMap() { { put(LocaleUtil.US, description); put(LocaleUtil.JAPAN, description); } }); Map<String, String> nameMap = new HashMap<String, String>() { { put("name", originalName); put("name_en_US", originalName); put("name_ja_JP", japaneseName); } }; Map<String, String> descriptionMap = new HashMap<String, String>() { { put("description", description); put("description_en_US", description); put("description_ja_JP", description); } }; String word1 = "?"; String word2 = "?"; String prefix1 = ""; String prefix2 = ""; Stream<String> stream = Stream.of(word1, word2, prefix1, prefix2); stream.forEach(keywords -> { Document document = calendarSearchFixture.searchOnlyOne(keywords, LocaleUtil.JAPAN); FieldValuesAssert.assertFieldValues(nameMap, "name", document, keywords); FieldValuesAssert.assertFieldValues(descriptionMap, "description", document, keywords); }); }
From source file:com.liferay.calendar.search.test.CalendarIndexerLocalizedContentTest.java
License:Open Source License
@Test public void testJapaneseNameFullWordOnly() throws Exception { String full = "??"; String partial1 = ""; String partial2 = "?"; Stream<String> namesStream = Stream.of(full, partial1, partial2); String originalName = StringUtil.toLowerCase(RandomTestUtil.randomString()); String description = StringUtil.toLowerCase(RandomTestUtil.randomString()); namesStream.forEach(name -> {/*from w ww .ja v a 2s . c om*/ addCalendar(new LocalizedValuesMap() { { put(LocaleUtil.US, originalName); put(LocaleUtil.JAPAN, name); } }, new LocalizedValuesMap() { { put(LocaleUtil.US, description); put(LocaleUtil.JAPAN, description); } }); }); Map<String, String> nameMap = new HashMap<String, String>() { { put("name", originalName); put("name_en_US", originalName); put("name_ja_JP", full); } }; String word1 = "?"; String word2 = "?"; Stream<String> keywordsStream = Stream.of(word1, word2); keywordsStream.forEach(keywords -> { Document document = calendarSearchFixture.searchOnlyOne(keywords, LocaleUtil.JAPAN); FieldValuesAssert.assertFieldValues(nameMap, "name", document, keywords); }); }
From source file:com.liferay.document.library.search.test.DLFileEntryIndexerLocalizedContentTest.java
License:Open Source License
@Test public void testJapaneseContent() throws Exception { GroupTestUtil.updateDisplaySettings(_group.getGroupId(), null, LocaleUtil.JAPAN); addFileEntry("content_search.txt"); List<String> contentStrings = new ArrayList<>(Collections.singletonList("content_ja_JP")); String word1 = "?"; String word2 = "?"; String prefix1 = ""; String prefix2 = ""; Stream<String> searchTerms = Stream.of(word1, word2, prefix1, prefix2); searchTerms.forEach(searchTerm -> { Document document = _search(searchTerm, LocaleUtil.JAPAN); assertLocalization(contentStrings, document); });// w w w . j ava 2 s . com }
From source file:com.liferay.document.library.search.test.DLFileEntryIndexerLocalizedContentTest.java
License:Open Source License
@Test public void testJapaneseContentFullWordOnly() throws Exception { GroupTestUtil.updateDisplaySettings(_group.getGroupId(), null, LocaleUtil.JAPAN); addFileEntry("japanese_1.txt"); addFileEntry("japanese_2.txt"); addFileEntry("japanese_3.txt"); List<String> contentStrings = new ArrayList<>(Collections.singletonList("content_ja_JP")); String word1 = "?"; String word2 = "?"; Stream<String> searchTerms = Stream.of(word1, word2); searchTerms.forEach(searchTerm -> { Document document = _search(searchTerm, LocaleUtil.JAPAN); assertLocalization(contentStrings, document); });/*from w w w .j a v a 2s . c om*/ }
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 {//w ww .ja v a 2s. co 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.internal.util.DDMIndexerImplTest.java
License:Open Source License
@Test public void testFormWithOneAvailableLocaleSameAsDefaultLocale() { Locale defaultLocale = LocaleUtil.JAPAN; Locale translationLocale = LocaleUtil.JAPAN; Set<Locale> availableLocales = Collections.singleton(defaultLocale); DDMForm ddmForm = DDMFormTestUtil.createDDMForm(availableLocales, defaultLocale); String fieldName = "text1"; String indexType = "text"; ddmForm.addDDMFormField(createDDMFormField(fieldName, indexType)); String fieldValue = "??"; DDMFormFieldValue ddmFormFieldValue = createDDMFormFieldValue(fieldName, translationLocale, fieldValue, defaultLocale);//from w ww .ja va 2 s .c o m Document document = createDocument(); DDMStructure ddmStructure = createDDMStructure(ddmForm); DDMFormValues ddmFormValues = createDDMFormValues(ddmForm, ddmFormFieldValue); ddmIndexer.addAttributes(document, ddmStructure, ddmFormValues); Map<String, String> map = _withSortableValues( Collections.singletonMap("ddm__text__NNNNN__text1_ja_JP", fieldValue)); FieldValuesAssert.assertFieldValues( _replaceKeys("NNNNN", String.valueOf(ddmStructure.getStructureId()), map), "ddm__text", document, fieldValue); }