List of usage examples for com.liferay.portal.kernel.language LanguageUtil get
public static String get(ResourceBundle resourceBundle, String key)
From source file:com.liferay.message.boards.web.internal.portlet.configuration.icon.PermissionsPortletConfigurationIcon.java
License:Open Source License
@Override public String getMessage(PortletRequest portletRequest) { return LanguageUtil.get(getResourceBundle(getLocale(portletRequest)), "home-category-permissions"); }
From source file:com.liferay.message.boards.web.internal.portlet.configuration.icon.ThreadLockPortletConfigurationIcon.java
License:Open Source License
@Override public String getMessage(PortletRequest portletRequest) { try {//from ww w .ja v a 2s . c o m MBMessage message = ActionUtil.getMessage(portletRequest); MBThread thread = message.getThread(); String key = "lock"; if (thread.isLocked()) { key = "unlock"; } return LanguageUtil.get(getResourceBundle(getLocale(portletRequest)), key); } catch (Exception e) { return null; } }
From source file:com.liferay.message.boards.web.internal.portlet.configuration.icon.ThreadSubscriptionPortletConfigurationIcon.java
License:Open Source License
@Override public String getMessage(PortletRequest portletRequest) { String key = "subscribe"; try {//from www . j a v a2 s .c om MBMessage message = ActionUtil.getMessage(portletRequest); if (_isSubscribed(portletRequest, message.getThreadId())) { key = "unsubscribe"; } } catch (Exception e) { } return LanguageUtil.get(getResourceBundle(getLocale(portletRequest)), key); }
From source file:com.liferay.mobile.device.rules.service.impl.MDRRuleGroupLocalServiceImpl.java
License:Open Source License
@Override public MDRRuleGroup copyRuleGroup(MDRRuleGroup ruleGroup, long groupId, ServiceContext serviceContext) throws PortalException { Group group = groupLocalService.getGroup(groupId); Map<Locale, String> nameMap = ruleGroup.getNameMap(); for (Map.Entry<Locale, String> entry : nameMap.entrySet()) { Locale locale = entry.getKey(); String name = entry.getValue(); if (Validator.isNull(name)) { continue; }/*from www .j ava 2 s.c o m*/ String postfix = LanguageUtil.get(locale, PropsValues.MOBILE_DEVICE_RULES_RULE_GROUP_COPY_POSTFIX); nameMap.put(locale, name.concat(StringPool.SPACE).concat(postfix)); } MDRRuleGroup newRuleGroup = addRuleGroup(group.getGroupId(), nameMap, ruleGroup.getDescriptionMap(), serviceContext); List<MDRRule> rules = mdrRulePersistence.findByRuleGroupId(ruleGroup.getRuleGroupId()); for (MDRRule rule : rules) { serviceContext.setUuid(PortalUUIDUtil.generate()); mdrRuleLocalService.copyRule(rule, newRuleGroup.getRuleGroupId(), serviceContext); } return newRuleGroup; }
From source file:com.liferay.mobile.device.rules.web.internal.form.navigator.LayoutMobileDeviceRulesFormNavigatorEntry.java
License:Open Source License
@Override public String getLabel(Locale locale) { ResourceBundle resourceBundle = ResourceBundleUtil.getBundle("content.Language", locale, getClass()); return LanguageUtil.get(resourceBundle, getKey()); }
From source file:com.liferay.modulesadmin.util.ModulesAdminUtil.java
License:Open Source License
public String displayImports(PageContext pageContext, Bundle bundle) { BundleWiring bundleWiring = getBundleWiring(bundle); List<BundleRequirement> bundleRequirements = bundleWiring.getRequirements(BundleRevision.PACKAGE_NAMESPACE); if (bundleRequirements.isEmpty()) { return StringPool.BLANK; }/*from w w w. j ava2s . c o m*/ StringBundler sb = new StringBundler(); for (BundleRequirement bundleRequirement : bundleRequirements) { Map<String, String> directives = bundleRequirement.getDirectives(); String resolution = directives.get("resolution"); if (resolution.equals("dynamic")) { continue; } String filter = directives.get("filter"); Matcher matcher = _pattern.matcher(filter); if (matcher.matches()) { String packageName = matcher.group(1); sb.append(packageName); } else { _log.error("Unable to parse " + filter); continue; } boolean satisfied = false; List<BundleWire> bundleWires = bundleWiring.getRequiredWires(BundleRevision.PACKAGE_NAMESPACE); for (BundleWire bundleWire : bundleWires) { BundleCapability bundleCapability = bundleWire.getCapability(); if (!bundleRequirement.matches(bundleCapability)) { continue; } satisfied = true; Map<String, Object> attributes = bundleCapability.getAttributes(); Version version = (Version) attributes.get("version"); sb.append(" {"); if (!version.equals(Version.emptyVersion)) { sb.append(version); sb.append(", "); } BundleWiring providerBundleWiring = bundleWire.getProviderWiring(); BundleRevision bundleRevision = providerBundleWiring.getRevision(); sb.append(bundleRevision.getSymbolicName()); sb.append("["); Bundle bundleRevisionBundle = bundleRevision.getBundle(); sb.append(bundleRevisionBundle.getBundleId()); sb.append("]}"); } HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); if (!satisfied) { sb.append(" <strong class=\"resolved\">"); sb.append(LanguageUtil.get(request, "un-resolved")); sb.append("</strong>"); } if (resolution.equals("optional")) { sb.append(" <strong class=\"resolution\">"); sb.append(LanguageUtil.get(request, resolution)); sb.append("</strong>"); } sb.append("<br />"); } sb.setIndex(sb.index() - 1); return sb.toString(); }
From source file:com.liferay.mysubscriptions.util.MySubscriptionsUtil.java
License:Open Source License
public static String getTitleText(Locale locale, String className, long classPK, String title) throws PortalException { if (Validator.isNotNull(title)) { return title; }//www.jav a2s . c o m Group group = GroupLocalServiceUtil.fetchGroup(classPK); if (className.equals(BlogsEntry.class.getName())) { title = "Blog at "; } else if (className.equals(BookmarksFolder.class.getName())) { if (group != null) { return LanguageUtil.get(locale, "home"); } } else if (className.equals(DLFileEntryType.class.getName())) { if (group != null) { return LanguageUtil.get(locale, "basic-document"); } DLFileEntryType dlFileEntryType = DLFileEntryTypeLocalServiceUtil.getDLFileEntryType(classPK); return dlFileEntryType.getName(locale); } else if (className.equals(JournalFolder.class.getName())) { if (group != null) { return LanguageUtil.get(locale, "home"); } } else if (className.equals(_KNOWLEDGE_BASE_MODEL_CLASSNAME)) { title = "Knowledge Base Article at "; } else if (className.equals(Layout.class.getName())) { Layout layout = LayoutLocalServiceUtil.getLayout(classPK); return layout.getName(locale); } else if (className.equals(MBCategory.class.getName())) { title = "Message Board at "; } else if (className.equals(PortletPreferences.class.getName())) { PortletPreferences portletPreferences = PortletPreferencesLocalServiceUtil .getPortletPreferences(classPK); Layout layout = LayoutLocalServiceUtil.getLayout(portletPreferences.getPlid()); javax.portlet.PortletPreferences jxPortletPreferences = PortletPreferencesFactoryUtil .getPortletSetup(layout, portletPreferences.getPortletId(), null); String portletTitle = jxPortletPreferences .getValue("portletSetupTitle_" + LocaleUtil.toLanguageId(locale), StringPool.BLANK); if (Validator.isNull(portletTitle)) { portletTitle = "Asset Publisher"; } return portletTitle; } else if (className.equals(WikiNode.class.getName())) { WikiNode wikiNode = WikiNodeLocalServiceUtil.getWikiNode(classPK); return wikiNode.getName(); } else if (className.equals(Folder.class.getName())) { if (group != null) { return LanguageUtil.get(locale, "home"); } } if (group != null) { title += group.getDescriptiveName(locale); } if (Validator.isNull(title)) { title = String.valueOf(classPK); } return title; }
From source file:com.liferay.notifications.notifications.portlet.NotificationsPortlet.java
License:Open Source License
protected static String getMarkAsReadLI(ThemeDisplay themeDisplay) { StringBundler sb = new StringBundler(5); sb.append("<li><a class=\"taglib-icon mark-as-read\" "); sb.append("href=\"javascript:;\"><i class=\"icon-remove\"></i><span "); sb.append("class=\"taglib-text-icon\">"); sb.append(LanguageUtil.get(themeDisplay.getLocale(), "mark-as-read")); sb.append("</span></a></li>"); return sb.toString(); }
From source file:com.liferay.notifications.notifications.portlet.NotificationsPortlet.java
License:Open Source License
protected static String getUnsubscribeLI(String unsubscribeURL, ThemeDisplay themeDisplay) { StringBundler sb = new StringBundler(8); sb.append("<li><a class=\"taglib-icon unsubscribe\" "); sb.append("data-unsubscribeURL=\""); sb.append(unsubscribeURL);// w w w. j a v a2s. co m sb.append("\" href=\"javascript:;\"><i class=\"icon-rss\"></i><span "); sb.append("class=\"taglib-text-icon\">"); sb.append(LanguageUtil.get(themeDisplay.getLocale(), "unsubscribe")); sb.append("</span><div class=\"unsubscribe-info\">"); sb.append(LanguageUtil.get(themeDisplay.getLocale(), "stop-receiving-notifications-from-this-asset")); sb.append("</div></a></li>"); return sb.toString(); }
From source file:com.liferay.notifications.web.internal.portlet.configuration.icon.DeliveryPortletConfigurationIcon.java
License:Open Source License
@Override public String getMessage(PortletRequest portletRequest) { return LanguageUtil.get(getResourceBundle(getLocale(portletRequest)), "configuration"); }