From 80c02740d0a99df96fa40e3f3d5bad4ea2e0e2ae Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 22 Sep 2013 11:25:11 -0400 Subject: Translate listformatter properly --- src/misc.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/misc.cpp') diff --git a/src/misc.cpp b/src/misc.cpp index fe0c49158..8e202aca6 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -121,6 +121,10 @@ bool NumberList::InvalidRange(const Anope::string &) return true; } +ListFormatter::ListFormatter(NickCore *acc) : nc(acc) +{ +} + ListFormatter &ListFormatter::AddColumn(const Anope::string &name) { this->columns.push_back(name); @@ -139,10 +143,14 @@ bool ListFormatter::IsEmpty() const void ListFormatter::Process(std::vector &buffer) { + std::vector tcolumns; std::map lenghts; std::set breaks; for (unsigned i = 0; i < this->columns.size(); ++i) - lenghts[this->columns[i]] = this->columns[i].length(); + { + tcolumns.push_back(Language::Translate(this->nc, this->columns[i].c_str())); + lenghts[this->columns[i]] = tcolumns[i].length(); + } for (unsigned i = 0; i < this->entries.size(); ++i) { ListEntry &e = this->entries[i]; @@ -176,9 +184,9 @@ void ListFormatter::Process(std::vector &buffer) } else if (!s.empty()) s += " "; - s += this->columns[i]; - if (i + 1 != this->columns.size()) - for (unsigned j = this->columns[i].length(); j < lenghts[this->columns[i]]; ++j) + s += tcolumns[i]; + if (i + 1 != this->columns.size()) + for (unsigned j = tcolumns[i].length(); j < lenghts[this->columns[i]]; ++j) s += " "; } buffer.push_back(s); -- cgit