[Yanel-commits] rev 20570 - in public/yanel/trunk/src/contributions/resources/nutch: . conf src/java/org/wyona/yanel/impl/resources xslt

josias at wyona.com josias at wyona.com
Tue Dec 5 10:38:34 CET 2006


Author: josias
Date: 2006-12-05 10:38:32 +0100 (Tue, 05 Dec 2006)
New Revision: 20570

Added:
   public/yanel/trunk/src/contributions/resources/nutch/conf/nutch_de.properties
   public/yanel/trunk/src/contributions/resources/nutch/conf/nutch_en.properties
Removed:
   public/yanel/trunk/src/contributions/resources/nutch/conf/messages_de.properties
   public/yanel/trunk/src/contributions/resources/nutch/conf/messages_en.properties
Modified:
   public/yanel/trunk/src/contributions/resources/nutch/build.xml
   public/yanel/trunk/src/contributions/resources/nutch/src/java/org/wyona/yanel/impl/resources/NutchResource.java
   public/yanel/trunk/src/contributions/resources/nutch/xslt/result2xhtml.xsl
Log:
bug #4761: i18n of nutch resource

Modified: public/yanel/trunk/src/contributions/resources/nutch/build.xml
===================================================================
--- public/yanel/trunk/src/contributions/resources/nutch/build.xml	2006-12-05 09:36:00 UTC (rev 20569)
+++ public/yanel/trunk/src/contributions/resources/nutch/build.xml	2006-12-05 09:38:32 UTC (rev 20570)
@@ -49,7 +49,7 @@
     <antcall target="copy-plugins"/>
     <copy file="conf/common-terms.utf8" todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes"/>
     <copy todir="${build.dir}/webapps/${servlet.context.prefix}/WEB-INF/classes">
-      <fileset dir="conf" includes="messages_*.properties"/>
+      <fileset dir="conf" includes="nutch_*.properties"/>
     </copy>
   </target>
 

Deleted: public/yanel/trunk/src/contributions/resources/nutch/conf/messages_de.properties
===================================================================
--- public/yanel/trunk/src/contributions/resources/nutch/conf/messages_de.properties	2006-12-05 09:36:00 UTC (rev 20569)
+++ public/yanel/trunk/src/contributions/resources/nutch/conf/messages_de.properties	2006-12-05 09:38:32 UTC (rev 20570)
@@ -1,32 +0,0 @@
-title = Abteilungen - Patente - Abteilung
-resultsForQuery = Suchergebnisse:
-searchFor = Suche nach ...
-results = Ergebnisse
-ofAbout = von
-for = von
-viewResultsAsXml = Ergebnisse als XML sehen
-yourSearch = Ihre Suche
-didNotMatchAnyDocuments = hat keine Ergebnisse ergeben.
-exception = Fehler:
-search = Suche
-hits = Treffer <b>{0}-{1}</b> (von insgesammt {2} gefundenen Seiten):
-pages = <b>{0}</b> von <b>{1}</b> Seiten
-cached = Im Cache
-explain = Erkl&auml;rung
-anchors = Referenzen
-next = Weiter
-previous = Zur&uuml;ck
-clustering = Clustern
-viewAsText = HTML-Version
-moreFrom = Mehr von
-showAllHits = Alle Treffer anzeigen
-branchMark = Sprungmarken
-contact = Kontakt
-closeWindow = fenster schliessen
-printPage = &uuml;bersicht drucken
-fileSystem = Dateisystem
-intranet = Intranet
-selectedInternet = Ausgew&auml;hlte Seiten
-internet = Internet
-hitsPerPage = Treffer pro Seite:
-noRefinements = Keine Verfeinerungen

Deleted: public/yanel/trunk/src/contributions/resources/nutch/conf/messages_en.properties
===================================================================
--- public/yanel/trunk/src/contributions/resources/nutch/conf/messages_en.properties	2006-12-05 09:36:00 UTC (rev 20569)
+++ public/yanel/trunk/src/contributions/resources/nutch/conf/messages_en.properties	2006-12-05 09:38:32 UTC (rev 20570)
@@ -1,32 +0,0 @@
-title = Departments - Patents - Department
-resultsForQuery = Results for query:
-searchFor = Search for ...
-results = Results
-ofAbout = of about
-for = for
-viewResultsAsXml = View results as XML
-yourSearch = Your search
-didNotMatchAnyDocuments = did not match any documents.
-exception = Exception:
-search = Search
-hits = hits <b>{0}-{1}</b> (von insgesammt {2} gefundenen Seiten):
-pages = pages
-cached = cached
-explain = explain
-anchors = anchors
-next = next
-previous = back
-clustering = clustering
-viewAsText = view as plain text
-moreFrom = more from
-showAllHits = show all hits
-branchMark = brach mark
-contact = contact
-closeWindow = close window
-printPage = print page
-fileSystem = file system
-intranet = intranet
-selectedInternet = selected internet
-internet = internet
-hitsPerPage = Hits Per Page:
-noRefinements = no refinements

Copied: public/yanel/trunk/src/contributions/resources/nutch/conf/nutch_de.properties (from rev 20566, public/yanel/trunk/src/contributions/resources/nutch/conf/messages_de.properties)

