diff options
Diffstat (limited to 'coding/transliteration.cpp')
-rw-r--r-- | coding/transliteration.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/coding/transliteration.cpp b/coding/transliteration.cpp index 717b90a4f7..c75839b3e9 100644 --- a/coding/transliteration.cpp +++ b/coding/transliteration.cpp @@ -12,7 +12,6 @@ #include "std/unique_ptr.hpp" -#include <atomic> #include <cstring> #include <mutex> @@ -27,6 +26,10 @@ struct Transliteration::TransliteratorInfo std::unique_ptr<Transliterator> m_transliterator; }; +Transliteration::Transliteration() + : m_enabled(true) +{} + Transliteration::~Transliteration() { // The use of u_cleanup() just before an application terminates is optional, @@ -59,8 +62,16 @@ void Transliteration::Init(std::string const & icuDataDir) } } +void Transliteration::SetEnabled(bool enable) +{ + m_enabled = enable; +} + bool Transliteration::Transliterate(std::string const & str, int8_t langCode, std::string & out) const { + if (!m_enabled) + return false; + if (str.empty() || strings::IsASCIIString(str)) return false; |