aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/lllineeditor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llui/lllineeditor.cpp')
-rw-r--r--linden/indra/llui/lllineeditor.cpp67
1 files changed, 28 insertions, 39 deletions
diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp
index b3da7fd..4581ec7 100644
--- a/linden/indra/llui/lllineeditor.cpp
+++ b/linden/indra/llui/lllineeditor.cpp
@@ -231,38 +231,22 @@ LLLineEditor::LLLineEditor(const std::string& name, const LLRect& rect,
231 menu->appendSeparator("Transep"); 231 menu->appendSeparator("Transep");
232 LLMenuGL* translatemenu = new LLMenuGL("Translate To"); 232 LLMenuGL* translatemenu = new LLMenuGL("Translate To");
233 translatemenu->setCanTearOff(FALSE); 233 translatemenu->setCanTearOff(FALSE);
234 SpellMenuBind* t=new SpellMenuBind;t->origin=this;t->word="en"; 234 translatemenu->append(new LLMenuItemCallGL("en", "English", context_translate, context_enable_translate, this));
235 translatemenu->append(new LLMenuItemCallGL("English", context_translate, context_enable_translate, t)); 235 translatemenu->append(new LLMenuItemCallGL("da", "Danish", context_translate, context_enable_translate, this));
236 t=new SpellMenuBind;t->origin=this;t->word="da"; 236 translatemenu->append(new LLMenuItemCallGL("de", "Deutsch(German)", context_translate, context_enable_translate, this));
237 translatemenu->append(new LLMenuItemCallGL("Danish", context_translate, context_enable_translate, t)); 237 translatemenu->append(new LLMenuItemCallGL("es", "Spanish", context_translate, context_enable_translate, this));
238 t=new SpellMenuBind;t->origin=this;t->word="de"; 238 translatemenu->append(new LLMenuItemCallGL("fr", "French", context_translate, context_enable_translate, this));
239 translatemenu->append(new LLMenuItemCallGL("Deutsch(German)", context_translate, context_enable_translate, t)); 239 translatemenu->append(new LLMenuItemCallGL("it", "Italian", context_translate, context_enable_translate, this));
240 t=new SpellMenuBind;t->origin=this;t->word="es"; 240 translatemenu->append(new LLMenuItemCallGL("hu", "Hungarian", context_translate, context_enable_translate, this));
241 translatemenu->append(new LLMenuItemCallGL("Spanish", context_translate, context_enable_translate, t)); 241 translatemenu->append(new LLMenuItemCallGL("nl", "Dutch", context_translate, context_enable_translate, this));
242 t=new SpellMenuBind;t->origin=this;t->word="fr"; 242 translatemenu->append(new LLMenuItemCallGL("pl", "Polish", context_translate, context_enable_translate, this));
243 translatemenu->append(new LLMenuItemCallGL("French", context_translate, context_enable_translate, t)); 243 translatemenu->append(new LLMenuItemCallGL("pt", "Portugese", context_translate, context_enable_translate, this));
244 t=new SpellMenuBind;t->origin=this;t->word="it"; 244 translatemenu->append(new LLMenuItemCallGL("ru", "Russian", context_translate, context_enable_translate, this));
245 translatemenu->append(new LLMenuItemCallGL("Italian", context_translate, context_enable_translate, t)); 245 translatemenu->append(new LLMenuItemCallGL("tr", "Turkish", context_translate, context_enable_translate, this));
246 t=new SpellMenuBind;t->origin=this;t->word="hu"; 246 translatemenu->append(new LLMenuItemCallGL("uk", "Ukrainian", context_translate, context_enable_translate, this));
247 translatemenu->append(new LLMenuItemCallGL("Hungarian", context_translate, context_enable_translate, t)); 247 translatemenu->append(new LLMenuItemCallGL("zh", "Chinese", context_translate, context_enable_translate, this));
248 t=new SpellMenuBind;t->origin=this;t->word="nl"; 248 translatemenu->append(new LLMenuItemCallGL("ja", "Japanese", context_translate, context_enable_translate, this));
249 translatemenu->append(new LLMenuItemCallGL("Dutch", context_translate, context_enable_translate, t)); 249 translatemenu->append(new LLMenuItemCallGL("ko", "Korean", context_translate, context_enable_translate, this));
250 t=new SpellMenuBind;t->origin=this;t->word="pl";
251 translatemenu->append(new LLMenuItemCallGL("Polish", context_translate, context_enable_translate, t));
252 t=new SpellMenuBind;t->origin=this;t->word="pt";
253 translatemenu->append(new LLMenuItemCallGL("Portugese", context_translate, context_enable_translate, t));
254 t=new SpellMenuBind;t->origin=this;t->word="ru";
255 translatemenu->append(new LLMenuItemCallGL("Russian", context_translate, context_enable_translate, t));
256 t=new SpellMenuBind;t->origin=this;t->word="tr";
257 translatemenu->append(new LLMenuItemCallGL("Turkish", context_translate, context_enable_translate, t));
258 t=new SpellMenuBind;t->origin=this;t->word="uk";
259 translatemenu->append(new LLMenuItemCallGL("Ukrainian", context_translate, context_enable_translate, t));
260 t=new SpellMenuBind;t->origin=this;t->word="zh";
261 translatemenu->append(new LLMenuItemCallGL("Chinese", context_translate, context_enable_translate, t));
262 t=new SpellMenuBind;t->origin=this;t->word="ja";
263 translatemenu->append(new LLMenuItemCallGL("Japanese", context_translate, context_enable_translate, t));
264 t=new SpellMenuBind;t->origin=this;t->word="ko";
265 translatemenu->append(new LLMenuItemCallGL("Korean", context_translate, context_enable_translate, t));
266 250
267 menu->appendMenu(translatemenu); 251 menu->appendMenu(translatemenu);
268 menu->appendSeparator("Spelsep"); 252 menu->appendSeparator("Spelsep");
@@ -555,15 +539,20 @@ void LLLineEditor::spell_correct(void* data)
555 539
556BOOL LLLineEditor::context_enable_translate(void* data) 540BOOL LLLineEditor::context_enable_translate(void* data)
557{ 541{
558 SpellMenuBind* t = (SpellMenuBind*)data; 542 LLLineEditor* line = (LLLineEditor*)data;
559 return (t && t->origin && t->origin->canTranslate()); 543 return line && line->canTranslate();
560} 544}
561 545
562void LLLineEditor::context_translate(void * data) 546void LLLineEditor::context_translate(void * data)
563{ 547{
564 SpellMenuBind* t = (SpellMenuBind*)data; 548 LLLineEditor* line = (LLLineEditor*)data;
565 LLLineEditor* line = t->origin; 549 LLMenuGL* menu = line ? (LLMenuGL*)(line->mPopupMenuHandle.get()) : NULL;
566 const std::string &toLang = t->word;//LLTranslate::getTranslateLanguage(); 550 LLMenuGL* translate_menu = menu ? menu->getChildMenuByName("Translate To", TRUE) : NULL;
551 if (!translate_menu)
552 {
553 return;
554 }
555 const std::string to_lang = translate_menu->getHighlightedItem()->getName();
567 556
568 bool has_text = false; 557 bool has_text = false;
569 S32 start, length; 558 S32 start, length;
@@ -584,8 +573,8 @@ void LLLineEditor::context_translate(void * data)
584 if (has_text) 573 if (has_text)
585 { 574 {
586 std::string to_translate = wstring_to_utf8str(line->getWText().substr(start, length)); 575 std::string to_translate = wstring_to_utf8str(line->getWText().substr(start, length));
587 LLHTTPClient::ResponderPtr result = LineChatTranslationReceiver::build(toLang, line, start, length); 576 LLHTTPClient::ResponderPtr result = LineChatTranslationReceiver::build(to_lang, line, start, length);
588 LLTranslate::translateMessage(result,"", toLang, to_translate); 577 LLTranslate::translateMessage(result,"", to_lang, to_translate);
589 } 578 }
590} 579}
591 580