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.frontend.editor.ckeditor.web.editor.configuration.CKEditorConfigContributor.java
License:Open Source License
@Override public void populateConfigJSONObject(JSONObject jsonObject, Map<String, Object> inputEditorTaglibAttributes, ThemeDisplay themeDisplay, RequestBackedPortletURLFactory requestBackedPortletURLFactory) { super.populateConfigJSONObject(jsonObject, inputEditorTaglibAttributes, themeDisplay, requestBackedPortletURLFactory); jsonObject.put("autoParagraph", Boolean.FALSE); jsonObject.put("autoSaveTimeout", 3000); ColorScheme colorScheme = themeDisplay.getColorScheme(); String cssClasses = (String) inputEditorTaglibAttributes.get("liferay-ui:input-editor:cssClasses"); jsonObject.put("bodyClass", "html-editor " + HtmlUtil.escape(colorScheme.getCssClass()) + " " + HtmlUtil.escape(cssClasses)); jsonObject.put("closeNoticeTimeout", 8000); jsonObject.put("entities", Boolean.FALSE); String extraPlugins = "a11yhelpbtn,itemselector,lfrpopup,media"; boolean inlineEdit = GetterUtil .getBoolean((String) inputEditorTaglibAttributes.get("liferay-ui:input-editor:inlineEdit")); if (inlineEdit) { extraPlugins += ",ajaxsave,restore"; }/*from w ww. j a va 2s .co m*/ jsonObject.put("extraPlugins", extraPlugins); jsonObject.put("filebrowserWindowFeatures", "title=" + LanguageUtil.get(themeDisplay.getLocale(), "browse")); jsonObject.put("pasteFromWordRemoveFontStyles", Boolean.FALSE); jsonObject.put("pasteFromWordRemoveStyles", Boolean.FALSE); jsonObject.put("stylesSet", getStyleFormatsJSONArray(themeDisplay.getLocale())); jsonObject.put("toolbar_editInPlace", getToolbarEditInPlaceJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_email", getToolbarEmailJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_liferay", getToolbarLiferayJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_liferayArticle", getToolbarLiferayArticleJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_phone", getToolbarPhoneJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_simple", getToolbarSimpleJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_tablet", getToolbarTabletJSONArray(inputEditorTaglibAttributes)); }
From source file:com.liferay.frontend.editor.ckeditor.web.editor.configuration.CKEditorConfigContributor.java
License:Open Source License
protected JSONArray getStyleFormatsJSONArray(Locale locale) { JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); ResourceBundle resourceBundle = null; try {//from w ww .j a va 2 s. c om resourceBundle = _resourceBundleLoader.loadResourceBundle(LocaleUtil.toLanguageId(locale)); } catch (MissingResourceException mre) { resourceBundle = ResourceBundleUtil.EMPTY_RESOURCE_BUNDLE; } jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "normal"), "p", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "1"), "h1", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "2"), "h2", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "3"), "h3", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "4"), "h4", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "preformatted-text"), "pre", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "cited-work"), "cite", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "computer-code"), "code", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "info-message"), "div", "portlet-msg-info")); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "alert-message"), "div", "portlet-msg-alert")); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "error-message"), "div", "portlet-msg-error")); return jsonArray; }
From source file:com.liferay.frontend.editor.ckeditor.web.editor.configuration.CKEditorCreoleConfigContributor.java
License:Open Source License
@Override public void populateConfigJSONObject(JSONObject jsonObject, Map<String, Object> inputEditorTaglibAttributes, ThemeDisplay themeDisplay, RequestBackedPortletURLFactory requestBackedPortletURLFactory) { super.populateConfigJSONObject(jsonObject, inputEditorTaglibAttributes, themeDisplay, requestBackedPortletURLFactory); jsonObject.put("allowedContent", "b strong i hr h1 h2 h3 h4 h5 h6 em ul ol li pre table tr th; " + "img a[*]"); Map<String, String> fileBrowserParams = (Map<String, String>) inputEditorTaglibAttributes .get("liferay-ui:input-editor:fileBrowserParams"); if (fileBrowserParams != null) { String attachmentURLPrefix = fileBrowserParams.get("attachmentURLPrefix"); if (Validator.isNotNull(attachmentURLPrefix)) { jsonObject.put("attachmentURLPrefix", attachmentURLPrefix); }//ww w. j ava2s . c o m } jsonObject.put("decodeLinks", Boolean.TRUE); jsonObject.put("disableObjectResizing", Boolean.TRUE); jsonObject.put("extraPlugins", "a11yhelpbtn,creole,itemselector,lfrpopup,wikilink"); jsonObject.put("filebrowserWindowFeatures", "title=" + LanguageUtil.get(themeDisplay.getLocale(), "browse")); jsonObject.put("format_tags", "p;h1;h2;h3;h4;h5;h6;pre"); StringBundler sb = new StringBundler(); sb.append("bidi,colorbutton,colordialog,div,elementspath,flash,font,"); sb.append("forms,indentblock,justify,keystrokes,link,maximize,"); sb.append("newpage,pagebreak,preview,print,save,showblocks,smiley,"); sb.append("stylescombo,templates,video"); jsonObject.put("removePlugins", sb.toString()); jsonObject.put("toolbar_creole", getToolbarsCreoleJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_phone", getToolbarsPhoneJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_tablet", getToolbarsTabletJSONArray(inputEditorTaglibAttributes)); }
From source file:com.liferay.frontend.editor.ckeditor.web.internal.editor.configuration.CKEditorConfigContributor.java
License:Open Source License
@Override public void populateConfigJSONObject(JSONObject jsonObject, Map<String, Object> inputEditorTaglibAttributes, ThemeDisplay themeDisplay, RequestBackedPortletURLFactory requestBackedPortletURLFactory) { super.populateConfigJSONObject(jsonObject, inputEditorTaglibAttributes, themeDisplay, requestBackedPortletURLFactory); jsonObject.put("autoParagraph", Boolean.FALSE); jsonObject.put("autoSaveTimeout", 3000); ColorScheme colorScheme = themeDisplay.getColorScheme(); String cssClasses = (String) inputEditorTaglibAttributes.get("liferay-ui:input-editor:cssClasses"); jsonObject.put("bodyClass", StringBundler.concat("html-editor ", HtmlUtil.escape(colorScheme.getCssClass()), " ", HtmlUtil.escape(cssClasses))); jsonObject.put("closeNoticeTimeout", 8000); jsonObject.put("entities", Boolean.FALSE); String extraPlugins = "a11yhelpbtn,itemselector,lfrpopup,media"; boolean inlineEdit = GetterUtil .getBoolean((String) inputEditorTaglibAttributes.get("liferay-ui:input-editor:inlineEdit")); if (inlineEdit) { extraPlugins += ",ajaxsave,restore"; }/* w ww . j av a 2s . com*/ jsonObject.put("extraPlugins", extraPlugins); jsonObject.put("filebrowserWindowFeatures", "title=" + LanguageUtil.get(themeDisplay.getLocale(), "browse")); jsonObject.put("pasteFromWordRemoveFontStyles", Boolean.FALSE); jsonObject.put("pasteFromWordRemoveStyles", Boolean.FALSE); jsonObject.put("stylesSet", getStyleFormatsJSONArray(themeDisplay.getLocale())); jsonObject.put("toolbar_editInPlace", getToolbarEditInPlaceJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_email", getToolbarEmailJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_liferay", getToolbarLiferayJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_liferayArticle", getToolbarLiferayArticleJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_phone", getToolbarPhoneJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_simple", getToolbarSimpleJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_tablet", getToolbarTabletJSONArray(inputEditorTaglibAttributes)); }
From source file:com.liferay.frontend.editor.ckeditor.web.internal.editor.configuration.CKEditorConfigContributor.java
License:Open Source License
protected JSONArray getStyleFormatsJSONArray(Locale locale) { JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); ResourceBundle resourceBundle = null; try {/*ww w .j a v a 2 s . c om*/ resourceBundle = _resourceBundleLoader.loadResourceBundle(locale); } catch (MissingResourceException mre) { resourceBundle = ResourceBundleUtil.EMPTY_RESOURCE_BUNDLE; } jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "normal"), "p", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "1"), "h1", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "2"), "h2", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "3"), "h3", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "4"), "h4", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "preformatted-text"), "pre", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "cited-work"), "cite", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "computer-code"), "code", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "info-message"), "div", "portlet-msg-info")); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "alert-message"), "div", "portlet-msg-alert")); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "error-message"), "div", "portlet-msg-error")); return jsonArray; }
From source file:com.liferay.frontend.editor.ckeditor.web.internal.editor.configuration.CKEditorCreoleConfigContributor.java
License:Open Source License
@Override public void populateConfigJSONObject(JSONObject jsonObject, Map<String, Object> inputEditorTaglibAttributes, ThemeDisplay themeDisplay, RequestBackedPortletURLFactory requestBackedPortletURLFactory) { super.populateConfigJSONObject(jsonObject, inputEditorTaglibAttributes, themeDisplay, requestBackedPortletURLFactory); jsonObject.put("allowedContent", "b strong i hr h1 h2 h3 h4 h5 h6 em ul ol li pre table tr th; " + "img a[*]"); Map<String, String> fileBrowserParams = (Map<String, String>) inputEditorTaglibAttributes .get("liferay-ui:input-editor:fileBrowserParams"); if (fileBrowserParams != null) { String attachmentURLPrefix = fileBrowserParams.get("attachmentURLPrefix"); if (Validator.isNotNull(attachmentURLPrefix)) { jsonObject.put("attachmentURLPrefix", attachmentURLPrefix); }//from w w w .ja v a2 s . c o m } jsonObject.put("decodeLinks", Boolean.TRUE); jsonObject.put("disableObjectResizing", Boolean.TRUE); jsonObject.put("extraPlugins", "a11yhelpbtn,creole,itemselector,lfrpopup,wikilink"); jsonObject.put("filebrowserWindowFeatures", "title=" + LanguageUtil.get(themeDisplay.getLocale(), "browse")); jsonObject.put("format_tags", "p;h1;h2;h3;h4;h5;h6;pre"); StringBundler sb = new StringBundler(4); sb.append("bidi,colorbutton,colordialog,div,elementspath,flash,font,"); sb.append("forms,indentblock,justify,keystrokes,link,maximize,"); sb.append("newpage,pagebreak,preview,print,save,showblocks,smiley,"); sb.append("stylescombo,templates,video"); jsonObject.put("removePlugins", sb.toString()); jsonObject.put("toolbar_creole", getToolbarsCreoleJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_phone", getToolbarsPhoneJSONArray(inputEditorTaglibAttributes)); jsonObject.put("toolbar_tablet", getToolbarsTabletJSONArray(inputEditorTaglibAttributes)); }
From source file:com.liferay.frontend.editor.tinymce.web.editor.configuration.TinyMCEEditorConfigContributor.java
License:Open Source License
protected JSONArray getStyleFormatsJSONArray(Locale locale) { JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); ResourceBundle resourceBundle = _resourceBundleLoader.loadResourceBundle(LocaleUtil.toLanguageId(locale)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "normal"), "inline", "p", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "1"), "block", "h1", null));//from w ww . j a va 2 s .com jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "2"), "block", "h2", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "3"), "block", "h3", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "4"), "block", "h4", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "preformatted-text"), "block", "pre", null)); jsonArray.put( getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "cited-work"), "inline", "cite", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "computer-code"), "inline", "code", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "info-message"), "block", "div", "portlet-msg-info")); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "alert-message"), "block", "div", "portlet-msg-alert")); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "error-message"), "block", "div", "portlet-msg-error")); return jsonArray; }
From source file:com.liferay.frontend.editor.tinymce.web.internal.editor.configuration.TinyMCEEditorConfigContributor.java
License:Open Source License
protected JSONArray getStyleFormatsJSONArray(Locale locale) { JSONArray jsonArray = JSONFactoryUtil.createJSONArray(); ResourceBundle resourceBundle = _resourceBundleLoader.loadResourceBundle(locale); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "normal"), "inline", "p", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "1"), "block", "h1", null));/*w ww . j a v a 2 s. c om*/ jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "2"), "block", "h2", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "3"), "block", "h3", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.format(resourceBundle, "heading-x", "4"), "block", "h4", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "preformatted-text"), "block", "pre", null)); jsonArray.put( getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "cited-work"), "inline", "cite", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "computer-code"), "inline", "code", null)); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "info-message"), "block", "div", "portlet-msg-info")); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "alert-message"), "block", "div", "portlet-msg-alert")); jsonArray.put(getStyleFormatJSONObject(LanguageUtil.get(resourceBundle, "error-message"), "block", "div", "portlet-msg-error")); return jsonArray; }
From source file:com.liferay.image.editor.hook.action.ActionUtil.java
License:Open Source License
public static String getChangeLog(ActionRequest actionRequest) { ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY); return LanguageUtil.get(themeDisplay.getLocale(), "this-image-has-been-modified-using-web-image-editor"); }
From source file:com.liferay.item.selector.taglib.internal.util.ItemSelectorRepositoryEntryBrowserUtil.java
License:Open Source License
public static JSONObject getItemMetadataJSONObject(FileEntry fileEntry, Locale locale) throws PortalException { JSONObject itemMetadataJSONObject = JSONFactoryUtil.createJSONObject(); JSONArray groupsJSONArray = JSONFactoryUtil.createJSONArray(); JSONObject firstTabJSONObject = JSONFactoryUtil.createJSONObject(); JSONArray firstTabDataJSONArray = JSONFactoryUtil.createJSONArray(); FileVersion latestFileVersion = fileEntry.getLatestFileVersion(); firstTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "format"), HtmlUtil.escape(latestFileVersion.getExtension()))); firstTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "size"), TextFormatter.formatStorageSize(fileEntry.getSize(), locale))); firstTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "name"), HtmlUtil.escape(DLUtil.getTitleWithExtension(fileEntry)))); Date modifiedDate = fileEntry.getModifiedDate(); firstTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "modified"), LanguageUtil.format(locale, "x-ago-by-x", new Object[] { LanguageUtil.getTimeDescription(locale, System.currentTimeMillis() - modifiedDate.getTime(), true), HtmlUtil.escape(fileEntry.getUserName()) }))); firstTabJSONObject.put("data", firstTabDataJSONArray); firstTabJSONObject.put("title", LanguageUtil.get(locale, "file-info")); groupsJSONArray.put(firstTabJSONObject); JSONObject secondTabJSONObject = JSONFactoryUtil.createJSONObject(); JSONArray secondTabDataJSONArray = JSONFactoryUtil.createJSONArray(); secondTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "version"), HtmlUtil.escape(latestFileVersion.getVersion()))); secondTabDataJSONArray.put(_createJSONObject(LanguageUtil.get(locale, "status"), WorkflowConstants.getStatusLabel(latestFileVersion.getStatus()))); secondTabJSONObject.put("data", secondTabDataJSONArray); secondTabJSONObject.put("title", LanguageUtil.get(locale, "version")); groupsJSONArray.put(secondTabJSONObject); itemMetadataJSONObject.put("groups", groupsJSONArray); return itemMetadataJSONObject; }