[cai18n-dev] [GIT] Compiler assisted internalization library branch, master, updated. v0.1-3-g2ce155f

added by portage for gitosis-gentoo git-noreply at pixie.qos.ch
Fri Aug 28 18:04:53 CEST 2009


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Compiler assisted internalization library".

The branch, master has been updated
       via  2ce155fac9190d5e05ca17063c78683985ffcdb6 (commit)
      from  1fec687141367be578aea7dfbdedae5fad92f8cb (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=cai18n.git;a=commit;h=2ce155fac9190d5e05ca17063c78683985ffcdb6
http://github.com/ceki/cai18n/commit/2ce155fac9190d5e05ca17063c78683985ffcdb6

commit 2ce155fac9190d5e05ca17063c78683985ffcdb6
Author: Ceki Gulcu <ceki at qos.ch>
Date:   Fri Aug 28 18:02:35 2009 +0200

    - same code better docs
    - preparing release 0.3

diff --git a/cai18n-api/pom.xml b/cai18n-api/pom.xml
index cfa7ce2..2b491f6 100644
--- a/cai18n-api/pom.xml
+++ b/cai18n-api/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <groupId>ch.qos.cai18n</groupId>
     <artifactId>cai18n-parent</artifactId>
-    <version>0.2</version>
+    <version>0.3</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/cai18n-api/src/main/java/ch/qos/cai18n/verifier/Cai18nError.java b/cai18n-api/src/main/java/ch/qos/cai18n/verifier/Cai18nError.java
index f75420b..a1b3b2a 100644
--- a/cai18n-api/src/main/java/ch/qos/cai18n/verifier/Cai18nError.java
+++ b/cai18n-api/src/main/java/ch/qos/cai18n/verifier/Cai18nError.java
@@ -75,7 +75,7 @@ public class Cai18nError {
   public String toString() {
     switch (errorType) {
     case MISSING_RBN_ANNOTATION:
-      return "Missing @ResourceBundleName annotation in enum class ["
+      return "Missing @ResourceBundleName annotation in enum type ["
           + enumClassName + "]";
       // case MISSING_LOCALE_NAMES_ANNOTATION:
       // return "Missing @LocaleNames annotation in enum class [" +
@@ -83,19 +83,19 @@ public class Cai18nError {
       // + "]";
     case FAILED_TO_FIND_RB:
       return "Failed to locate resource bundle [" + resouceBundleName
-          + "]for locale [" + locale + "] for enum class [" + enumClassName
+          + "]for locale [" + locale + "] for enum type [" + enumClassName
           + "]";
     case EMPTY_RB:
       return "Empty resource bundle named [" + resouceBundleName
           + "] for locale [" + locale + "]";
     case EMPTY_ENUM:
-      return "Empty enum class [" + enumClassName + "]";
+      return "Empty enum type [" + enumClassName + "]";
     case ABSENT_IN_ENUM:
       return "Code [" + code + "] present in resource bundle named ["
           + resouceBundleName + "] for locale [" + locale
-          + "] but absent in enum class [" + enumClassName + "]";
+          + "] but absent in enum type [" + enumClassName + "]";
     case ABSENT_IN_RB:
-      return "Code [" + code + "] present in enum class [" + enumClassName
+      return "Code [" + code + "] present in enum type [" + enumClassName
           + "] but absent in resource bundle named [" + resouceBundleName
           + "] for locale [" + locale + "]";
     default:
diff --git a/cai18n-api/src/test/java/ch/qos/cai18n/sample/MyColorVerificationTest.java b/cai18n-api/src/test/java/ch/qos/cai18n/sample/MyColorVerificationTest.java
index 7a3d5aa..12f94c2 100644
--- a/cai18n-api/src/test/java/ch/qos/cai18n/sample/MyColorVerificationTest.java
+++ b/cai18n-api/src/test/java/ch/qos/cai18n/sample/MyColorVerificationTest.java
@@ -39,6 +39,9 @@ public class MyColorVerificationTest {
   public void en_UK() {
     IMessageCodeVerifier mcv = new MessageCodeVerifier(Colors.class);
     List<Cai18nError> errorList = mcv.verify(Locale.UK);
+    for(Cai18nError error: errorList) {
+      System.out.println(error);
+    }
     assertEquals(0, errorList.size());
   }
 
@@ -46,6 +49,9 @@ public class MyColorVerificationTest {
   public void fr() {
     IMessageCodeVerifier mcv = new MessageCodeVerifier(Colors.class);
     List<Cai18nError> errorList = mcv.verify(Locale.FRANCE);
+    for(Cai18nError error: errorList) {
+      System.out.println(error);
+    }
     assertEquals(0, errorList.size());
   }
 }
diff --git a/cai18n-api/src/test/resources/colors_fr.properties b/cai18n-api/src/test/resources/colors_fr.properties
index 0ea9e8c..93c28bb 100644
--- a/cai18n-api/src/test/resources/colors_fr.properties
+++ b/cai18n-api/src/test/resources/colors_fr.properties
@@ -1,3 +1,3 @@
-BLUE=les violettes sont bleues
+BLEU=les violettes sont bleues
 RED=les roses sont rouges
 GREEN=les {0} sont verts
\ No newline at end of file
diff --git a/cai18n-site/pom.xml b/cai18n-site/pom.xml
index d664cfa..b9f03d3 100644
--- a/cai18n-site/pom.xml
+++ b/cai18n-site/pom.xml
@@ -5,7 +5,7 @@
   <parent>
     <groupId>ch.qos.cai18n</groupId>
     <artifactId>cai18n-parent</artifactId>
-    <version>0.2</version>
+    <version>0.3</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
diff --git a/cai18n-site/src/site/pages/manual.html b/cai18n-site/src/site/pages/manual.html
index a274a08..e882817 100644
--- a/cai18n-site/src/site/pages/manual.html
+++ b/cai18n-site/src/site/pages/manual.html
@@ -33,7 +33,7 @@
    ResourceBundles</a>.
    </p>
 
-   <h3>Acknowledgement</h3>
+   <h3>Acknowledgment</h3>
 
    <p>The original idea behind CAI18N is attributed to Takeshi Kondo. It
    consolidated into what it is today subsequent to a <a
@@ -56,7 +56,7 @@
 import ch.qos.cai18n.LocaleNames;
 import ch.qos.cai18n.ResourceBundleName;
 
- at ResourceBundleName("colors") // mandatory annonation
+ at ResourceBundleName("colors") // mandatory annotation
 @LocaleNames({"en_UK", "fr"}) // list of locale names used by
                               // verification tools
 public enum Colors  {
@@ -91,7 +91,7 @@ GREEN=les {0} sont verts</pre>
   
   <h2>Retrieving internationalized messages</h2>
 
-  <p>In your application, you would retreive the localized message as
+  <p>In your application, you would retrieve the localized message as
   follows: </p>
 
   <pre  class="prettyprint source">// obtain a message conveyor for France
@@ -140,6 +140,9 @@ public class MyColorVerificationTest {
   public void en_UK() {
     IMessageCodeVerifier mcv = new MessageCodeVerifier(Colors.class);
     List&lt;Cai18nError> errorList = mcv.verify(Locale.UK);
+    for(Cai18nError error: errorList) {
+      System.out.println(error);
+    }
     assertEquals(0, errorList.size());
   }
 
@@ -147,13 +150,42 @@ public class MyColorVerificationTest {
   public void fr() {
     IMessageCodeVerifier mcv = new MessageCodeVerifier(Colors.class);
     List&lt;Cai18nError> errorList = mcv.verify(Locale.FRANCE);
+    for(Cai18nError error: errorList) {
+      System.out.println(error);
+    }
     assertEquals(0, errorList.size());
   }
 } </pre>
 
-  <p>Instead of a unit test case for each locale, assuming you
-  declared the locales in the enum type via the @LocaleNames
-  annotation, you can verify all locales in one sweeping step.</p>
+  <p>The above unit tests start by creating a
+  <code>MessageCodeVerifier</code> instance associated with an enum
+  type, <code>Colors</code> in this case. The test proceeds to invoke
+  the <code>verify()</code> method passing a locale as an
+  argument. The <code>verify()</code> method returns the list of
+  errors, that is the list of discrepancies between the codes listed
+  in the enum type and the correspondign resource bundle. An empty
+  list will be returned if there are no errors.
+  </p>
+
+  <p>The unit test verifies that no errors have occured by asserting
+  that the size of the error list is zero.</p>
+
+  <p>Suppose the code "BLUE" was misspelled as "BLEU" in the
+  <em>colors_fr.properties</em> resource bundle. The unit test would
+  print the following list of errors and throw an
+  <code>AssertionError</code>.
+
+  </p>
+  <pre class="source">Code [BLUE] present in enum type [ch.qos.cai18n.sample.Colors] but absent in resource bundle \
+   named [colors] for locale [fr_FR]
+Code [BLEU] present in resource bundle named [colors] for locale [fr_FR] but absent \ 
+   in enum type [ch.qos.cai18n.sample.Colors]</pre>
+
+  <h3>One test to rule them all</h3>
+
+  <p>Instead of a separate unit test case for each locale, assuming
+  you declared the locales in the enum type via the @LocaleNames
+  annotation, you can verify all locales in one fell swoop.</p>
 
     <pre class="prettyprint source">
 package foo.aPackage;
@@ -176,6 +208,9 @@ public class MyAllInOneColorVerificationTest {
   public void all() {
     IMessageCodeVerifier mcv = new MessageCodeVerifier(Colors.class);
     List&lt;Cai18nError> errorList = mcv.verifyAllLocales();
+    for(Cai18nError error: errorList) {
+      System.out.println(error);
+    }
     assertEquals(0, errorList.size());
   }
 } </pre>
@@ -186,12 +221,13 @@ public class MyAllInOneColorVerificationTest {
   <p>The CAI18N project ships with a maven plugin designed to verify
   that the keys specified in a given enum type match those found in
   the corresponding resource bundles and for each locale. Our plugin
-  is unsuprisingly called <em>mvn-cai18n-plugin</em>.
+  is unsurprisingly called <em>mvn-cai18n-plugin</em>.
   </p>
 
-  <p><b>At this very early stage of the CAI18N project, you need to
-  install the <em>maven-cai18n-plugin</em> by running "maven install"
-  from the folder where you unpacked the CAI18N distribution.</b>
+  <p><b>Until the relevant artifacts are uploaded to the central maven
+  repository, you unfortunately need to install the
+  <em>maven-cai18n-plugin</em> manually by running "mvn install" from
+  the folder where you unpacked the CAI18N distribution.</b>
   </p>
 
   <p>Using <em>maven-cai18n-plugin</em> is pretty easy. To verify
@@ -230,7 +266,7 @@ public class MyAllInOneColorVerificationTest {
 
   <p>After you add the above snippet to the pom.xml file of your
   project, <em>maven-cai18n-plugin</em> will make sure that
-  your resource bundles and your enum type are in synhronized.
+  your resource bundles and your enum type are in synchronized.
   </p>
 
   <p>The plugin will iterate through every resource bundle for every
@@ -238,12 +274,50 @@ public class MyAllInOneColorVerificationTest {
   annotation.
   </p>
 
+  <h2>Eclipse plug-in</h2>
+  
+  <p>We are looking for volunteers willing to implement IDE support
+  for CAI18N.  Below is a litst of possible features of this IDE which
+  we think could have added value.
+  </p>
+
+  <ul>
+    <li><b>mismatch highlighting</b> 
+    <p>While editing a property file,
+    highlight any keys, a.k.a. message codes, that do not match the
+    keys defined in the corresponding enum type.</p>
+    </li>
+
+    
+    <li><b>auto-correction</b>
+      <p>The mismatch highlighting feature could be enhanced by making
+      correction suggestions. For example, if in the property file the
+      user misspells the key "red_elephant" as "red_elefant", by
+      measuring the <a
+      href="http://en.wikipedia.org/wiki/Levenshtein_distance">Levenshtein
+      distance</a> the plug-in could propose the nearest neighhbor of
+      "red_elefant" in the enum type, which should be "red_elephant"
+      with high probability.
+      </p>
+    </li>
+
+    <li>
+      <b>Skeleton generation</b>
+      <p>Given an enum type, generate the skeleton of the
+      corresponding resource bundle</p>
+    </li>
+  </ul>
+
+  
+  <p>If interested please contact the cai18n-dev mailing list.</p>
 
   <h2>Ant task</h2>
 
   <p>We are looking for volunteers to implement an Ant task to verify
-  resource bundles. If interested please contact the cai18n-dev
-  mailing list.</p>
+  resource bundles. The Ant task could be modeled after the
+  <em>maven-cai18n-plugin</em> altough the Ant plugin is likely to be
+  simpler. If interested please contact the cai18n-dev mailing
+  list.</p>
 
   <script src="templates/footer.js" type="text/javascript"></script>
 </div>
diff --git a/maven-cai18n-plugin-smoke/pom.xml b/maven-cai18n-plugin-smoke/pom.xml
index 0a3b491..3d6cfac 100644
--- a/maven-cai18n-plugin-smoke/pom.xml
+++ b/maven-cai18n-plugin-smoke/pom.xml
@@ -4,7 +4,7 @@
 	<parent>
 		<groupId>ch.qos.cai18n</groupId>
 		<artifactId>cai18n-parent</artifactId>
-		<version>0.2</version>
+		<version>0.3</version>
 	</parent>
 
 	<modelVersion>4.0.0</modelVersion>
diff --git a/maven-cai18n-plugin/pom.xml b/maven-cai18n-plugin/pom.xml
index 9bfcff9..7bfbd12 100644
--- a/maven-cai18n-plugin/pom.xml
+++ b/maven-cai18n-plugin/pom.xml
@@ -8,7 +8,7 @@
   <parent>
     <artifactId>cai18n-parent</artifactId>
     <groupId>ch.qos.cai18n</groupId>
-    <version>0.2</version>
+    <version>0.3</version>
   </parent>
 
   <groupId>ch.qos.cai18n.plugins</groupId>
diff --git a/pom.xml b/pom.xml
index 9b5103b..6068ef0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
   <groupId>ch.qos.cai18n</groupId>
   <artifactId>cai18n-parent</artifactId>
 	<packaging>pom</packaging>
-  <version>0.2</version>
+  <version>0.3</version>
   <name>Compiler assisted internationalization library (CAI18N) - Parent</name>
 
   <url>http://cai18n.qos.ch</url>

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

Summary of changes:
 cai18n-api/pom.xml                                 |    2 +-
 .../java/ch/qos/cai18n/verifier/Cai18nError.java   |   10 +-
 .../qos/cai18n/sample/MyColorVerificationTest.java |    6 +
 cai18n-api/src/test/resources/colors_fr.properties |    2 +-
 cai18n-site/pom.xml                                |    2 +-
 cai18n-site/src/site/pages/manual.html             |  100 +++++++++++++++++---
 maven-cai18n-plugin-smoke/pom.xml                  |    2 +-
 maven-cai18n-plugin/pom.xml                        |    2 +-
 pom.xml                                            |    2 +-
 9 files changed, 104 insertions(+), 24 deletions(-)


hooks/post-receive
-- 
Compiler assisted internalization library



More information about the cal10n-dev mailing list