[sword-cvs] jsword-old/src/org/crosswire/web/i18n ContextStart.java,NONE,1.1 Translate.java,NONE,1.1
sword@www.crosswire.org
sword@www.crosswire.org
Tue, 25 Feb 2003 05:08:41 -0700
Update of /usr/local/cvsroot/jsword-old/src/org/crosswire/web/i18n
In directory www:/tmp/cvs-serv12888/src/org/crosswire/web/i18n
Added Files:
ContextStart.java Translate.java
Log Message:
--- NEW FILE: ContextStart.java ---
package org.crosswire.web.i18n;
import javax.servlet.jsp.tagext.TagSupport;
public class ContextStart extends TagSupport {
public ContextStart() {
}
}
--- NEW FILE: Translate.java ---
package org.crosswire.web.i18n;
import javax.servlet.jsp.tagext.BodyTagSupport;
import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.io.StringWriter;
public class Translate extends BodyTagSupport {
public Translate() {
}
public int doAfterBody() {
String body = bodyContent.getString();
HttpSession session = pageContext.getSession();
HashMap tmap = (HashMap) session.getAttribute("i18n.transmap");
if (tmap != null) {
String tVal = (String)tmap.get(body);
if (tVal != null) {
if (tVal.length() > 0) {
try {
bodyContent.clearBody();
bodyContent.write(tVal);
}
catch (Exception e) {}
}
}
}
return 0;
}
}