diff --git a/src/klocalizedtranslator.rs b/src/klocalizedtranslator.rs index 0241184..f321602 100644 --- a/src/klocalizedtranslator.rs +++ b/src/klocalizedtranslator.rs @@ -1,4 +1,5 @@ use cpp::{cpp, cpp_class}; +use qttypes::QString; #[cfg(feature = "qmetaobject")] use qmetaobject::{QObject, QObjectPinned}; @@ -27,4 +28,25 @@ impl KLocalizedTranslator { return KLocalizedTranslatorHolder(obj_ptr); }) } + + /// Adds a context for which this Translator should be active. + pub fn add_context_to_monitor(&mut self, context: QString) { + cpp!(unsafe [self as "KLocalizedTranslatorHolder *", context as "QString"] { + self->translator->addContextToMonitor(context); + }); + } + + /// Stop translating for the given context. + pub fn remove_context_to_moitor(&mut self, context: QString) { + cpp!(unsafe [self as "KLocalizedTranslatorHolder *", context as "QString"] { + self->translator->removeContextToMonitor(context); + }); + } + + /// Sets the translationDomain to be used. + pub fn set_translation_domain(&mut self, translation_domain: QString) { + cpp!(unsafe [self as "KLocalizedTranslatorHolder *", translation_domain as "QString"] { + self->translator->setTranslationDomain(translation_domain); + }); + } }