Skip to content

Commit

Permalink
Revert "implemented URL encoding for Arabic and Hebrew translations"
Browse files Browse the repository at this point in the history
  • Loading branch information
Har150n authored Apr 30, 2024
1 parent 39f0a93 commit e2bd16e
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 e2bd16e

Please sign in to comment.