[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action ...

Christian Bauer christian at hibernate.org
Fri Oct 12 12:31:25 EDT 2007


  User: cbauer  
  Date: 07/10/12 12:31:25

  Modified:    examples/wiki/src/main/org/jboss/seam/wiki/core/action          
                        UserHome.java NodeHome.java DirectoryHome.java
                        NodeHistory.java AdminHome.java FileHome.java
                        WikiRequestResolver.java DocumentHome.java
                        UserSearch.java CommentHome.java
  Log:
  Internationalized almost all strings
  
  Revision  Changes    Path
  1.17      +36 -30    jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UserHome.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserHome.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -b -r1.16 -r1.17
  --- UserHome.java	3 Sep 2007 11:09:15 -0000	1.16
  +++ UserHome.java	12 Oct 2007 16:31:25 -0000	1.17
  @@ -6,6 +6,8 @@
    */
   package org.jboss.seam.wiki.core.action;
   
  +import static javax.faces.application.FacesMessage.SEVERITY_INFO;
  +
   import org.jboss.seam.Component;
   import org.jboss.seam.ScopeType;
   import org.jboss.seam.annotations.*;
  @@ -138,13 +140,6 @@
                               + ((WikiPreferences)Component.getInstance("wikiPreferences")).getThemeName()
                               + "/mailtemplates/confirmationRegistration.xhtml");
   
  -                    // Redirect to last viewed page with message
  -                    facesMessages.addFromResourceBundleOrDefault(
  -                        FacesMessage.SEVERITY_INFO,
  -                        getMessageKeyPrefix() + "confirmationEmailSent",
  -                        "A confirmation e-mail has been sent to '" + getInstance().getEmail() + "'. " +
  -                        "Please read this e-mail to activate your account.");
  -
                       /* For debugging
                       facesMessages.addFromResourceBundleOrDefault(
                           FacesMessage.SEVERITY_INFO,
  @@ -221,8 +216,9 @@
               } else {
                   facesMessages.addFromResourceBundleOrDefault(
                       FacesMessage.SEVERITY_ERROR,
  -                    getMessageKeyPrefix() + "wrongPortraitImageType",
  -                    "The file type '" + portraitContentType + "' is not supported, the portrait hasn't been updated."
  +                    "lacewiki.msg.WrongPortraitImageType",
  +                    "The file type '{0}' is not supported, the portrait was not updated.",
  +                    portraitContentType
                   );
               }
           }
  @@ -263,24 +259,33 @@
           return super.remove();
       }
   
  -    protected String getCreatedMessageKey() {
  -        return getMessageKeyPrefix() + "registrationComplete";
  -    }
  +    /* -------------------------- Messages ------------------------------ */
   
  -    public String getCreatedMessage() {
  -        return "The account '" + getInstance().getUsername() + "' has been created.";
  -    }
  -
  -    protected String getUpdatedMessageKey() {
  -        return getMessageKeyPrefix() + "profileUpdated";
  +    protected void createdMessage() {
  +        getFacesMessages().addFromResourceBundleOrDefault(
  +                SEVERITY_INFO,
  +                "lacewiki.msg.User.Persist",
  +                "User account '{0}' has been saved.",
  +                getInstance().getUsername()
  +        );
       }
   
  -    public String getUpdatedMessage() {
  -        return "The user '" + getInstance().getUsername() + "' has been updated.";
  +    protected void updatedMessage() {
  +        getFacesMessages().addFromResourceBundleOrDefault(
  +                SEVERITY_INFO,
  +                "lacewiki.msg.User.Update",
  +                "User account '{0}' has been updated.",
  +                getInstance().getUsername()
  +        );
       }
   
  -    public String getDeletedMessage() {
  -        return "The user '" + getInstance().getUsername() + "' has been deleted.";
  +    protected void deletedMessage() {
  +        getFacesMessages().addFromResourceBundleOrDefault(
  +                SEVERITY_INFO,
  +                "lacewiki.msg.User.Delete",
  +                "User account '{0}' has been deleted.",
  +                getInstance().getUsername()
  +        );
       }
   
       public String getPassword() { return password; }
  @@ -307,8 +312,8 @@
   
           facesMessages.addFromResourceBundleOrDefault(
               FacesMessage.SEVERITY_INFO,
  -            getMessageKeyPrefix() + "homeDirectoryCreated",
  -            "New home directory has been queued, save settings to commit"
  +            "lacewiki.msg.HomeDirectoryCreated",
  +            "New home directory has been queued, save settings to commit."
           );
       }
   
  @@ -329,8 +334,8 @@
               facesMessages.addToControlFromResourceBundleOrDefault(
                   "passwordControl",
                   FacesMessage.SEVERITY_ERROR,
  -                getMessageKeyPrefix() + "passwordOrPasswordControlEmpty",
  -                "Please enter your password twice."
  +                "lacewiki.msg.PasswordOrPasswordControlEmpty",
  +                "Please enter your password twice!"
               );
               return false;
           }
  @@ -343,8 +348,9 @@
               facesMessages.addToControlFromResourceBundleOrDefault(
                   "password",
                   FacesMessage.SEVERITY_ERROR,
  -                getMessageKeyPrefix() + "passwordNoRegexMatch",
  -                "Password does not match the pattern: " + userManagementPreferences.getPasswordRegex()
  +                "lacewiki.msg.PasswordDoesntMatchPattern",
  +                "Password does not match the pattern: {0}",
  +                userManagementPreferences.getPasswordRegex()
               );
               return false;
           }
  @@ -356,7 +362,7 @@
               facesMessages.addToControlFromResourceBundleOrDefault(
                   "passwordControl",
                   FacesMessage.SEVERITY_ERROR,
  -                getMessageKeyPrefix() + "passwordControlNoMatch",
  +                "lacewiki.msg.PasswordControlNoMatch",
                   "The passwords don't match."
               );
               return false;
  @@ -370,7 +376,7 @@
               facesMessages.addToControlFromResourceBundleOrDefault(
                   "username",
                   FacesMessage.SEVERITY_ERROR,
  -                getMessageKeyPrefix() + "usernameExists",
  +                "lacewiki.msg.UsernameExists",
                   "A user with that name already exists."
               );
               return false;
  
  
  
  1.26      +2 -2      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: NodeHome.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -b -r1.25 -r1.26
  --- NodeHome.java	3 Sep 2007 10:36:34 -0000	1.25
  +++ NodeHome.java	12 Oct 2007 16:31:25 -0000	1.26
  @@ -217,8 +217,8 @@
               getFacesMessages().addToControlFromResourceBundleOrDefault(
                   "name",
                   SEVERITY_ERROR,
  -                getMessageKeyPrefix() + "duplicateName",
  -                "This name is already used, please change it."
  +                "lacewiki.entity.DuplicateName",
  +                "This name is already used, please change it"
               );
               return false;
           }
  
  
  
  1.20      +31 -0     jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryHome.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: DirectoryHome.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryHome.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -b -r1.19 -r1.20
  --- DirectoryHome.java	25 Sep 2007 14:30:46 -0000	1.19
  +++ DirectoryHome.java	12 Oct 2007 16:31:25 -0000	1.20
  @@ -6,6 +6,8 @@
    */
   package org.jboss.seam.wiki.core.action;
   
  +import static javax.faces.application.FacesMessage.SEVERITY_INFO;
  +
   import org.jboss.seam.annotations.*;
   import org.jboss.seam.annotations.Observer;
   import org.jboss.seam.annotations.security.Restrict;
  @@ -95,6 +97,35 @@
           return true;
       }
   
  +    /* -------------------------- Messages ------------------------------ */
  +
  +    protected void createdMessage() {
  +        getFacesMessages().addFromResourceBundleOrDefault(
  +                SEVERITY_INFO,
  +                "lacewiki.msg.Directory.Persist",
  +                "Directory '{0}' has been saved.",
  +                getInstance().getName()
  +        );
  +    }
  +
  +    protected void updatedMessage() {
  +        getFacesMessages().addFromResourceBundleOrDefault(
  +                SEVERITY_INFO,
  +                "lacewiki.msg.Directory.Update",
  +                "Directory '{0}' has been updated.",
  +                getInstance().getName()
  +        );
  +    }
  +
  +    protected void deletedMessage() {
  +        getFacesMessages().addFromResourceBundleOrDefault(
  +                SEVERITY_INFO,
  +                "lacewiki.msg.Directory.Delete",
  +                "Directory '{0}' has been deleted.",
  +                getInstance().getName()
  +        );
  +    }
  +
       /* -------------------------- Internal Methods ------------------------------ */
   
       private void refreshChildNodes() {
  
  
  
  1.13      +16 -14    jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHistory.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: NodeHistory.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHistory.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -b -r1.12 -r1.13
  --- NodeHistory.java	29 Sep 2007 23:15:09 -0000	1.12
  +++ NodeHistory.java	12 Oct 2007 16:31:25 -0000	1.13
  @@ -5,18 +5,12 @@
   import org.jboss.seam.annotations.datamodel.DataModel;
   import org.jboss.seam.annotations.datamodel.DataModelSelection;
   import org.jboss.seam.ScopeType;
  -import org.jboss.seam.Component;
   import org.jboss.seam.security.Identity;
   import org.jboss.seam.security.AuthorizationException;
   import org.jboss.seam.faces.FacesMessages;
   import org.jboss.seam.wiki.core.dao.NodeDAO;
   import org.jboss.seam.wiki.core.model.Node;
   import org.jboss.seam.wiki.core.model.Document;
  -import org.jboss.seam.wiki.core.model.Directory;
  -import org.jboss.seam.wiki.core.engine.WikiLink;
  -import org.jboss.seam.wiki.core.engine.WikiTextParser;
  -import org.jboss.seam.wiki.core.engine.WikiTextRenderer;
  -import org.jboss.seam.wiki.core.engine.WikiLinkResolver;
   import org.jboss.seam.wiki.util.Diff;
   import org.jboss.seam.wiki.util.WikiUtil;
   
  @@ -94,8 +88,10 @@
   
           facesMessages.addFromResourceBundleOrDefault(
               FacesMessage.SEVERITY_INFO,
  -            "diffOldVersionDisplayed",
  -            "Showing historical revision " + selectedHistoricalNode.getRevision());
  +            "lacewiki.msg.DiffOldVersionDisplayed",
  +            "Showing historical revision {0}",
  +            selectedHistoricalNode.getRevision()
  +        );
       }
   
       public void diff() {
  @@ -107,8 +103,10 @@
           if (selectedHistoricalNode == null) {
               facesMessages.addFromResourceBundleOrDefault(
                   FacesMessage.SEVERITY_ERROR,
  -                "historicalNodeNotFound",
  -                "Couldn't find historical node: " + historicalNodeId);
  +                "lacewiki.msg.HistoricalNodeNotFound",
  +                "Couldn't find historical node: {0}",
  +                historicalNodeId
  +            );
               return;
           }
   
  @@ -167,16 +165,20 @@
   
           facesMessages.addFromResourceBundleOrDefault(
               FacesMessage.SEVERITY_INFO,
  -            "diffCreated",
  -            "Comparing current revision with historical revision " + selectedHistoricalNode.getRevision());
  +            "lacewiki.msg.DiffCreated",
  +            "Comparing current revision with historical revision {0}",
  +            selectedHistoricalNode.getRevision()
  +        );
       }
   
       @Restrict("#{s:hasPermission('Node', 'edit', nodeHistory.currentNode)}")
       public String rollback() {
           facesMessages.addFromResourceBundleOrDefault(
               FacesMessage.SEVERITY_INFO,
  -            "rollingBackDocument",
  -            "Rolling back to revision " + selectedHistoricalNode.getRevision());
  +            "lacewiki.msg.RollingBackDocument",
  +            "Rolling document back to revision {0}",
  +            selectedHistoricalNode.getRevision()
  +        );
           return "rollback";
       }
   
  
  
  
  1.12      +1 -1      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/AdminHome.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: AdminHome.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/AdminHome.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -b -r1.11 -r1.12
  --- AdminHome.java	25 Sep 2007 14:30:46 -0000	1.11
  +++ AdminHome.java	12 Oct 2007 16:31:25 -0000	1.12
  @@ -73,7 +73,7 @@
   
           facesMessages.addFromResourceBundleOrDefault(
               FacesMessage.SEVERITY_INFO,
  -            "systemSettingsUpdated",
  +            "lacewiki.msg.SystemSettingsUpdated",
               "System settings updated"
           );
   
  
  
  
  1.10      +31 -1     jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/FileHome.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: FileHome.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/FileHome.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -b -r1.9 -r1.10
  --- FileHome.java	30 Aug 2007 16:51:00 -0000	1.9
  +++ FileHome.java	12 Oct 2007 16:31:25 -0000	1.10
  @@ -4,6 +4,8 @@
   
   import javax.swing.ImageIcon;
   
  +import static javax.faces.application.FacesMessage.SEVERITY_INFO;
  +
   import org.jboss.seam.annotations.*;
   import org.jboss.seam.ScopeType;
   import org.jboss.seam.Component;
  @@ -18,7 +20,6 @@
   import java.util.*;
   
   import net.sf.jmimemagic.Magic;
  -import net.sf.jmimemagic.MagicMatchNotFoundException;
   
   @Name("fileHome")
   @Scope(ScopeType.CONVERSATION)
  @@ -150,6 +151,35 @@
           }
       }
   
  +    /* -------------------------- Messages ------------------------------ */
  +
  +    protected void createdMessage() {
  +        getFacesMessages().addFromResourceBundleOrDefault(
  +                SEVERITY_INFO,
  +                "lacewiki.msg.File.Persist",
  +                "File '{0}' has been saved.",
  +                getInstance().getName()
  +        );
  +    }
  +
  +    protected void updatedMessage() {
  +        getFacesMessages().addFromResourceBundleOrDefault(
  +                SEVERITY_INFO,
  +                "lacewiki.msg.File.Update",
  +                "File '{0}' has been updated.",
  +                getInstance().getName()
  +        );
  +    }
  +
  +    protected void deletedMessage() {
  +        getFacesMessages().addFromResourceBundleOrDefault(
  +                SEVERITY_INFO,
  +                "lacewiki.msg.File.Delete",
  +                "File '{0}' has been deleted.",
  +                getInstance().getName()
  +        );
  +    }
  +
       /* -------------------------- Public Features ------------------------------ */
   
       public List<Importer> getAvailableImporters() {
  
  
  
  1.3       +1 -1      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/WikiRequestResolver.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: WikiRequestResolver.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/WikiRequestResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- WikiRequestResolver.java	24 Sep 2007 08:23:21 -0000	1.2
  +++ WikiRequestResolver.java	12 Oct 2007 16:31:25 -0000	1.3
  @@ -103,7 +103,7 @@
   
       public String resolve() {
   
  -        // Queue a message if requested (for message passing across session invalidations)
  +        // Queue a message if requested (for message passing across session invalidations and conversations)
           if (message != null) {
               facesMessages.addFromResourceBundle(
                   FacesMessage.SEVERITY_INFO,
  
  
  
  1.33      +31 -0     jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHome.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: DocumentHome.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DocumentHome.java,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -b -r1.32 -r1.33
  --- DocumentHome.java	2 Oct 2007 06:44:59 -0000	1.32
  +++ DocumentHome.java	12 Oct 2007 16:31:25 -0000	1.33
  @@ -6,6 +6,8 @@
    */
   package org.jboss.seam.wiki.core.action;
   
  +import static javax.faces.application.FacesMessage.SEVERITY_INFO;
  +
   import org.jboss.seam.annotations.*;
   import org.jboss.seam.ui.validator.FormattedTextValidator;
   import org.jboss.seam.wiki.core.model.*;
  @@ -174,6 +176,35 @@
           Contexts.getConversationContext().set("currentDirectory", newParent);
       }
   
  +    /* -------------------------- Messages ------------------------------ */
  +
  +    protected void createdMessage() {
  +        getFacesMessages().addFromResourceBundleOrDefault(
  +                SEVERITY_INFO,
  +                "lacewiki.msg.Document.Persist",
  +                "Document '{0}' has been saved.",
  +                getInstance().getName()
  +        );
  +    }
  +
  +    protected void updatedMessage() {
  +        getFacesMessages().addFromResourceBundleOrDefault(
  +                SEVERITY_INFO,
  +                "lacewiki.msg.Document.Update",
  +                "Document '{0}' has been updated.",
  +                getInstance().getName()
  +        );
  +    }
  +
  +    protected void deletedMessage() {
  +        getFacesMessages().addFromResourceBundleOrDefault(
  +                SEVERITY_INFO,
  +                "lacewiki.msg.Document.Delete",
  +                "Document '{0}' has been deleted.",
  +                getInstance().getName()
  +        );
  +    }
  +
       /* -------------------------- Internal Methods ------------------------------ */
   
   
  
  
  
  1.8       +1 -1      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserSearch.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UserSearch.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/UserSearch.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- UserSearch.java	20 Jun 2007 01:30:36 -0000	1.7
  +++ UserSearch.java	12 Oct 2007 16:31:25 -0000	1.8
  @@ -75,7 +75,7 @@
           if (rowCount == 0) {
               facesMessages.addFromResourceBundleOrDefault(
                   FacesMessage.SEVERITY_INFO,
  -                "noUserFound",
  +                "lacewiki.msg.NoUserFound",
                   "No user with given attributes was found, please try again."
               );
           }
  
  
  
  1.11      +0 -19     jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: CommentHome.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- CommentHome.java	25 Sep 2007 14:30:46 -0000	1.10
  +++ CommentHome.java	12 Oct 2007 16:31:25 -0000	1.11
  @@ -7,18 +7,13 @@
   package org.jboss.seam.wiki.core.action;
   
   import org.jboss.seam.annotations.*;
  -import org.jboss.seam.annotations.remoting.WebRemote;
   import org.jboss.seam.ScopeType;
  -import org.jboss.seam.Component;
   import org.jboss.seam.security.Identity;
   import org.jboss.seam.security.AuthorizationException;
  -import org.jboss.seam.faces.FacesMessages;
   import org.jboss.seam.wiki.core.model.*;
  -import org.jboss.seam.wiki.core.action.prefs.WikiPreferences;
   import org.jboss.seam.wiki.util.WikiUtil;
   
   import javax.persistence.EntityManager;
  -import javax.faces.application.FacesMessage;
   import java.io.Serializable;
   import java.util.List;
   import java.util.ArrayList;
  @@ -31,9 +26,6 @@
       EntityManager entityManager;
   
       @In
  -    FacesMessages facesMessages;
  -
  -    @In
       DocumentHome documentHome;
   
       @In
  @@ -96,12 +88,6 @@
   
           entityManager.persist(comment);
   
  -
  -        facesMessages.addFromResourceBundleOrDefault(
  -            FacesMessage.SEVERITY_INFO,
  -            "comment.persist",
  -            "Your comment has been saved."
  -        );
           refreshComments();
       }
   
  @@ -114,11 +100,6 @@
               }
   
               entityManager.remove(foundCommment);
  -            facesMessages.addFromResourceBundleOrDefault(
  -                FacesMessage.SEVERITY_INFO,
  -                "comment.remove",
  -                "Comment with subject '" + foundCommment.getSubject() + "' has been removed."
  -            );
           }
   
           refreshComments();
  
  
  



More information about the jboss-cvs-commits mailing list