directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1786493 - in /directory/shared/branches/shared-value/i18n/src/main: java/org/apache/directory/api/i18n/I18n.java resources/org/apache/directory/api/i18n/errors.properties resources/org/apache/directory/api/i18n/messages.properties
Date Sat, 11 Mar 2017 07:46:21 GMT
Author: elecharny
Date: Sat Mar 11 07:46:21 2017
New Revision: 1786493

URL: http://svn.apache.org/viewvc?rev=1786493&view=rev
Log:
Added messages for SyntaxCheckers

Modified:
    directory/shared/branches/shared-value/i18n/src/main/java/org/apache/directory/api/i18n/I18n.java
    directory/shared/branches/shared-value/i18n/src/main/resources/org/apache/directory/api/i18n/errors.properties
    directory/shared/branches/shared-value/i18n/src/main/resources/org/apache/directory/api/i18n/messages.properties

Modified: directory/shared/branches/shared-value/i18n/src/main/java/org/apache/directory/api/i18n/I18n.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/i18n/src/main/java/org/apache/directory/api/i18n/I18n.java?rev=1786493&r1=1786492&r2=1786493&view=diff
==============================================================================
--- directory/shared/branches/shared-value/i18n/src/main/java/org/apache/directory/api/i18n/I18n.java
(original)
+++ directory/shared/branches/shared-value/i18n/src/main/java/org/apache/directory/api/i18n/I18n.java
Sat Mar 11 07:46:21 2017
@@ -627,6 +627,7 @@ public enum I18n
     ERR_04486_VALUE_ALREADY_EXISTS("ERR_04486_VALUE_ALREADY_EXISTS"),
     ERR_04487_ATTRIBUTE_IS_SINGLE_VALUED("ERR_04487_ATTRIBUTE_IS_SINGLE_VALUED"),
     ERR_04488_NULL_ATTRIBUTE_TYPE("ERR_04488_NULL_ATTRIBUTE_TYPE"),
+    ERR_04489_SYNTAX_INVALID("ERR_04489_SYNTAX_INVALID"),
 
     // ldap-constants
     ERR_05001_UNKNOWN_AUTHENT_LEVEL("ERR_05001_UNKNOWN_AUTHENT_LEVEL"),
@@ -774,7 +775,11 @@ public enum I18n
     ERR_12084("ERR_12084"),
     ERR_12085("ERR_12085"),
     ERR_12086("ERR_12086"),
-    ERR_12087("ERR_12087");
+    ERR_12087("ERR_12087"),
+
+    // The messages
+    MSG_04490_SYNTAX_VALID( "MSG_04490_SYNTAX_VALID" );
+    
 
     /** The error code */
     private String errorCode;
@@ -846,6 +851,44 @@ public enum I18n
             return err + " (" + sb.toString() + ")";
         }
     }
+    
+
+    /**
+     *
+     * Translate a message code with argument(s)
+     *
+     * @param msg The message code
+     * @param args The argument(s)
+     * @return The translated error
+     */
+    public static String msg( I18n msg, Object... args )
+    {
+        try
+        {
+            return msg + " " + format( ERR_BUNDLE.getString( msg.getErrorCode() ), args );
+        }
+        catch ( Exception e )
+        {
+            StringBuilder sb = new StringBuilder();
+            boolean comma = false;
+
+            for ( Object obj : args )
+            {
+                if ( comma )
+                {
+                    sb.append( "," );
+                }
+                else
+                {
+                    comma = true;
+                }
+
+                sb.append( obj );
+            }
+            return msg + " (" + sb.toString() + ")";
+        }
+    }
+
 
 
     /**

Modified: directory/shared/branches/shared-value/i18n/src/main/resources/org/apache/directory/api/i18n/errors.properties
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/i18n/src/main/resources/org/apache/directory/api/i18n/errors.properties?rev=1786493&r1=1786492&r2=1786493&view=diff
==============================================================================
--- directory/shared/branches/shared-value/i18n/src/main/resources/org/apache/directory/api/i18n/errors.properties
(original)
+++ directory/shared/branches/shared-value/i18n/src/main/resources/org/apache/directory/api/i18n/errors.properties
Sat Mar 11 07:46:21 2017
@@ -614,7 +614,7 @@ ERR_04485_COLLECTIVE_NOT_ALLOWED_IN_MAY=
 ERR_04486_VALUE_ALREADY_EXISTS=The value ''{0}'' already exists in the attribute ({1})
 ERR_04487_ATTRIBUTE_IS_SINGLE_VALUED=The attribute ''{0}'' is single valued, we can't add
no more values into it
 ERR_04488_NULL_ATTRIBUTE_TYPE=The AttributeType cannot be null
-
+ERR_04489_SYNTAX_INVALID=Syntax invalid for ''{0}''
 # ldap-constants
 ERR_05001_UNKNOWN_AUTHENT_LEVEL=Unknown AuthenticationLevel {0}
 

Modified: directory/shared/branches/shared-value/i18n/src/main/resources/org/apache/directory/api/i18n/messages.properties
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-value/i18n/src/main/resources/org/apache/directory/api/i18n/messages.properties?rev=1786493&r1=1786492&r2=1786493&view=diff
==============================================================================
--- directory/shared/branches/shared-value/i18n/src/main/resources/org/apache/directory/api/i18n/messages.properties
(original)
+++ directory/shared/branches/shared-value/i18n/src/main/resources/org/apache/directory/api/i18n/messages.properties
Sat Mar 11 07:46:21 2017
@@ -17,3 +17,6 @@
 #  under the License. 
 #  
 #
+
+# ldap model messages
+MSG_04490_SYNTAX_VALID=Syntax valid for ''{0}''



Mime
View raw message