[cal10n-dev] branch, master, updated. v0.6.5-8-gbbe2252

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Fri Sep 4 15:29:26 CEST 2009


The branch, master has been updated
       via  bbe225290e7073d10a0cd87140002c4e422c6ac3 (commit)
      from  bdbdcf62a24bef203a59f9c7db0715c0d550d9f1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=cal10n.git;a=commit;h=bbe225290e7073d10a0cd87140002c4e422c6ac3
http://github.com/ceki/cal10n/commit/bbe225290e7073d10a0cd87140002c4e422c6ac3

commit bbe225290e7073d10a0cd87140002c4e422c6ac3
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Fri Sep 4 15:27:06 2009 +0200

    - improved docs

diff --git a/cal10n-api/src/main/java/ch/qos/cal10n/Cal10nConstants.java b/cal10n-api/src/main/java/ch/qos/cal10n/Cal10nConstants.java
index 87d5c27..a940f1d 100644
--- a/cal10n-api/src/main/java/ch/qos/cal10n/Cal10nConstants.java
+++ b/cal10n-api/src/main/java/ch/qos/cal10n/Cal10nConstants.java
@@ -5,12 +5,24 @@ package ch.qos.cal10n;
  * This class defines the shared constants in CAL10N.
  * 
  * @author Ceki G&uuml;lc&uuml;
- *
+ * 
  */
 public class Cal10nConstants {
 
+  final public static String MessageKeyVerifier_FQCN = "ch.qos.cal10n.verifier.MessageKeyVerifier";
+
   final public static String CODE_URL_PREFIX = "http://cal10n.qos.ch/codes.html";
-  final public static String MISSING_BN_ANNOTATION_URL =  Cal10nConstants.CODE_URL_PREFIX+"#missingBaseNameAnnotation";
+  final public static String MISSING_BN_ANNOTATION_URL = Cal10nConstants.CODE_URL_PREFIX
+      + "#missingBaseNameAnnotation";
 
-  final public static String MessageKeyVerifier_FQCN = "ch.qos.cal10n.verifier.MessageKeyVerifier";
+  final public static String MISSING_LD_ANNOTATION_URL = Cal10nConstants.CODE_URL_PREFIX
+      + "#missingLDAnnotation";
+  final public static String MISSING_LD_ANNOTATION_MESSAGE = "Missing @LocaleData annotation in enum type [{0}]. Please see "
+      + MISSING_LD_ANNOTATION_URL;
+
+  final public static String MISSING_ENUM_TYPES_URL = Cal10nConstants.CODE_URL_PREFIX
+      + "#missingEnumType";
+
+  final public static String MISSING_ENUM_TYPES_MSG = "Missing <enumTypes> element. Please see "
+      + MISSING_ENUM_TYPES_URL;
 }
diff --git a/cal10n-api/src/main/java/ch/qos/cal10n/verifier/MessageKeyVerifier.java b/cal10n-api/src/main/java/ch/qos/cal10n/verifier/MessageKeyVerifier.java
index 8db124a..ab0978e 100644
--- a/cal10n-api/src/main/java/ch/qos/cal10n/verifier/MessageKeyVerifier.java
+++ b/cal10n-api/src/main/java/ch/qos/cal10n/verifier/MessageKeyVerifier.java
@@ -22,6 +22,7 @@
 
 package ch.qos.cal10n.verifier;
 
+import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.HashSet;
@@ -30,6 +31,7 @@ import java.util.Locale;
 import java.util.ResourceBundle;
 import java.util.Set;
 
+import ch.qos.cal10n.Cal10nConstants;
 import ch.qos.cal10n.util.AnnotationExtractor;
 import ch.qos.cal10n.util.CAL10NResourceBundleFinder;
 import ch.qos.cal10n.util.MiscUtil;
