roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ko...@apache.org
Subject svn commit: r1677139 - in /roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments: LdapCommentAuthenticator.java MathCommentAuthenticator.java
Date Fri, 01 May 2015 13:43:57 GMT
Author: kohei
Date: Fri May  1 13:43:56 2015
New Revision: 1677139

URL: http://svn.apache.org/r1677139
Log:
ROL-2074 Locale specific message doesn't appear to fragments that produced by CommentAuthenticators

Modified:
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/LdapCommentAuthenticator.java
    roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/LdapCommentAuthenticator.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/LdapCommentAuthenticator.java?rev=1677139&r1=1677138&r2=1677139&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/LdapCommentAuthenticator.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/LdapCommentAuthenticator.java
Fri May  1 13:43:56 2015
@@ -18,7 +18,6 @@
 package org.apache.roller.weblogger.ui.rendering.plugins.comments;
 
 import java.util.Hashtable;
-import java.util.ResourceBundle;
 
 import javax.naming.Context;
 import javax.naming.NamingException;
@@ -30,6 +29,7 @@ import javax.servlet.http.HttpSession;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.config.WebloggerConfig;
+import org.apache.roller.weblogger.util.I18nMessages;
 import org.springframework.util.StringUtils;
 
 /**
@@ -56,8 +56,6 @@ import org.springframework.util.StringUt
  */
 public class LdapCommentAuthenticator implements CommentAuthenticator {
 
-	private transient ResourceBundle bundle = ResourceBundle.getBundle("ApplicationResources");
-
 	private static Log LOG = LogFactory.getLog(LdapCommentAuthenticator.class);
 
 	public String getHtml(HttpServletRequest request) {
@@ -75,17 +73,18 @@ public class LdapCommentAuthenticator im
 			ldapPass = ldapPassTemp != null ? ldapPassTemp : "";
 		}
 
+		I18nMessages messages = I18nMessages.getMessages(request.getLocale());
 		StringBuilder sb = new StringBuilder();
 
 		sb.append("<p>");
-		sb.append(bundle.getString("comments.ldapAuthenticatorUserName"));
+		sb.append(messages.getString("comments.ldapAuthenticatorUserName"));
 		sb.append("</p>");
 		sb.append("<p>");
 		sb.append("<input name=\"ldapUser\" value=\"");
 		sb.append(ldapUser + "\">");
 		sb.append("</p>");
 		sb.append("<p>");
-		sb.append(bundle.getString("comments.ldapAuthenticatorPassword"));
+		sb.append(messages.getString("comments.ldapAuthenticatorPassword"));
 		sb.append("</p>");
 		sb.append("<p>");
 		sb.append("<input type=\"password\" name=\"ldapPass\" value=\"");

Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java
URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java?rev=1677139&r1=1677138&r2=1677139&view=diff
==============================================================================
--- roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java
(original)
+++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/ui/rendering/plugins/comments/MathCommentAuthenticator.java
Fri May  1 13:43:56 2015
@@ -19,11 +19,11 @@
 package org.apache.roller.weblogger.ui.rendering.plugins.comments;
 
 import java.util.Random;
-import java.util.ResourceBundle;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.weblogger.util.I18nMessages;
 
 
 /**
@@ -31,9 +31,6 @@ import org.apache.commons.logging.LogFac
  */
 public class MathCommentAuthenticator implements CommentAuthenticator {
     
-    private transient ResourceBundle bundle =
-            ResourceBundle.getBundle("ApplicationResources");
-    
     private static Log mLogger = LogFactory.getLog(MathCommentAuthenticator.class);
     
     
@@ -60,11 +57,12 @@ public class MathCommentAuthenticator im
         // pull existing values out of session
         Integer value1o = (Integer)request.getSession().getAttribute("mathValue1");
         Integer value2o = (Integer)request.getSession().getAttribute("mathValue2");
-        
+
+        I18nMessages messages = I18nMessages.getMessages(request.getLocale());
         StringBuilder sb = new StringBuilder();
         
         sb.append("<p>");
-        sb.append(bundle.getString("comments.mathAuthenticatorQuestion"));
+        sb.append(messages.getString("comments.mathAuthenticatorQuestion"));
         sb.append("</p><p>");
         sb.append(value1o);
         sb.append(" + ");



Mime
View raw message