Skip to content

Commit

Permalink
특정 언어권에서 DeepL 번역기가 동작하지 않던 문제 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
killkimno committed Jul 13, 2023
1 parent 313d64e commit 23f5c4e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ private void DoTrans(OcrMethodType ocrMethodType)

if (MySettingManager.NowSkin == SettingManager.Skin.over)
{
string transResult = finalTransResult.Replace(Util.GetSpliteToken(TransType), "");
string transResult = finalTransResult.Replace(Util.GetSpliteToken(TransType), "", StringComparison.InvariantCulture);
DoTextToSpeach(transResult);
}
else
Expand Down
12 changes: 10 additions & 2 deletions MORT/TransAPI/DeepLTranslateAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,20 @@ public string DoTrans(string original, ref bool isError)
var regex = new Regex(Regex.Escape(token));
result = regex.Replace(result, "", 1);

int target = result.LastIndexOf(token);
int target = result.LastIndexOf(token, StringComparison.InvariantCulture);


if (target != -1)
{
result = result.Remove(target, token.Length);
try
{
result = result.Remove(target, token.Length);
}
catch
{

}

}
result = result.Replace(@"\r\n", "\r\n");
result = result.Replace(@"\n", "\r\n");
Expand Down

0 comments on commit 23f5c4e

Please sign in to comment.