Openfire Extention

I have a senario like this :

I use openfire as server. And i want to use strophe as client. The problem is i need to translate the test. For example if user send “hello how are you” and translation language from eng - ru i have to write to database as “privet kak dela”. How can i do this? I there any easy way ?

Thanks.