Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mzanella committed May 26, 2017
1 parent 0e8d839 commit a5af2ef
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/main/java/it/augugrumi/libtranslate/yandex/YandexQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,25 @@ private YandexQuery (
public ITranslationResult runQuery() {

String key = TranslateKeyStore.getIstance().retrieveYandexKey();
Translation translation;
YTranslateApi yandexApi = new YTranslateApiImpl(key);
com.github.vbauer.yta.model.Language adaptedFrom = YandexLangConverter.getConverter().get(from).convert();
com.github.vbauer.yta.model.Language adaptedTo = YandexLangConverter.getConverter().get(to).convert();

Translation translation = yandexApi.translationApi()
.translate(
textToTranslate,
Direction.of(adaptedFrom, adaptedTo)
);
com.github.vbauer.yta.model.Language adaptedTo =
YandexLangConverter.getConverter().get(to).convert();
if (from != null) {
com.github.vbauer.yta.model.Language adaptedFrom =
YandexLangConverter.getConverter().get(from).convert();
translation = yandexApi.translationApi()
.translate(
textToTranslate,
Direction.of(adaptedFrom, adaptedTo)
);
} else {
translation = yandexApi.translationApi()
.translate(
textToTranslate,
adaptedTo
);
}

YandexResult res = new YandexResult
.Builder()
Expand Down

0 comments on commit a5af2ef

Please sign in to comment.