Skip to content

Commit

Permalink
LPS-46282 Use URL instead of Url to be consistent. Use style "P" to g…
Browse files Browse the repository at this point in the history
…enerate the language keys correctly. Improve performance of the _formatP method. Update language.properties.
  • Loading branch information
Preston-Crary authored and natecavanaugh committed Apr 25, 2014
1 parent fcb54e6 commit e6fa8fb
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ protected String[] getLanguageKeys(Matcher matcher) {
else if (groupCount == 2) {
String languageKey = matcher.group(2);

languageKey = TextFormatter.format(languageKey, TextFormatter.K);
languageKey = TextFormatter.format(languageKey, TextFormatter.P);

return new String[] {languageKey};
}
Expand Down
4 changes: 3 additions & 1 deletion portal-impl/src/content/Language.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3675,6 +3675,7 @@ navigation-style=Navigation Style
nested-children=Nested Children
net-event=Net Event
netvibes=Netvibes
netvibes-url=Netvibes URL
netvibes-widget-url=Netvibes Widget URL
never=Never
never-auto-expire=Never Auto Expire
Expand Down Expand Up @@ -6384,6 +6385,7 @@ twitter=Twitter
two-columns=Two Columns
type=Type
type-a-single-email-address=Type a single email address:
type-label=Type Label
type-name=Type name:
type-name-or-select-from-list=Type name or select from list:
types=Types
Expand Down Expand Up @@ -6760,11 +6762,11 @@ web-content-title=Web Content Title
web-content-translation=Web Content Translation
web-content-type=Web Content Type
web-content-updated-email=Web Content Updated Email
web-dav-url=WebDAV URL
web-id=Web ID
web-plugin=Web Plugin
web-plugins=Web Plugins
webdav-help=Files and folders can be managed directly from the file explorer of your desktop operating system. <a href="{0}" target="_blank">Read more.</a>
webdav-url=WebDAV URL
webdav-windows-help=Files and folders can be managed directly from the file explorer of your desktop operating system. Before accessing from Windows, please ensure you have installed the <a href="{0}" target="_blank">patch</a> from Microsoft. <a href="{1}" target="_blank">Read more.</a>
webservices=Web Services
webservices-acl-service=Web Services ACL Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class TextFormatter {

public static final int J = 9;

// formatId --> format-id
// formatId --> format-id, formatID --> format-i-d

public static final int K = 10;

Expand All @@ -83,7 +83,7 @@ public class TextFormatter {

public static final int O = 14;

// formatID --> format-id
// FormatID --> format-id

public static final int P = 15;

Expand Down Expand Up @@ -403,23 +403,23 @@ private static String _formatO(String s) {
}

private static String _formatP(String s) {
StringBuilder sb = new StringBuilder(StringUtil.toLowerCase(s));

for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
StringBuilder sb = new StringBuilder(s.length() + s.length() / 2);

if (Character.isUpperCase(c) && (i > 0) && ((i + 1) < s.length())) {
int delta = sb.length() - s.length();
for (int i = 0; i < s.length() - 1; i++) {
char c1 = s.charAt(i);
char c2 = s.charAt(i + 1);

if (Character.isLowerCase(s.charAt(i + 1))) {
sb.insert(i + delta, CharPool.DASH);
}
else if (Character.isLowerCase(s.charAt(i - 1))) {
sb.insert(i + delta, CharPool.DASH);
}
if (Character.isLowerCase(c1) && Character.isUpperCase(c2)) {
sb.append(c1);
sb.append(CharPool.DASH);
}
else {
sb.append(Character.toLowerCase(c1));
}
}

sb.append(Character.toLowerCase(s.charAt(s.length() - 1)));

return sb.toString();
}

Expand Down
2 changes: 1 addition & 1 deletion portal-web/docroot/html/portlet/blogs/view_entry.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ request.setAttribute("view_entry_content.jsp-assetEntry", assetEntry);
<liferay-ui:panel-container extended="<%= false %>" id="blogsCommentsPanelContainer" persistState="<%= true %>">
<liferay-ui:panel collapsible="<%= true %>" extended="<%= true %>" id="blogsCommentsPanel" persistState="<%= true %>" title="comments">
<c:if test="<%= PropsValues.BLOGS_TRACKBACK_ENABLED && entry.isAllowTrackbacks() && !portletId.equals(PortletKeys.BLOGS_ADMIN) %>">
<aui:input inlineLabel="left" name="trackbackUrl" type="resource" value='<%= PortalUtil.getLayoutFullURL(themeDisplay) + Portal.FRIENDLY_URL_SEPARATOR + "blogs/trackback/" + entry.getUrlTitle() %>' />
<aui:input inlineLabel="left" name="trackbackURL" type="resource" value='<%= PortalUtil.getLayoutFullURL(themeDisplay) + Portal.FRIENDLY_URL_SEPARATOR + "blogs/trackback/" + entry.getUrlTitle() %>' />
</c:if>

<portlet:actionURL var="discussionURL">
Expand Down
2 changes: 1 addition & 1 deletion portal-web/docroot/html/portlet/journal/edit_feed.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ if (feed != null) {

<aui:input cssClass="lfr-textarea-container" name="description" />

<aui:input cssClass="lfr-input-text-container" helpMessage="journal-feed-target-layout-friendly-url-help" name="targetLayoutFriendlyUrl" />
<aui:input cssClass="lfr-input-text-container" helpMessage="journal-feed-target-layout-friendly-url-help" name="targetLayoutFriendlyURL" />

<aui:input cssClass="lfr-input-text-container" helpMessage="journal-feed-target-portlet-id-help" name="targetPortletId" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ String widgetURL = PortalUtil.getWidgetURL(portlet, themeDisplay);
</c:choose>
</div>

<aui:input name="callbackUrl" type="resource" value="<%= callbackURL %>" />
<aui:input name="callbackURL" type="resource" value="<%= callbackURL %>" />

<aui:input label='<%= LanguageUtil.format(pageContext, "allow-users-to-add-x-to-facebook", portletDisplay.getTitle(), false) %>' name="facebookShowAddAppLink" type="checkbox" value="<%= facebookShowAddAppLink %>" />
</c:if>
Expand All @@ -132,7 +132,7 @@ String widgetURL = PortalUtil.getWidgetURL(portlet, themeDisplay);
<liferay-ui:message key="use-the-opensocial-gadget-url-to-create-an-opensocial-gadget" />
</div>

<aui:input name="opensocialGadgetUrl" type="resource" value="<%= PortalUtil.getGoogleGadgetURL(portlet, themeDisplay) %>" />
<aui:input name="opensocialGadgetURL" type="resource" value="<%= PortalUtil.getGoogleGadgetURL(portlet, themeDisplay) %>" />

<aui:input label='<%= LanguageUtil.format(pageContext, "allow-users-to-add-x-to-igoogle", portletDisplay.getTitle(), false) %>' name="iGoogleShowAddAppLink" type="checkbox" value="<%= iGoogleShowAddAppLink %>" />
</aui:fieldset>
Expand All @@ -149,7 +149,7 @@ String widgetURL = PortalUtil.getWidgetURL(portlet, themeDisplay);
<liferay-ui:message key="use-the-netvibes-widget-url-to-create-a-netvibes-widget" />
</div>

<aui:input name="netvibesWidgetUrl" type="resource" value="<%= PortalUtil.getNetvibesURL(portlet, themeDisplay) %>" />
<aui:input name="netvibesWidgetURL" type="resource" value="<%= PortalUtil.getNetvibesURL(portlet, themeDisplay) %>" />

<aui:input label='<%= LanguageUtil.format(pageContext, "allow-users-to-add-x-to-netvibes-pages", portletDisplay.getTitle(), false) %>' name="netvibesShowAddAppLink" type="checkbox" value="<%= netvibesShowAddAppLink %>" />
</aui:fieldset>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ protected void setAttributes(HttpServletRequest request) {
String label = getLabel();

if (label == null) {
label = TextFormatter.format(getName(), TextFormatter.K);
label = TextFormatter.format(getName(), TextFormatter.P);
}

setNamespacedAttribute(request, "label", label);
Expand Down
4 changes: 2 additions & 2 deletions util-taglib/src/com/liferay/taglib/aui/InputTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,15 @@ else if (Validator.equals(type, "checkbox")) {
String label = getLabel();

if (label == null) {
label = TextFormatter.format(name, TextFormatter.K);
label = TextFormatter.format(name, TextFormatter.P);
}

String title = getTitle();

if ((title == null) && (Validator.isNull(label) ||
Validator.equals(type, "image"))) {

title = TextFormatter.format(name, TextFormatter.K);
title = TextFormatter.format(name, TextFormatter.P);
}

_inputName = getName();
Expand Down
4 changes: 2 additions & 2 deletions util-taglib/src/com/liferay/taglib/aui/SelectTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected void setAttributes(HttpServletRequest request) {
String label = getLabel();

if (label == null) {
label = TextFormatter.format(name, TextFormatter.K);
label = TextFormatter.format(name, TextFormatter.P);
}

String listType = getListType();
Expand All @@ -119,7 +119,7 @@ protected void setAttributes(HttpServletRequest request) {
String title = getTitle();

if ((title == null) && Validator.isNull(label)) {
title = TextFormatter.format(name, TextFormatter.K);
title = TextFormatter.format(name, TextFormatter.P);
}

String value = String.valueOf(getValue());
Expand Down

0 comments on commit e6fa8fb

Please sign in to comment.