private String getLocalization(String key, Locale locale) { if (_resourceBundle == null) { _resourceBundle = ResourceBundleUtil.getBundle( "content.Language", locale, JSONConfigurationHelperServiceImpl.class); } try { return _resourceBundle.getString(key); } catch (Exception e) { _log.error(e, e); } return key; }
/** * Get help text. * * @return String help test */ protected String getHelpText(ResourceRequest resourceRequest) { ResourceBundle resourceBundle = ResourceBundleUtil.getBundle( "content.Language", resourceRequest.getLocale(), GSearchPortlet.class); return LanguageUtil.get(resourceBundle, "helptext"); }
/** * Returns the Control Menu entry's label stored in the module's resource * bundle. * * @param locale the label's locale * @return the Control Menu entry's label */ @Override public String getLabel(Locale locale) { ResourceBundle resourceBundle = ResourceBundleUtil.getBundle( "content.Language", locale, getClass()); return LanguageUtil.get( resourceBundle, "blade-menu-entry-custom-message"); }
@Override public String getMessage(PortletRequest portletRequest) { ResourceBundle resourceBundle = ResourceBundleUtil.getBundle( "content.Language", getLocale(portletRequest), getClass()); return LanguageUtil.get(resourceBundle, "sample-link"); }
@Override public String getLabel(Locale locale) { ResourceBundle resourceBundle = ResourceBundleUtil.getBundle( "content.Language", locale, getClass()); return LanguageUtil.get(resourceBundle, "simulation-sample"); }
@Override public String getName(Locale locale) { ResourceBundle bundle = ResourceBundleUtil.getBundle(RES_BUNDLE, locale, this.getClass()); return this.language.get(bundle, LANGUAGE_KEY_TEMPLATE); }
@Override public String getName(Locale locale) { ResourceBundle bundle = ResourceBundleUtil.getBundle(LANGUAGE_BUNDLE, locale, this.getClass()); return this.language.get(bundle, LANGUAGE_KEY_TEMPLATE); }
/** * {@inheritDoc} */ @Override public JSONObject buildResults( PortletRequest portletRequest, PortletResponse portletResponse, QueryParams queryParams, SearchContext searchContext, Hits hits) { _hits = hits; _portletRequest = portletRequest; _portletResponse = portletResponse; _queryParams = queryParams; // See class comments _resourceBundle = ResourceBundleUtil.getBundle( "content.Language", _queryParams.getLocale(), ResultsBuilderImpl.class); JSONObject resultsObject = JSONFactoryUtil.createJSONObject(); long startTime = System.currentTimeMillis(); // Create items array resultsObject.put("items", createItemsArray()); // Create meta info array resultsObject.put("meta", createMetaObject()); // Paging object resultsObject.put("paging", createPagingObject()); // Create facets try { resultsObject.put("facets", createFacetsArray(searchContext)); } catch (Exception e) { _log.error(e, e); } if (_log.isDebugEnabled()) { _log.debug( "Results processing took: " + (System.currentTimeMillis() - startTime)); } return resultsObject; }
@Override public List<Menu> getPortletTitleMenus( PortletRequest portletRequest, PortletResponse portletResponse) { List<MenuItem> menuItems = new ArrayList<>(); URLMenuItem urlMenuItem = new URLMenuItem(); urlMenuItem.setLabel("Liferay"); urlMenuItem.setURL("http://www.liferay.com"); menuItems.add(urlMenuItem); List<Menu> menus = new ArrayList<>(); Menu menu = new Menu(); menu.setDirection("right"); menu.setExtended(false); menu.setIcon("sites"); menu.setMarkupView("lexicon"); menu.setMenuItems(menuItems); ResourceBundle resourceBundle = ResourceBundleUtil.getBundle( "content.Language", getLocale(portletRequest), getClass()); String message = LanguageUtil.get(resourceBundle, "list-of-links"); menu.setMessage(message); menu.setScroll(false); menu.setShowArrow(false); menu.setShowWhenSingleIcon(true); menus.add(menu); return menus; }