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; } }