// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include <config.h>
#include <sys/types.h>
#include <iconv.h>
#include <errno.h>
#include "tinygettext.h"
+//#define TRANSLATION_DEBUG
+
namespace TinyGetText {
/** Convert \a which is in \a from_charset to \a to_charset and return it */
Dictionary& dict = dictionaries[lang];
dict.set_language(get_language_def(lang));
+ if(charset != "")
+ dict.set_charset(charset);
for (SearchPath::iterator p = search_path.begin(); p != search_path.end(); ++p)
{
}
void
+DictionaryManager::set_charset(const std::string& charset)
+{
+ dictionaries.clear(); // changing charset invalidates cache
+ this->charset = charset;
+ set_language(language);
+}
+
+void
DictionaryManager::set_language_alias(const std::string& alias,
const std::string& language)
{
void
DictionaryManager::add_directory(const std::string& pathname)
{
+ dictionaries.clear(); // adding directories invalidates cache
search_path.push_back(pathname);
- // cache is outdated now
- dictionaries.clear();
set_language(language);
}
}
else
{
+#ifdef TRANSLATION_DEBUG
std::cerr << "Warning: Couldn't translate: " << msgid << std::endl;
std::cerr << "Candidates: " << std::endl;
for (PluralEntries::iterator i = plural_entries.begin(); i != plural_entries.end(); ++i)
std::cout << "'" << i->first << "'" << std::endl;
+#endif
if (plural2_1(num)) // default to english rules
return msgid2;
}
else
{
+#ifdef TRANSLATION_DBEUG
std::cout << "Error: Couldn't translate: " << msgid << std::endl;
+#endif
return msgid;
}
}