directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fel...@apache.org
Subject svn commit: r721409 - /directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/
Date Fri, 28 Nov 2008 10:00:34 GMT
Author: felixk
Date: Fri Nov 28 02:00:33 2008
New Revision: 721409

URL: http://svn.apache.org/viewvc?rev=721409&view=rev
Log:
- Externalize Strings
- Add German translation

Added:
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/Messages.java
  (with props)
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages.properties
  (with props)
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages_de.properties
  (with props)
Modified:
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/AbstractServerXmlIO.java
    directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerConfigurationVersionEnum.java

Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/AbstractServerXmlIO.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/AbstractServerXmlIO.java?rev=721409&r1=721408&r2=721409&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/AbstractServerXmlIO.java
(original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/AbstractServerXmlIO.java
Fri Nov 28 02:00:33 2008
@@ -40,6 +40,7 @@
 import org.dom4j.Element;
 import org.dom4j.io.DocumentResult;
 import org.dom4j.io.DocumentSource;
+import org.eclipse.osgi.util.NLS;
 
 
 /**
@@ -63,10 +64,10 @@
      */
     public Element getBeanElementById( Document document, String id )
     {
-        for ( Iterator<?> i = document.getRootElement().elementIterator( "bean" );
i.hasNext(); )
+        for ( Iterator<?> i = document.getRootElement().elementIterator( "bean" );
i.hasNext(); ) //$NON-NLS-1$
         {
             Element element = ( Element ) i.next();
-            org.dom4j.Attribute idAttribute = element.attribute( "id" );
+            org.dom4j.Attribute idAttribute = element.attribute( "id" ); //$NON-NLS-1$
             if ( idAttribute != null && ( idAttribute.getValue().equals( id ) ) )
             {
                 return element;
@@ -89,10 +90,10 @@
      */
     public Element getBeanPropertyElement( String property, Element element )
     {
-        for ( Iterator<?> i = element.elementIterator( "property" ); i.hasNext(); )
+        for ( Iterator<?> i = element.elementIterator( "property" ); i.hasNext(); )
//$NON-NLS-1$
         {
             Element propertyElement = ( Element ) i.next();
-            org.dom4j.Attribute nameAttribute = propertyElement.attribute( "name" );
+            org.dom4j.Attribute nameAttribute = propertyElement.attribute( "name" ); //$NON-NLS-1$
             if ( nameAttribute != null && ( nameAttribute.getValue().equals( property
) ) )
             {
                 return propertyElement;
@@ -118,13 +119,13 @@
         Element propertyElement = getBeanPropertyElement( property, element );
         if ( propertyElement != null )
         {
-            org.dom4j.Attribute valueAttribute = propertyElement.attribute( "value" );
+            org.dom4j.Attribute valueAttribute = propertyElement.attribute( "value" ); //$NON-NLS-1$
             if ( valueAttribute != null )
             {
                 return valueAttribute.getValue();
             }
 
-            org.dom4j.Attribute refAttribute = propertyElement.attribute( "ref" );
+            org.dom4j.Attribute refAttribute = propertyElement.attribute( "ref" ); //$NON-NLS-1$
             if ( refAttribute != null )
             {
                 return refAttribute.getValue();
@@ -147,17 +148,18 @@
      */
     public boolean parseBoolean( String s ) throws BooleanFormatException
     {
-        if ( "true".equals( s ) )
+        if ( "true".equals( s ) ) //$NON-NLS-1$
         {
             return true;
         }
-        else if ( "false".equals( s ) )
+        else if ( "false".equals( s ) ) //$NON-NLS-1$
         {
             return false;
         }
         else
         {
-            throw new BooleanFormatException( "The String '" + s + "' could not be parsed
as a boolean." );
+            throw new BooleanFormatException( NLS.bind(
+                Messages.getString( "AbstractServerXmlIO.ErrorNotBoolean" ), new String[]
{ s } ) ); //$NON-NLS-1$
         }
     }
 
@@ -263,8 +265,8 @@
         TransformerFactory factory = TransformerFactory.newInstance();
         Transformer transformer = null;
 
-        transformer = factory
-            .newTransformer( new StreamSource( ApacheDSConfigurationPlugin.class.getResourceAsStream(
"template.xslt" ) ) );
+        transformer = factory.newTransformer( new StreamSource( ApacheDSConfigurationPlugin.class
+            .getResourceAsStream( "template.xslt" ) ) ); //$NON-NLS-1$
 
         // now lets style the given document
         DocumentSource source = new DocumentSource( document );

Added: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/Messages.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/Messages.java?rev=721409&view=auto
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/Messages.java
(added)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/Messages.java
Fri Nov 28 02:00:33 2008
@@ -0,0 +1,50 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.studio.apacheds.configuration.model;
+
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages
+{
+    private static final String BUNDLE_NAME = "org.apache.directory.studio.apacheds.configuration.model.messages";
//$NON-NLS-1$
+
+    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle( BUNDLE_NAME
);
+
+
+    private Messages()
+    {
+    }
+
+
+    public static String getString( String key )
+    {
+        try
+        {
+            return RESOURCE_BUNDLE.getString( key );
+        }
+        catch ( MissingResourceException e )
+        {
+            return '!' + key + '!';
+        }
+    }
+}

Propchange: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/Messages.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/Messages.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerConfigurationVersionEnum.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerConfigurationVersionEnum.java?rev=721409&r1=721408&r2=721409&view=diff
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerConfigurationVersionEnum.java
(original)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/ServerConfigurationVersionEnum.java
Fri Nov 28 02:00:33 2008
@@ -36,10 +36,10 @@
          */
         public String toString()
         {
-            return "Version 1.5.4";
+            return Messages.getString( "ServerConfigurationVersionEnum.Version154" ); //$NON-NLS-1$
         }
     },
-    
+
     /** Version 1.5.3 */
     VERSION_1_5_3
     {
@@ -48,10 +48,10 @@
          */
         public String toString()
         {
-            return "Version 1.5.3";
+            return Messages.getString( "ServerConfigurationVersionEnum.Version153" ); //$NON-NLS-1$
         }
     },
-    
+
     /** Version 1.5.2 */
     VERSION_1_5_2
     {
@@ -60,7 +60,7 @@
          */
         public String toString()
         {
-            return "Version 1.5.2";
+            return Messages.getString( "ServerConfigurationVersionEnum.Version152" ); //$NON-NLS-1$
         }
     },
 
@@ -72,7 +72,7 @@
          */
         public String toString()
         {
-            return "Version 1.5.1";
+            return Messages.getString( "ServerConfigurationVersionEnum.Version151" ); //$NON-NLS-1$
         }
     },
 
@@ -84,7 +84,7 @@
          */
         public String toString()
         {
-            return "Version 1.5.0";
+            return Messages.getString( "ServerConfigurationVersionEnum.Version150" ); //$NON-NLS-1$
         }
     }
 }

Added: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages.properties?rev=721409&view=auto
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages.properties
(added)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages.properties
Fri Nov 28 02:00:33 2008
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+AbstractServerXmlIO.ErrorNotBoolean=The String "{0}" could not be parsed as a boolean.
+ServerConfigurationVersionEnum.Version150=Version 1.5.0
+ServerConfigurationVersionEnum.Version151=Version 1.5.1
+ServerConfigurationVersionEnum.Version152=Version 1.5.2
+ServerConfigurationVersionEnum.Version153=Version 1.5.3
+ServerConfigurationVersionEnum.Version154=Version 1.5.4

Propchange: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages.properties
------------------------------------------------------------------------------
    svn:keywords = Id

Added: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages_de.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages_de.properties?rev=721409&view=auto
==============================================================================
--- directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages_de.properties
(added)
+++ directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages_de.properties
Fri Nov 28 02:00:33 2008
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+AbstractServerXmlIO.ErrorNotBoolean=Der String "{0}" konnte nicht als boolean geparst werden.

Propchange: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages_de.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/studio/trunk/apacheds-configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/model/messages_de.properties
------------------------------------------------------------------------------
    svn:keywords = Id



Mime
View raw message