Author: aheritier
Date: Sat Sep  3 13:45:41 2005
New Revision: 267494

URL: http://svn.apache.org/viewcvs?rev=267494&view=rev
Log:
MPXDOC-131 : allow i18n links.
Patch submitted by : Ignacio G. Mac Dowell
Patch reviewed by : Arnaud Heritier

Modified:
    maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/site.jsl
    
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test03/xdocs/xdocs.properties
    
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test03/xdocs/xdocs_fr.properties
    
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/myfile_i18n.xml
    
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/xdocs.properties
    
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/xdocs_fr.properties
    maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml
    maven/maven-1/plugins/trunk/xdoc/xdocs/i18n.xml

Modified: maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/site.jsl
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/site.jsl?rev=267494&r1=267493&r2=267494&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/site.jsl (original)
+++ maven/maven-1/plugins/trunk/xdoc/src/plugin-resources/site.jsl Sat Sep  3 
13:45:41 2005
@@ -3,7 +3,7 @@
 <!--
  * ========================================================================
  * 
- * Copyright 2005 The Apache Software Foundation.
+ * Copyright 2001-2005 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -514,9 +514,30 @@
     <x:element name="a" trim="true">
       <x:forEach var="attr" select="@*">
         <j:choose>
-          <j:when test="${attr.name == 'href'}">
-            <j:set var="href" value="${attr.value}" />
-            <j:choose>                 
+          <j:set var="attr_name" value="${attr.name}"/>
+          <j:set var="attr_value" value="${attr.value}"/>
+          <j:if test="${attr_name == 'hrefkey'}">
+            <j:set var="_bundle">
+              <x:expr select="@bundle" />
+            </j:set>
+            <j:if test="${!empty(attr_value)}">
+              <!-- If there is hrefkey, then change attr_name to href -->
+              <!-- and attr_value to the formatted message -->
+              <j:set var="attr_name" value="href"/>
+              <!-- Default bundle is the user one in ${maven.xdoc.bundle} -->
+              <j:if test="${empty(_bundle)}">
+                <fmt:message key="${attr_value}" bundle="${myMsg}" 
var="attr_value"/>
+              </j:if>
+              <j:if test="${!empty(_bundle)}">
+                <fmt:bundle basename="${_bundle}">
+                  <fmt:message key="${attr_value}" var="attr_value"/>
+                </fmt:bundle>
+              </j:if>
+            </j:if>
+          </j:if>
+          <j:when test="${attr_name == 'href'}">
+            <j:set var="href" value="${attr_value}" />
+            <j:choose>
               <j:when test="${href.startsWith('#')}">
                 <x:attribute name="href">
                   <doc:escapeNameToken value="${href}"/>
@@ -526,27 +547,28 @@
                 <x:attribute name="href">${href}</x:attribute>
                 <x:attribute name="class">externalLink</x:attribute>
                 <x:attribute name="title">External Link</x:attribute>
-              </j:when>                  
+              </j:when>
               <j:otherwise>
                 <x:attribute name="href">${href}</x:attribute>
               </j:otherwise>
             </j:choose>
           </j:when>
-          <j:when test="${attr.name == 'target'}">
-            <j:set var="target">${attr.value}</j:set>
+          <j:when test="${attr_name == 'target'}">
+            <j:set var="target">${attr_value}</j:set>
             <j:if test="${!empty(target) and target.equals('_blank')}">
               <x:attribute name="class">newWindow</x:attribute>
               <x:attribute name="title">New Window</x:attribute>
-            </j:if>              
+            </j:if>
             <x:attribute name="target">${target}</x:attribute>
           </j:when>
-          <j:when test="${attr.name == 'name'}">
+          <j:when test="${attr_name == 'name'}">
             <x:attribute name="name">
-              <doc:escapeNameToken value="${attr.value}"/>
+              <doc:escapeNameToken value="${attr_value}"/>
             </x:attribute>
           </j:when>
+          <j:when test="${attr.name == 'bundle'}"/>
           <j:otherwise>
-            <x:attribute name="${attr.name}">${attr.value}</x:attribute>
+            <x:attribute name="${attr_name}">${attr_value}</x:attribute>
           </j:otherwise>
         </j:choose>
       </x:forEach>

Modified: 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test03/xdocs/xdocs.properties
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test03/xdocs/xdocs.properties?rev=267494&r1=267493&r2=267494&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test03/xdocs/xdocs.properties 
(original)
+++ 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test03/xdocs/xdocs.properties 
Sat Sep  3 13:45:41 2005
@@ -16,3 +16,6 @@
 testjstltosite.section1.title=Title 1
 testjstltosite.section1.description1=empty document
 testjstltosite.section1.description2=This document is generated separately 
from other xdoc documents but should retain the site stylesheet and navigation.
+
+testlinks.mysite1=http://mysite1.com
+testlinks.mysite2=http://mysite2.com

Modified: 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test03/xdocs/xdocs_fr.properties
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test03/xdocs/xdocs_fr.properties?rev=267494&r1=267493&r2=267494&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test03/xdocs/xdocs_fr.properties
 (original)
