mitchmason / MultilingualAssistant

Apache License 2.0
1 stars 4 forks source link

Update PreMessageTranslate.js & postMessageTranslate.js #3

Closed lee-zhg closed 3 years ago

lee-zhg commented 3 years ago

Hi @mitchmason ,

I updated both PreMessageTranslate.js & postMessageTranslate.js for my project. They are working, but I customized slightly to fit my use case.

The main change was to store language in context variable "lang_id" through the chat session. I also loop all outputs to translate them all.

There were some hiding special characters in file PreMessageTranslate.js. They caused errors initially. I removed all of them except one. I tried many times and could not remove it permanently. Very odd.

Feel free to reuse the code changes if you think they offer value to other people.

Thank you for sharing the codes. They offered tremendous help to move my project to the right track and save a lot of times.