package net.tutorial.service;

import com.ibm.watson.developer_cloud.language_translation.v2.LanguageTranslation;
import com.ibm.watson.developer_cloud.language_translation.v2.model.TranslationResult;
import net.tutorial.service.credential.LanguageTranslationCredential;
import net.tutorial.service.result.LanguageTranslationResult;

/**
 * Created by pongpantola.
 */
public class LanguageTranslationService {

    private LanguageTranslation lt;

    public LanguageTranslationService(){
        LanguageTranslationCredential ltCred = new LanguageTranslationCredential();
        lt = new LanguageTranslation();
        lt.setUsernameAndPassword(ltCred.username, ltCred.password);
    }

    public LanguageTranslationResult translate(String text, String frmLanguage, String toLanguage){
        TranslationResult tr = lt.translate(text, frmLanguage, toLanguage);

        return new LanguageTranslationResult(tr.toString());
    }



}

@@ -632,16 +632,18 @@
         
+//
 lt.setUs
@@ -692,24 +692,116 @@
 password);%0D%0A
+        lt.setUsernameAndPassword(%22b97f9508-51b9-45a6-985e-5979a1b5c405%22, %225yhyk8PNFIoc%22);%0D%0A
     %7D%0D%0A%0D%0A   

Update LanguageTranslationService.java