Author: saces
Date: 2007-11-23 13:55:39 +0000 (Fri, 23 Nov 2007)
New Revision: 15942

Modified:
   trunk/apps/Echo/src/plugins/echo/Echo.java
   trunk/apps/Echo/src/plugins/echo/editor/StaticPage.java
   trunk/apps/Echo/src/plugins/echo/i18n/I18n.java
Log:
may fix the i18n

Modified: trunk/apps/Echo/src/plugins/echo/Echo.java
===================================================================
--- trunk/apps/Echo/src/plugins/echo/Echo.java  2007-11-23 13:52:08 UTC (rev 
15941)
+++ trunk/apps/Echo/src/plugins/echo/Echo.java  2007-11-23 13:55:39 UTC (rev 
15942)
@@ -82,9 +82,9 @@
 
                        parser = new Builder();
                        
-                       Document styleSheet = 
parser.build(getClass().getResourceAsStream("/xml/edit.xsl"));
+                       Document styleSheet = 
parser.build(Echo.class.getClassLoader().getResourceAsStream("/xml/edit.xsl"));
 
-                       i18n.translateXML(styleSheet);
+                       I18n.translateXML(styleSheet);
                        transform = new XSLTransform(styleSheet);
 
                        projectManager = new ProjectManager(BASE_DIR, 
respirator.getNode().random);
@@ -176,7 +176,7 @@
        public String handleHTTPGet(HTTPRequest request) throws 
PluginHTTPException {
 
                if ("/plugins/plugins.echo.Echo".equals(request.getPath()))
-                       throw new RedirectPluginHTTPException("", 
"/plugins/plugins.echo.Echo", "/plugins/plugins.echo.Echo/");
+                       throw new RedirectPluginHTTPException("", 
"/plugins/plugins.echo.Echo/");
                        
                String fileName = (new File(request.getPath())).getName();
                

Modified: trunk/apps/Echo/src/plugins/echo/editor/StaticPage.java
===================================================================
--- trunk/apps/Echo/src/plugins/echo/editor/StaticPage.java     2007-11-23 
13:52:08 UTC (rev 15941)
+++ trunk/apps/Echo/src/plugins/echo/editor/StaticPage.java     2007-11-23 
13:55:39 UTC (rev 15942)
@@ -1,5 +1,6 @@
 package plugins.echo.editor;
 
+import plugins.echo.Echo;
 import plugins.echo.i18n.I18n;
 import freenet.support.api.HTTPRequest;
 
@@ -30,7 +31,7 @@
                
                try {
                        Builder parser = new Builder();
-                       Document doc = 
parser.build(page.getClass().getResourceAsStream("/xml/" + fileName));
+                       Document doc = 
parser.build(Echo.class.getClassLoader().getResourceAsStream("/xml/" + 
fileName));
 
                        I18n.translateXML(doc);
                        page.appendContent(doc.getRootElement().copy());

Modified: trunk/apps/Echo/src/plugins/echo/i18n/I18n.java
===================================================================
--- trunk/apps/Echo/src/plugins/echo/i18n/I18n.java     2007-11-23 13:52:08 UTC 
(rev 15941)
+++ trunk/apps/Echo/src/plugins/echo/i18n/I18n.java     2007-11-23 13:55:39 UTC 
(rev 15942)
@@ -5,14 +5,11 @@
 import java.util.Properties;
 
 import java.util.MissingResourceException;
-import java.io.IOException;
-
-import nu.xom.Nodes;
 import nu.xom.Element;
 import nu.xom.Text;
 import nu.xom.Document;
 
-import java.io.*; // FIXME
+import plugins.echo.Echo;
 
 /**
 *      This class provides a trivial internationalization framework
@@ -21,7 +18,7 @@
        
        public static final String[] AVAILABLE_LANGUAGES = { "en", "fr" };
        public static final String DEFAULT_LANGUAGE = "en"; 
-       public static final String PREFIX = "echo.i18n.";
+       public static final String PREFIX = "/i18n/echo.i18n.";
        public static final String SUFFIX = ".properties";
        
        private static String selectedLanguage;
@@ -59,8 +56,10 @@
                if(props == null)
                        props = new Properties();
                try {
-                       
props.load(INSTANCE.getClass().getResourceAsStream(PREFIX + language + SUFFIX));
-               } catch (IOException ioe) {
+                       
//props.load(INSTANCE.getClass().getResourceAsStream(PREFIX + language + 
SUFFIX));
+                       
props.load(Echo.class.getClassLoader().getResourceAsStream(PREFIX + language + 
SUFFIX));
+                       
//props.load(I18n.class.getClassLoader().getResourceAsStream(PREFIX + language 
+ SUFFIX));
+               } catch (Exception ioe) {
                        Logger.error("I18n", "IOException while accessing the " 
+ language +"file" + ioe.getMessage(), ioe);
                        throw new MissingResourceException("Unable to load the 
translation file for " + language, "i18n", language);
                }

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to