@@ -153,8 +155,7 @@ public class MessageKeyVerifier implements IMessageKeyVerifier {
     String[] localeNameArray = getLocaleNames();
 
     if (localeNameArray == null || localeNameArray.length == 0) {
-      String errMsg = "Missing @LocaleData annotation in enum type ["
-          + enumTypeAsStr + "]";
+      String errMsg = MessageFormat.format(Cal10nConstants.MISSING_LD_ANNOTATION_MESSAGE, enumTypeAsStr);
       throw new IllegalStateException(errMsg);
     }
     for (String localeName : localeNameArray) {
diff --git a/cal10n-api/src/test/java/ch/qos/cal10n/verifier/MessageKeyVerifierTest.java b/cal10n-api/src/test/java/ch/qos/cal10n/verifier/MessageKeyVerifierTest.java
index 13288bc..c8ab126 100644
--- a/cal10n-api/src/test/java/ch/qos/cal10n/verifier/MessageKeyVerifierTest.java
+++ b/cal10n-api/src/test/java/ch/qos/cal10n/verifier/MessageKeyVerifierTest.java
@@ -23,6 +23,7 @@
 package ch.qos.cal10n.verifier;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 import java.util.List;
 import java.util.Locale;
@@ -31,6 +32,7 @@ import org.junit.Test;
 
 import ch.qos.cal10n.sample.Colors;
 import ch.qos.cal10n.sample.Countries;
+import ch.qos.cal10n.sample.Minimal;
 
 /**
  * 
@@ -38,14 +40,13 @@ import ch.qos.cal10n.sample.Countries;
  */
 public class MessageKeyVerifierTest {
 
-  
   @Test
   public void smoke() {
     IMessageKeyVerifier miv = new MessageKeyVerifier(Colors.class);
     List<Cal10nError> errorList = miv.verify(Locale.UK);
     assertEquals(0, errorList.size());
   }
-  
+
   @Test
   public void withErrors_UK() {
     IMessageKeyVerifier miv = new MessageKeyVerifier(Countries.class);
@@ -55,7 +56,6 @@ public class MessageKeyVerifierTest {
     assertEquals("BR", errorList.get(1).getKey());
   }
 
-  
   @Test
   public void withErrors_FR() {
     IMessageKeyVerifier miv = new MessageKeyVerifier(Countries.class);
@@ -65,4 +65,14 @@ public class MessageKeyVerifierTest {
     assertEquals("CN", errorList.get(1).getKey());
     assertEquals("BR", errorList.get(2).getKey());
   }
+
+  @Test
+  public void all() {
+    IMessageKeyVerifier mcv = new MessageKeyVerifier(Minimal.class);
+    try {
+      mcv.verifyAllLocales();
+      fail("an emum without LocaleData cannot be verifiied in one step");
+    } catch (IllegalStateException e) {
+    }
+  }
 }
diff --git a/cal10n-site/src/site/pages/codes.html b/cal10n-site/src/site/pages/codes.html
index 21dd972..c8a3d2b 100644
--- a/cal10n-site/src/site/pages/codes.html
+++ b/cal10n-site/src/site/pages/codes.html
@@ -41,6 +41,16 @@
 
     <hr/>
 
+    <h3><a name="missingLDAnnotation" href="#missingLDAnnotation">Missing
+    @LocaleData annotation in enum type [...].</a> </h3>
+
+    <p>If an enum type and its associated bundles are to be verified
+    via the <em>maven-cal10n-plugin</em> or via a <a href="manual.html#singleTest">single unit test</a>,
+    then the enum type needs to be annotated with <a
+    href="apidocs/ch/qos/cal10n/LocaleData.html">LocaleData</a>.
+    </p> 
+    <hr/>
+
     <h3><a name="missingEnumType" href="#missingEnumType">Missing
     <code>&lt;enumTypes></code> element.</a> 
     </h3>
@@ -52,16 +62,7 @@
     </p>
 
 
-    <hr/>
-
-    <h3><a name="missingLocale" href="#missingLocale">Missing
-    @LocaleData annotation in enum type [...].</a> </h3>
-
-    <p>If an enum type and its associated bundles are to be verified
-    via the <em>maven-cal10n-plugin</em>, then the enum type needs to
-    be annotated with <a
-    href="apidocs/ch/qos/cal10n/LocaleData.html">LocaleData</a>.
-    </p>
+ 
 
   <script src="templates/footer.js" type="text/javascript"></script>
 </div>
diff --git a/cal10n-site/src/site/pages/index.html b/cal10n-site/src/site/pages/index.html
index 67b0c97..fadc31d 100644
--- a/cal10n-site/src/site/pages/index.html
+++ b/cal10n-site/src/site/pages/index.html
@@ -32,23 +32,23 @@
 
    <ul>
      <li>
-       <p>Java compiler verifies message keys used in source code</p>
+       <p>java compiler verifies message keys used in source code</p>
      </li>
      
      <li>
-       <p>Tooling to detect errors in message keys</p>
+       <p>tooling to detect errors in message keys</p>
      </li>
 
-     <li>The <em>native2ascii</em> tool becomes unnecessary. With CAL10N,
-     you can directly encode bundles in the most convenient charset,
-     per locale.</li>
+     <li><em>native2ascii</em> tool made superfluous, as you can
+     directly encode bundles in the most convenient charset, per
+     locale.</li>
 
      <li>
-       <p>Good performance (300 nanoseconds per key lookup)</p>
+       <p>good performance (300 nanoseconds per key look-up)</p>
      </li>
-
+ 
      <li>
-       <p>Automatic reloading of resource bundles upon change</p>
+       <p>automatic reloading of resource bundles upon change</p>
      </li>
 
    </ul>
diff --git a/cal10n-site/src/site/pages/manual.html b/cal10n-site/src/site/pages/manual.html
index 3e8ce36..e415bd0 100644
--- a/cal10n-site/src/site/pages/manual.html
+++ b/cal10n-site/src/site/pages/manual.html
@@ -215,11 +215,31 @@ colors_fr_FR.properties</pre>
   encoding and charset list</a> for more details.
   </p>
 
+
   <p>Assume you have four resource bundles, for the English, French,
   Turkish and Greek languages. You decide to encode all of them in
-  UTF-8 except for the Turkish bundle which is already encoded in
-  ISO8859_3.  To tell CAL10N that those are the encodings, you would
-  write:</p>
+  UTF-8. To tell CAL10N that UTF-8 is the default encoding for all
+  locales, one would write:</p>
+
+<pre class="prettyprint">
+ at BaseName("colors")
+ at LocaleData(
+  <b>defaultCharset="UTF8",</b>
+  value = { @Locale("en_UK"),
+            @Locale("fr_FR"),
+            @Locale("tr_TR"),
+            @Locale("el_GR")
+           }
+   )
+public enum Colors {
+ BLUE,
+ RED,
+ GREEN;
+} 
+</pre>
+
+  <p>If for some reason the Turkish bundle was encoded in ISO8859_3,
+  but the others locales in UTF8, you would write:</p>
   
 <pre class="prettyprint">
 @BaseName("colors")
@@ -227,7 +247,7 @@ colors_fr_FR.properties</pre>
   defaultCharset="UTF8",
   value = { @Locale("en_UK"),
             @Locale("fr_FR"),
-            @Locale(value="tr_TR", charset="ISO8859_3"),
+            <b>@Locale(value="tr_TR", charset="ISO8859_3"),</b>
             @Locale("el_GR")
            }
    )
@@ -251,7 +271,7 @@ public enum Colors {
   <p>If both <code>charset</code> and <code>defaultCharset</code> are
   empty, CAL10N will use the <a
   href="http://mindprod.com/jgloss/encoding.html">default encoding</a>
-  for your Java platform to read a resource bundle.</p>
+  for your Java platform to read resource bundles.</p>
 
 
 
@@ -364,7 +384,8 @@ public class MyColorVerificationTest {
 Key [BLEU] present in resource bundle named [colors] for locale [fr_FR] but absent \ 
    in enum type [ch.qos.cal10n.sample.Colors]</pre>
 
-  <h3>One test to rule them all</h3>
+  <h3><a name="singleTest" href="#ingleTest">One test to rule them
+  all</a></h3>
 
   <p>Instead of a separate unit test case for each locale, assuming
   you declared the locales in the enum type via the @LocaleData and
diff --git a/cal10n-site/src/site/pages/news.html b/cal10n-site/src/site/pages/news.html
index 6d7c640..c0637e2 100644
--- a/cal10n-site/src/site/pages/news.html
+++ b/cal10n-site/src/site/pages/news.html
@@ -27,6 +27,15 @@
     href="http://www.qos.ch/mailman/listinfo/cal10n-announce">cal10n-announce</a>
     mailing list.</p>
 
+
+    <hr width="80%" align="center" />
+ 
+    <h3>4th of September 2009 - Release of CAL10N version 0.7</h3>
+
+    <p>Added capability for reading bundles in any JVM supported
+    charset, rendering <em>native2ascii</em> superfluous.</p>
+
+
     <hr width="80%" align="center" />
  
     <h3>3rd of September 2009 - Release of CAL10N version 0.6.5</h3>
diff --git a/maven-cal10n-plugin/src/main/java/ch/qos/cal10n/plugins/VerifyMojo.java b/maven-cal10n-plugin/src/main/java/ch/qos/cal10n/plugins/VerifyMojo.java
index dd13ef2..0dd07a9 100644
--- a/maven-cal10n-plugin/src/main/java/ch/qos/cal10n/plugins/VerifyMojo.java
+++ b/maven-cal10n-plugin/src/main/java/ch/qos/cal10n/plugins/VerifyMojo.java
@@ -25,6 +25,7 @@ import java.io.File;
 import java.lang.reflect.Constructor;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
@@ -48,11 +49,6 @@ import ch.qos.cal10n.verifier.IMessageKeyVerifier;
  */
 public class VerifyMojo extends AbstractMojo {
 
-  final static String MISSING_LOCALE = Cal10nConstants.CODE_URL_PREFIX
-      + "#missingLocale";
-  final static String MISSING_ENUM_TYPES = Cal10nConstants.CODE_URL_PREFIX
-      + "#missingEnumType";
-
   /**
    * @parameter
    * @required
@@ -88,8 +84,7 @@ public class VerifyMojo extends AbstractMojo {
   public void execute() throws MojoExecutionException, MojoFailureException {
 
     if (enumTypes == null) {
-      throw new MojoFailureException("Missing <enumTypes> element. Please see "
-          + MISSING_ENUM_TYPES);
+      throw new MojoFailureException(Cal10nConstants.MISSING_ENUM_TYPES_MSG);
     }
     for (String enumTypeAsStr : enumTypes) {
       IMessageKeyVerifier imcv = getMessageKeyVerifierInstance(enumTypeAsStr);
@@ -109,8 +104,8 @@ public class VerifyMojo extends AbstractMojo {
     String[] localeNameArray = mcv.getLocaleNames();
 
     if (localeNameArray == null || localeNameArray.length == 0) {
-      String errMsg = "Missing @LocaleData annotation in enum type ["
-          + enumClassAsStr + "]. Please see "+MISSING_LOCALE;
+      String errMsg = MessageFormat.format(
+          Cal10nConstants.MISSING_LD_ANNOTATION_MESSAGE, enumClassAsStr);
       getLog().error(errMsg);
       throw new MojoFailureException(errMsg);
     }
@@ -145,8 +140,8 @@ public class VerifyMojo extends AbstractMojo {
     String errMsg = "Failed to instantiate MessageKeyVerifier class";
     try {
       ThisFirstClassLoader thisFirstClassLoader = (ThisFirstClassLoader) buildClassLoader();
-      Class<?> mkvClass = Class.forName(Cal10nConstants.MessageKeyVerifier_FQCN,
-          true, thisFirstClassLoader);
+      Class<?> mkvClass = Class.forName(
+          Cal10nConstants.MessageKeyVerifier_FQCN, true, thisFirstClassLoader);
       Constructor<?> mkvCons = mkvClass.getConstructor(String.class);
       IMessageKeyVerifier imcv = (IMessageKeyVerifier) mkvCons
           .newInstance(enumClassAsStr);

-----------------------------------------------------------------------

Summary of changes:
 .../main/java/ch/qos/cal10n/Cal10nConstants.java   |   18 +++++++++--
 .../ch/qos/cal10n/verifier/MessageKeyVerifier.java |    5 ++-
 .../cal10n/verifier/MessageKeyVerifierTest.java    |   16 ++++++++--
 cal10n-site/src/site/pages/codes.html              |   21 ++++++------
 cal10n-site/src/site/pages/index.html              |   16 +++++-----
 cal10n-site/src/site/pages/manual.html             |   33 ++++++++++++++++---
 cal10n-site/src/site/pages/news.html               |    9 +++++
 .../java/ch/qos/cal10n/plugins/VerifyMojo.java     |   17 +++------
 8 files changed, 92 insertions(+), 43 deletions(-)


hooks/post-receive
-- 
Compiler assisted localization library


More information about the cal10n-dev mailing list