// Path: OnlineTranslator/src/main/java/translator/utility/HttpUtility.java
// public class HttpUtility {
// 
//     public static String executePost(String actionURL, List<NameValuePair> postData) {
//         try {
//             HttpPost method = new HttpPost(actionURL);
//             method.setEntity(new UrlEncodedFormEntity(postData));
//             return execute(method);
//         } catch (Exception e) {
//             e.printStackTrace();
//             return e.getMessage();
//         }
//     }
// 
//     public static String executeGet(String actionURL) {
//         try {
//             return execute(new HttpGet(actionURL));
//         } catch (Exception e) {
//             e.printStackTrace();
//             return e.getMessage();
//         }
//     }
// 
//     private static String execute(HttpRequestBase method) throws IOException {
//         method.setHeader("User-Agent", USER_AGENT);
//         HttpResponse status = HttpClientBuilder.create().build().execute(method);
//         if (status.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
//             method.releaseConnection();
//             return "CONNECTION ERROR";
//         } else {
//             BufferedReader rd = new BufferedReader(new InputStreamReader(status.getEntity().getContent()));
// 
//             StringBuilder result = new StringBuilder();
//             String line;
//             while ((line = rd.readLine()) != null) {
//                 result.append(line);
//             }
//             String response = result.toString();
//             method.releaseConnection();
//             return response;
//         }
//     }
// 
// }


import org.jsoup.Jsoup;
import translator.utility.HttpUtility;
package translator.data;


public class Seslisozluk implements Translator {
    private final Language[] supportedLanguages = new Language[]{
            new Language("Turkish", "turkish"),
            new Language("English", "english")
    };

    public Language[] getLanguages() {
        return supportedLanguages;
    }

    public String translate(String text, String from, String to) {
        try {
            String url = "https://www.seslisozluk.net/" + text + "-nedir-ne-demek/";
// Path: OnlineTranslator/src/main/java/translator/utility/HttpUtility.java
// public class HttpUtility {
// 
//     public static String executePost(String actionURL, List<NameValuePair> postData) {
//         try {
//             HttpPost method = new HttpPost(actionURL);
//             method.setEntity(new UrlEncodedFormEntity(postData));
//             return execute(method);
//         } catch (Exception e) {
//             e.printStackTrace();
//             return e.getMessage();
//         }
//     }
// 
//     public static String executeGet(String actionURL) {
//         try {
//             return execute(new HttpGet(actionURL));
//         } catch (Exception e) {
//             e.printStackTrace();
//             return e.getMessage();
//         }
//     }
// 
//     private static String execute(HttpRequestBase method) throws IOException {
//         method.setHeader("User-Agent", USER_AGENT);
//         HttpResponse status = HttpClientBuilder.create().build().execute(method);
//         if (status.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
//             method.releaseConnection();
//             return "CONNECTION ERROR";
//         } else {
//             BufferedReader rd = new BufferedReader(new InputStreamReader(status.getEntity().getContent()));
// 
//             StringBuilder result = new StringBuilder();
//             String line;
//             while ((line = rd.readLine()) != null) {
//                 result.append(line);
//             }
//             String response = result.toString();
//             method.releaseConnection();
//             return response;
//         }
//     }
// 
// }


// Path: OnlineTranslator/src/main/java/translator/data/Seslisozluk.java
import org.jsoup.Jsoup;
import translator.utility.HttpUtility;

package translator.data;


public class Seslisozluk implements Translator {
    private final Language[] supportedLanguages = new Language[]{
            new Language("Turkish", "turkish"),
            new Language("English", "english")
    };

    public Language[] getLanguages() {
        return supportedLanguages;
    }

    public String translate(String text, String from, String to) {
        try {
            String url = "https://www.seslisozluk.net/" + text + "-nedir-ne-demek/";
            return Jsoup.parse(HttpUtility.executeGet(url)).select(".trans-box-shadow").outerHtml();