Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dyang886 committed Jan 15, 2024
1 parent 7774905 commit 0585407
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions gamecheats.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import concurrent.futures
import gettext
import json
import locale
Expand All @@ -10,14 +11,13 @@
import threading
import time
from urllib.parse import urljoin, urlparse
import concurrent.futures
from fuzzywuzzy import fuzz

import polib
import requests
import sv_ttk
from bs4 import BeautifulSoup
from fuzzywuzzy import fuzz
from PIL import Image, ImageTk
import sv_ttk
from tendo import singleton
import tkinter as tk
from tkinter import filedialog, messagebox, ttk
Expand Down Expand Up @@ -544,6 +544,11 @@ def xhh_zhName(self, appid, trainerName):
response = requests.get(xhhGameDetailUrl, headers=self.headers)
xhhData = response.json()

# =======================================
# Special cases, add as needed
if trainerName == "Assassin's Creed 3":
trainerName = "Assassin's Creed III"

if 'name_en' in xhhData['result']:
enName = xhhData['result']['name_en']
sanitized_enName = self.sanitize(enName)
Expand Down Expand Up @@ -653,6 +658,9 @@ def translate_trainer(self, trainerName):
trans_trainerName = ts.translate_text(
original_trainerName, from_language='en', to_language='zh')

# strip any game names that have their english names at the end
pattern = r'(\([A-Za-z0-9\s:&]+)\)$|[A-Za-z0-9\s]+(?![\u4e00-\u9fff])$'
trans_trainerName = re.sub(pattern, '', trans_trainerName)
trans_trainerName = trans_trainerName.replace(
"《", "").replace("》", "")
trans_trainerName = f"《{trans_trainerName}》修改器"
Expand Down

0 comments on commit 0585407

Please sign in to comment.