Copied: public/yanel/trunk/src/contributions/resources/nutch/conf/nutch_en.properties (from rev 20566, public/yanel/trunk/src/contributions/resources/nutch/conf/messages_en.properties)

Modified: public/yanel/trunk/src/contributions/resources/nutch/src/java/org/wyona/yanel/impl/resources/NutchResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/nutch/src/java/org/wyona/yanel/impl/resources/NutchResource.java	2006-12-05 09:36:00 UTC (rev 20569)
+++ public/yanel/trunk/src/contributions/resources/nutch/src/java/org/wyona/yanel/impl/resources/NutchResource.java	2006-12-05 09:38:32 UTC (rev 20570)
@@ -215,8 +215,12 @@
         // Generate InputStream from DOM document
         try {
             Transformer transformer = null;
+            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
             if (viewId != null && viewId.equals("source")) {
                 transformer = TransformerFactory.newInstance().newTransformer();
+                transformer.transform(new javax.xml.transform.dom.DOMSource(document), new StreamResult(byteArrayOutputStream));
+                return new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
+                
             } else {
                 File xsltFile = org.wyona.commons.io.FileUtil.file(rtd.getConfigFile().getParentFile().getAbsolutePath(), "xslt" + File.separator + "result2xhtml.xsl");
                 transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(xsltFile));
@@ -224,29 +228,31 @@
                 transformer.setParameter("yanel.path", path.toString());
                 transformer.setParameter("yanel.back2context", backToRoot(path, ""));
                 transformer.setParameter("yarep.back2realm", backToRoot(new org.wyona.yanel.core.Path(rp.getPath().toString()), ""));
+                
+                
+                transformer.transform(new javax.xml.transform.dom.DOMSource(document), new StreamResult(byteArrayOutputStream));
+                
+                InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
+                I18nTransformer i18nTransformer = new I18nTransformer(messages, language);
+                SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
+                saxParser.parse(inputStream, i18nTransformer);
+                
+                transformer = TransformerFactory.newInstance().newTransformer(getXSLTStreamSource(path, repository));
+                transformer.setParameter("yanel.path.name", path.getName());
+                transformer.setParameter("yanel.path", path.toString());
+                transformer.setParameter("yanel.back2context", backToRoot(path, ""));
+                transformer.setParameter("yarep.back2realm", backToRoot(new org.wyona.yanel.core.Path(rp.getPath().toString()), ""));
+                byteArrayOutputStream = new ByteArrayOutputStream();
+                transformer.transform(new StreamSource(i18nTransformer.getInputStream()), new StreamResult(byteArrayOutputStream));
+     
+                inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
+                i18nTransformer = new I18nTransformer("global", language);
+                saxParser = SAXParserFactory.newInstance().newSAXParser();
+                saxParser.parse(inputStream, i18nTransformer);
+                
+                return i18nTransformer.getInputStream();
             }
-            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
-            transformer.transform(new javax.xml.transform.dom.DOMSource(document), new StreamResult(byteArrayOutputStream));
             
-            InputStream inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
-            I18nTransformer i18nTransformer = new I18nTransformer(messages, language);
-            SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser();
-            saxParser.parse(inputStream, i18nTransformer);
-            
-            transformer = TransformerFactory.newInstance().newTransformer(getXSLTStreamSource(path, repository));
-            transformer.setParameter("yanel.path.name", path.getName());
-            transformer.setParameter("yanel.path", path.toString());
-            transformer.setParameter("yanel.back2context", backToRoot(path, ""));
-            transformer.setParameter("yarep.back2realm", backToRoot(new org.wyona.yanel.core.Path(rp.getPath().toString()), ""));
-            byteArrayOutputStream = new ByteArrayOutputStream();
-            transformer.transform(new StreamSource(i18nTransformer.getInputStream()), new StreamResult(byteArrayOutputStream));
- 
-            inputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
-            i18nTransformer = new I18nTransformer("global", language);
-            saxParser = SAXParserFactory.newInstance().newSAXParser();
-            saxParser.parse(inputStream, i18nTransformer);
-            
-            return i18nTransformer.getInputStream();
         } catch (Exception e) {
             log.error(e.getMessage(), e);
         }

Modified: public/yanel/trunk/src/contributions/resources/nutch/xslt/result2xhtml.xsl
===================================================================
--- public/yanel/trunk/src/contributions/resources/nutch/xslt/result2xhtml.xsl	2006-12-05 09:36:00 UTC (rev 20569)
+++ public/yanel/trunk/src/contributions/resources/nutch/xslt/result2xhtml.xsl	2006-12-05 09:38:32 UTC (rev 20570)
@@ -205,7 +205,10 @@
   
   <xsl:template match="yanel:exception">
     <p>
-       <div style="color: red; font-size: 24px;"><i18n:message key="exception"/></div> <xsl:value-of select="."/>
+       <div style="color: red; font-size: 24px;"><i18n:message key="exception"/></div> 
+       <xsl:variable name="message"><xsl:value-of select="substring-before(string(.), '#')"/></xsl:variable>
+       <xsl:variable name="directory"><xsl:value-of select="substring-after(string(.), '#')"/></xsl:variable>
+       <i18n:message key="{$message}"/><xsl:value-of select="$directory"/>
     </p>
   </xsl:template>
 




More information about the Yanel-commits mailing list