+++ 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test03/xdocs/xdocs_fr.properties
 Sat Sep  3 13:45:41 2005
@@ -16,3 +16,6 @@
 testjstltosite.section1.title=Titre 1
 testjstltosite.section1.description1=document vide
 testjstltosite.section1.description2=Ce document est produit séparément des 
autres documents XDOC mais devrait maintenir le stylesheet et la navigation 
d'emplacement.
+
+testlinks.mysite1=http://mysite1.fr
+testlinks.mysite2=http://mysite2.fr

Modified: 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/myfile_i18n.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/myfile_i18n.xml?rev=267494&r1=267493&r2=267494&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/myfile_i18n.xml 
(original)
+++ 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/myfile_i18n.xml 
Sat Sep  3 13:45:41 2005
@@ -26,11 +26,11 @@
     <body>
         <section key="myfile_i18n.section1.title">
             <p>
-                <message key="myfile_i18n.section1.description1"/>
+                <a hrefkey="testlinks.mysite1"><message 
key="myfile_i18n.section1.description1"/></a>
             </p>
             <p>
-                <message key="myfile_i18n.section1.description2"/>
+                <a hrefkey="testlinks.mysite2"><message 
key="myfile_i18n.section1.description2"/></a>
             </p>
         </section>
     </body>
-</document>
\ No newline at end of file
+</document>

Modified: 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/xdocs.properties
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/xdocs.properties?rev=267494&r1=267493&r2=267494&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/xdocs.properties 
(original)
+++ 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/xdocs.properties 
Sat Sep  3 13:45:41 2005
@@ -16,3 +16,6 @@
 testjstltosite.section1.title=Title 1
 testjstltosite.section1.description1=empty document
 testjstltosite.section1.description2=This document is generated separately 
from other xdoc documents but should retain the site stylesheet and navigation.
+
+testlinks.mysite1=http://mysite1.com
+testlinks.mysite2=http://mysite2.com

Modified: 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/xdocs_fr.properties
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/xdocs_fr.properties?rev=267494&r1=267493&r2=267494&view=diff
==============================================================================
--- 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/xdocs_fr.properties
 (original)
+++ 
maven/maven-1/plugins/trunk/xdoc/src/plugin-test/test04/xdocs/xdocs_fr.properties
 Sat Sep  3 13:45:41 2005
@@ -16,3 +16,6 @@
 testjstltosite.section1.title=Title 1
 testjstltosite.section1.description1=document vide
 testjstltosite.section1.description2=Ce document est produit séparément des 
autres documents XDOC mais devrait maintenir le stylesheet et la navigation 
d'emplacement.
+
+testlinks.mysite1=http://mysite1.fr
+testlinks.mysite2=http://mysite2.fr

Modified: maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml?rev=267494&r1=267493&r2=267494&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml (original)
+++ maven/maven-1/plugins/trunk/xdoc/xdocs/changes.xml Sat Sep  3 13:45:41 2005
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- 
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2005 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@
       <action dev="aheritier" type="fix" issue="MPXDOC-151">i18n : menu tag in 
xdoc does not work with "key" translated text id.</action>
       <action dev="aheritier" type="fix" issue="MPXDOC-147">Missing "Project 
Reports" header in the generated menu.</action>
       <action dev="vsiveton" type="fix" issue="MPXDOC-148" due-to="Incze 
Lajos">Fixed bundles expression.</action>
+      <action dev="aheritier" type="add" issue="MPXDOC-131" due-to="Ignacio G. 
Mac Dowell">Allow i18n links.</action>
     </release>
     <release version="1.9.1" date="2005-06-16">
       <action dev="brett" type="fix">Don't override the Maven library. This 
makes the plugin compatible with both Maven 1.0.2 and Maven 1.1</action>

Modified: maven/maven-1/plugins/trunk/xdoc/xdocs/i18n.xml
URL: 
http://svn.apache.org/viewcvs/maven/maven-1/plugins/trunk/xdoc/xdocs/i18n.xml?rev=267494&r1=267493&r2=267494&view=diff
==============================================================================
--- maven/maven-1/plugins/trunk/xdoc/xdocs/i18n.xml (original)
+++ maven/maven-1/plugins/trunk/xdoc/xdocs/i18n.xml Sat Sep  3 13:45:41 2005
@@ -1,5 +1,4 @@
 <?xml version="1.0"?>
-
 <!-- 
   /*
   * Copyright 2001-2005 The Apache Software Foundation.
@@ -17,13 +16,11 @@
   * limitations under the License.
   */
 -->
-
 <document>
   <properties>
     <title>About</title>
     <author email="[EMAIL PROTECTED]">Vincent Siveton</author>
   </properties>
-
   <body>
     <section name="Internationalization">
       <p>
@@ -122,7 +119,8 @@
 <title key="mykey"/>
 <message key="mykey"/> 
 <section key="mykey"/> 
-<subsection key="mykey"/>]]></source>
+<subsection key="mykey"/>
+<a hrefkey="myhrefkey">My i18n link</a>]]></source>
 
           NOTE: XDoc plugin always uses key if defined. For instance,
           this line of code:



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to