--- /dev/null
+// vim: set expandtab tabstop=4 shiftwidth=4:
+
+#include "translate.h"
+#include <sstream>
+
+using std::stringstream;
+using namespace bife;
+
+#ifdef DEBUG
+#include <iostream>
+using std::cerr;
+using std::endl;
+#endif
+
+Translate::Translate(const string& name): Fallback(name) {
+#ifdef DEBUG
+ cerr << "In Translate::Translate(name = '" << name << "');" << endl;
+#endif
+}
+
+Translate::Translate(const string& name, const Hash& attrs): Fallback(name, attrs) {
+#ifdef DEBUG
+ cerr << "In Translate::Translate(name = '" << name
+ << "', attrs = {" /* TODO << attrs */ << "});" << endl;
+#endif
+}
+
+Translate::Translate(const string& name, const Hash& attrs, Widget& content):
+ Fallback(name, attrs, content) {
+ // FIXME - this->content.push_back(content);
+#ifdef DEBUG
+ cerr << "In Translate::Translate(name = '" << name
+ << "', attrs = {" /* TODO << attrs */
+ << "}, content = {" /* TODO << content */ << "});" << endl;
+#endif
+}
+
+Translate::Translate(const string& name, Widget& content, const Hash& attrs):
+ Fallback(name, content, attrs) {
+ // FIXME - this->content.push_back(content);
+#ifdef DEBUG
+ cerr << "In Translate::Translate(name = '" << name
+ << "', content = {" /* TODO << content */
+ << "}, attrs = {" /* TODO << attrs */ << "});" << endl;
+#endif
+}
+
+Translate::~Translate(void) {
+#ifdef DEBUG
+ cerr << "In Translate destructor." << endl;
+#endif
+}
+
+string Translate::render(HIT& tpl) {
+ stringstream out;
+ if (false /* TODO tpl.exists(name, '')*/) {
+ Hash a = attrs;
+ a["CONTENT"] = renderContent(tpl);
+ out << tpl.parse(name, attrs /* TODO ,"", "" */);
+ } else {
+ out << "<" << name;
+ for (Hash::iterator i = attrs.begin(); i != attrs.end(); i++) {
+ out << " " << i->first << "=\"" << i->second << "\"";
+ }
+ string c = renderContent(tpl);
+ if (c.empty()) {
+ out << " />";
+ } else {
+ out << ">" << c << "</" << name << ">";
+ }
+ }
+ return out.str();
+}
+
--- /dev/null
+// vim: set expandtab tabstop=4 shiftwidth=4:
+
+#ifndef BIFE_TRANSLATE_H
+#define BIFE_TRANSLATE_H
+
+#include "fallback.h"
+#include "widget.h"
+#include "hit.h"
+#include "hash.h"
+#include <vector>
+#include <string>
+
+namespace bife {
+
+ using std::string;
+
+ /**
+ * Base Translate Widget.
+ *
+ * @todo
+ */
+ class Translate: public Fallback {
+ // Methods.
+ public:
+ /**
+ * Constructor.
+ *
+ * @param name Name of the widget.
+ */
+ Translate(const string&);
+
+ /**
+ * Constructor.
+ *
+ * @param name Name of the widget.
+ * @param attrs Widget attributes.
+ */
+ Translate(const string&, const Hash&);
+
+ /**
+ * Constructor.
+ *
+ * @param name Name of the widget.
+ * @param attrs Widget attributes.
+ * @param content Content of the widget.
+ */
+ Translate(const string&, const Hash&, Widget&);
+
+ /**
+ * Constructor.
+ *
+ * @param name Name of the widget.
+ * @param content Content of the widget.
+ */
+ Translate(const string&, Widget&);
+
+ /**
+ * Constructor.
+ *
+ * @param name Name of the widget.
+ * @param content Content of the widget.
+ * @param attrs Widget attributes.
+ */
+ Translate(const string&, Widget&, const Hash&);
+
+ /**
+ * Destructor.
+ */
+ virtual ~Translate(void);
+
+ /**
+ * Renders the widget using a HIT template.
+ *
+ * @param hit HIT template to use to render de widget.
+ * @return Rendered widget.
+ */
+ virtual string render(HIT&);
+ };
+
+}
+
+#endif