From: Alan Humpherys <alangh@us...> - 2003-03-20 21:31:52
I just checked in an update to automatic message translation which has
two main features:
1) Fixed bugs in translation of sent messages:
- Had from and to languages reversed
- The translated message was not transmitted, only displayed
2) Made the translation non-blocking
- A separate thread was created which handles all translations
- NSURLHandle couldn't be used because it doesn't handle HTTP POST
- All translation requests are handled serially so that translated
messages come out in the same order in which they are received.
While making this change, I moved the translation method out of
NSStringAdditions and into a separate class called TranslationEngine.
This class runs in its own thread and merely waits for the
TranslationController to send it a message to translate, and when the
translation is finished, the engine performs a callback to
TranslationController with the translated string. In the meantime,
TranslationController is queueing all requests and is responsible for
sending the next request to the TranslationEngine when the current one
I also took advantage of this time to clarify some of the error
messages involved in translation.
There may still be some problems when translating from non-Latin
languages (Chinese, Japanese, Korean, Greek) but I will get those fixed
By the way, it was this desire to make translation non-blocking which
started me on the crusade which resulted in MessageItem...