Author: dmaliarevich
Date: 2011-09-12 10:02:24 -0400 (Mon, 12 Sep 2011)
New Revision: 34635
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsUtils.java
Log:
https://issues.jboss.org/browse/JBIDE-9674 , generated property key was corrected
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsUtils.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsUtils.java 2011-09-12
14:01:34 UTC (rev 34634)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/i18n/ExternalizeStringsUtils.java 2011-09-12
14:02:24 UTC (rev 34635)
@@ -100,7 +100,7 @@
public static final String NONAME = "noname"; //$NON-NLS-1$
public static final char[] REPLACED_CHARACTERS = new char[] {'~', '!',
'@', '#',
- '$', '%', '^', '&', '*', '(',
')', '-', '+', '=', '{', '}', '[',
']', ':', ';', ',', '.', '?',
'\\', '/', '"', '\''};
+ '$', '%', '^', '&', '*', '(',
')', '-', '+', '=', '{', '}', '[',
']', ':', ';', ',', '.', '?',
'\\', '/', '"', '\'', ' '};
public static final char[] LINE_DELEMITERS = new char[] {'\r', '\n',
'\t'};
private static CharsetEncoder asciiEncoder;
@@ -439,6 +439,7 @@
* @return the result string
*/
public static String generatePropertyKey(String text) {
+ String result = text.trim();
/*
* If text cannot be represented in standard eclipse encoding
* change the key name to "noname"
@@ -446,18 +447,16 @@
if (null == asciiEncoder) {
asciiEncoder = Charset.forName("ISO-8859-1").newEncoder(); //$NON-NLS-1$
}
- if (!asciiEncoder.canEncode(text)) {
- text = NONAME;
+ if (!asciiEncoder.canEncode(result)) {
+ result = NONAME;
}
-
- String result = text.trim();
/*
* Update text string field.
* Trim the text to remove line breaks and caret returns.
* Replace line delimiters white space
*/
for (char ch : LINE_DELEMITERS) {
- text = text.trim().replace(ch, ' ');
+ result = result.trim().replace(ch, ' ');
}
/*
* Replace all other symbols with '_'
@@ -466,11 +465,6 @@
result = result.replace(ch, '_');
}
/*
- * Replace all white spaces with '_'
- */
- result = result.replaceAll(Constants.WHITE_SPACE,
- Constants.UNDERSCORE);
- /*
* Correct underline symbols:
* show only one of them
*/