Convert both translation languages ids to codes
This commit is contained in:
		
							parent
							
								
									04abe4b0d4
								
							
						
					
					
						commit
						2bf5515b0b
					
				@ -97,9 +97,11 @@ void WebPage::setTimeout(std::chrono::seconds timeout)
 | 
				
			|||||||
void WebPage::start(const TaskPtr &task)
 | 
					void WebPage::start(const TaskPtr &task)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  LanguageCodes languages;
 | 
					  LanguageCodes languages;
 | 
				
			||||||
  auto langCodes = languages.findById(task->targetLanguage);
 | 
					  auto sourceLanguage = languages.findById(task->sourceLanguage);
 | 
				
			||||||
  if (!langCodes) {
 | 
					  auto targetLanguage = languages.findById(task->targetLanguage);
 | 
				
			||||||
    task->error = QObject::tr("unknown translation language: %1")
 | 
					  if (!sourceLanguage || !targetLanguage) {
 | 
				
			||||||
 | 
					    task->error = QObject::tr("unknown translation languages: %1 or %2")
 | 
				
			||||||
 | 
					                      .arg(task->sourceLanguage)
 | 
				
			||||||
                      .arg(task->targetLanguage);
 | 
					                      .arg(task->targetLanguage);
 | 
				
			||||||
    translator_.finish(task);
 | 
					    translator_.finish(task);
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
@ -109,7 +111,8 @@ void WebPage::start(const TaskPtr &task)
 | 
				
			|||||||
  isBusy_ = true;
 | 
					  isBusy_ = true;
 | 
				
			||||||
  nextIdleTime_ = QDateTime::currentDateTime().addSecs(timeout_.count());
 | 
					  nextIdleTime_ = QDateTime::currentDateTime().addSecs(timeout_.count());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  proxy_->translate(task->corrected, task->sourceLanguage, langCodes->iso639_1);
 | 
					  proxy_->translate(task->corrected, sourceLanguage->iso639_1,
 | 
				
			||||||
 | 
					                    targetLanguage->iso639_1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool WebPage::checkBusy()
 | 
					bool WebPage::checkBusy()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user