Skip to content

Commit

Permalink
Merge pull request #720 from FEMR/revert-719-translate_url_encoding
Browse files Browse the repository at this point in the history
Revert "implemented URL encoding for Arabic and Hebrew translations"
  • Loading branch information
Har150n authored Apr 30, 2024
2 parents 39f0a93 + e2bd16e commit 679ea0d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 11 deletions.
9 changes: 1 addition & 8 deletions app/femr/util/translation/TranslationServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Scanner;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;

@Singleton
public class TranslationServer {
Expand All @@ -33,13 +31,9 @@ public static String makeServerRequest(String text, String from, String to) thro

String response = "";
try {
// Harrison Shu
// Encode the URL String parameter before creating URL to allow arabic and hebrew to be in the URL
String encodedText = URLEncoder.encode(text, StandardCharsets.UTF_8.toString());

//Make GET request
URL url = new URL("http://localhost:" + portNumber +"/?text=" +
encodedText + "&from=" + from + "&to=" + to);
text + "&from=" + from + "&to=" + to);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("GET");
con.connect();
Expand All @@ -51,7 +45,6 @@ public static String makeServerRequest(String text, String from, String to) thro

con.disconnect();
} catch(IOException e){
System.out.println(e) ;
return makeServerRequest(text, from, to);
}
return response;
Expand Down
1 change: 0 additions & 1 deletion public/js/medical/medical.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ $(document).ready(function () {
$("#toggleBtn").text("Show Original");

var listTranslated = response.translation.split("@");

var toLanguageIsRtl = response.toLanguageIsRtl;
var fromLanguageIsRtl = response.fromLanguageIsRtl;

Expand Down
2 changes: 0 additions & 2 deletions translator/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ def query_data(self):

@cached_property
def translate_data(self):
# Harrison Shu
# NOTE: Arabic and Hebrew Text is automatically decoded from the URL paramter
text = self.query_data['text']
from_code = self.query_data['from']
to_code = self.query_data['to']
Expand Down

0 comments on commit 679ea0d

Please sign in to comment.