english and french have been switched in the code: english is now the main language, making the code way more easier to read for non-french user.

This commit is contained in:
raphael60650 2021-07-14 00:23:37 +02:00
parent 3dce6bc1bd
commit be9036310b
12 changed files with 176 additions and 177 deletions

View file

@ -23,7 +23,7 @@ def __init__(self):
self.boolvar_dont_check_track_sha1 = BooleanVar(value=self.option["dont_check_track_sha1"])
self.intvar_process_track = IntVar(value=self.option["process_track"])
self.root.title(self.translate("MKWFaraphel Installateur"))
self.root.title(self.translate("MKWFaraphel Installer"))
self.root.resizable(False, False)
self.root.iconbitmap(bitmap="./icon.ico")
@ -35,43 +35,43 @@ def __init__(self):
self.root.config(menu=self.menu_bar)
self.menu_language = Menu(self.menu_bar, tearoff=0)
self.menu_bar.add_cascade(label=self.translate("Langage"), menu=self.menu_language)
self.menu_bar.add_cascade(label=self.translate("Language"), menu=self.menu_language)
self.menu_language.add_radiobutton(label="Français", variable=self.stringvar_language, value="fr", command=lambda: self.change_option("language", "fr", restart=True))
self.menu_language.add_radiobutton(label="English", variable=self.stringvar_language, value="en", command=lambda: self.change_option("language", "en", restart=True))
self.menu_format = Menu(self.menu_bar, tearoff=0)
self.menu_bar.add_cascade(label=self.translate("Format"), menu=self.menu_format)
self.menu_format.add_radiobutton(label=self.translate("FST (Dossier)"), variable=self.stringvar_game_format, value="FST", command=lambda: self.change_option("format", "FST"))
self.menu_format.add_radiobutton(label=self.translate("FST (Directory)"), variable=self.stringvar_game_format, value="FST", command=lambda: self.change_option("format", "FST"))
self.menu_format.add_radiobutton(label="ISO", variable=self.stringvar_game_format, value="ISO", command=lambda: self.change_option("format", "ISO"))
self.menu_format.add_radiobutton(label="CISO", variable=self.stringvar_game_format, value="CISO", command=lambda: self.change_option("format", "CISO"))
self.menu_format.add_radiobutton(label="WBFS", variable=self.stringvar_game_format, value="WBFS", command=lambda: self.change_option("format", "WBFS"))
self.menu_advanced = Menu(self.menu_bar, tearoff=0)
self.menu_bar.add_cascade(label=self.translate("Avancé"), menu=self.menu_advanced)
self.menu_advanced.add_checkbutton(label=self.translate("Désactiver les téléchargements"), variable=self.boolvar_disable_download, command=lambda: self.change_option("disable_download", self.boolvar_disable_download))
self.menu_advanced.add_checkbutton(label=self.translate("Supprimer les courses wu8 après conversion en szs"), variable=self.boolvar_del_track_after_conv, command=lambda: self.change_option("del_track_after_conv", self.boolvar_del_track_after_conv))
self.menu_advanced.add_checkbutton(label=self.translate("Ne pas vérifier les mises à jour"), variable=self.boolvar_dont_check_for_update, command=lambda: self.change_option("dont_check_for_update", self.boolvar_dont_check_for_update))
self.menu_advanced.add_checkbutton(label=self.translate("Ne pas vérifier le sha1 des courses"), variable=self.boolvar_dont_check_track_sha1, command=lambda: self.change_option("dont_check_track_sha1",self.boolvar_dont_check_track_sha1))
self.menu_bar.add_cascade(label=self.translate("Advanced"), menu=self.menu_advanced)
self.menu_advanced.add_checkbutton(label=self.translate("Disable downloads"), variable=self.boolvar_disable_download, command=lambda: self.change_option("disable_download", self.boolvar_disable_download))
self.menu_advanced.add_checkbutton(label=self.translate("Delete track after wu8 to szs conversion"), variable=self.boolvar_del_track_after_conv, command=lambda: self.change_option("del_track_after_conv", self.boolvar_del_track_after_conv))
self.menu_advanced.add_checkbutton(label=self.translate("Don't check for update"), variable=self.boolvar_dont_check_for_update, command=lambda: self.change_option("dont_check_for_update", self.boolvar_dont_check_for_update))
self.menu_advanced.add_checkbutton(label=self.translate("Don't check track's sha1"), variable=self.boolvar_dont_check_track_sha1, command=lambda: self.change_option("dont_check_track_sha1",self.boolvar_dont_check_track_sha1))
self.menu_advanced.add_separator()
self.menu_advanced.add_command(label=self.translate("Nombre de processus de conversion de course :"))
self.menu_advanced.add_radiobutton(label=self.translate("1 processus"), variable=self.intvar_process_track, value=1, command=lambda: self.change_option("process_track", 1))
self.menu_advanced.add_radiobutton(label=self.translate("2 processus"), variable=self.intvar_process_track, value=2, command=lambda: self.change_option("process_track", 2))
self.menu_advanced.add_radiobutton(label=self.translate("4 processus"), variable=self.intvar_process_track, value=4, command=lambda: self.change_option("process_track", 4))
self.menu_advanced.add_radiobutton(label=self.translate("8 processus"), variable=self.intvar_process_track, value=8, command=lambda: self.change_option("process_track", 8))
self.menu_advanced.add_command(label=self.translate("Number of track conversion process", " :"))
self.menu_advanced.add_radiobutton(label=self.translate("1 ", "process"), variable=self.intvar_process_track, value=1, command=lambda: self.change_option("process_track", 1))
self.menu_advanced.add_radiobutton(label=self.translate("2 ", "process"), variable=self.intvar_process_track, value=2, command=lambda: self.change_option("process_track", 2))
self.menu_advanced.add_radiobutton(label=self.translate("4 ", "process"), variable=self.intvar_process_track, value=4, command=lambda: self.change_option("process_track", 4))
self.menu_advanced.add_radiobutton(label=self.translate("8 ", "process"), variable=self.intvar_process_track, value=8, command=lambda: self.change_option("process_track", 8))
self.frame_language = Frame(self.root)
self.frame_language.grid(row=1, column=1, sticky="E")
self.frame_game_path = LabelFrame(self.root, text=self.translate("Jeu original"))
self.frame_game_path = LabelFrame(self.root, text=self.translate("Original game"))
self.frame_game_path.grid(row=2, column=1)
entry_game_path = Entry(self.frame_game_path, width=50)
entry_game_path.grid(row=1, column=1, sticky="NEWS")
def select_path():
path = filedialog.askopenfilename(filetypes=((self.translate("Jeu Wii"),
path = filedialog.askopenfilename(filetypes=((self.translate("Wii game"),
r"*.iso *.wbfs main.dol *.wia *.ciso"),))
if os.path.exists(path):
entry_game_path.delete(0, END)
@ -89,14 +89,14 @@ def __init__(self):
self.frame_action.grid_forget()
path = entry_game_path.get()
if not (os.path.exists(path)):
messagebox.showerror(self.translate("Erreur"), self.translate("Le chemin de fichier est invalide"))
messagebox.showerror(self.translate("Error"), self.translate("The file path in invalid"))
return
extension = get_extension(path)
if extension.upper() == "DOL":
if messagebox.askyesno(self.translate("Attention"),
self.translate("Ce dossier sera écrasé si vous installer le mod !\n" +
"Êtes-vous sûr de vouloir l'utiliser ?")):
if messagebox.askyesno(self.translate("Warning"),
self.translate("This directory will be overwritten if you install the "
"mod !\n Are you sure you want to use it ?")):
self.path_mkwf = os.path.realpath(path + "/../../")
else: return
elif extension.upper() in ["ISO", "WBFS", "CSIO"]:
@ -107,7 +107,7 @@ def __init__(self):
if not(os.path.exists(self.path_mkwf)): break
directory_name, i = f"MKWiiFaraphel ({i})", i + 1
self.Progress(show=True, indeter=True, statut=self.translate("Extraction du jeu..."))
self.Progress(show=True, indeter=True, statut=self.translate("Extracting the game..."))
subprocess.call(["./tools/wit/wit", "EXTRACT", get_nodir(path), "--DEST", directory_name]
, creationflags=CREATE_NO_WINDOW, cwd=get_dir(path))
@ -116,23 +116,22 @@ def __init__(self):
self.Progress(show=False)
else:
messagebox.showerror(self.translate("Erreur"), self.translate("Le type de fichier n'est pas reconnu"))
messagebox.showerror(self.translate("Error"), self.translate("This file type is not supported"))
self.Progress(show=False)
return
if glob.glob(self.path_mkwf + "/files/rel/lecode-???.bin"): # if a LECODE file is already here
messagebox.showwarning(self.translate("Attention"),
self.translate("Cette ROM est déjà moddé, " +
"il est déconseillé de l'utiliser pour installer le mod"))
messagebox.showwarning(self.translate("Warning"),
self.translate("This game is already modded, it is not recommended to "
"use it to install the mod"))
try:
with open(self.path_mkwf + "/setup.txt") as f: setup = f.read()
setup = setup[setup.find("!part-id = ")+len("!part-id = "):]
self.original_game_ID = setup[:setup.find("\n")]
except:
messagebox.showwarning(self.translate("Attention"),
self.transate("Impossible de trouver la région de votre jeu.\n"
"la région PAL sera utilisé par défaut."))
messagebox.showwarning(self.translate("Warning"),
self.transate("Can't find game region.\nPAL region will be used."))
self.original_game_ID = "RMCP01"
try:
self.original_region_ID = self.original_game_ID[3]
@ -150,7 +149,7 @@ def __init__(self):
t.start()
return t
self.button_game_extract = Button(self.frame_game_path_action, text=self.translate("Extraire le fichier"),
self.button_game_extract = Button(self.frame_game_path_action, text=self.translate("Extract file"),
relief=RIDGE, command=use_path)
self.button_game_extract.grid(row=1, column=1, sticky="NEWS")
@ -160,26 +159,26 @@ def __init__(self):
self.patch_file().join()
self.install_mod().join()
if messagebox.askyesno(self.translate("Fonctionnalité expérimentale"),
self.translate("Cette action va extraire / utiliser la ROM sélectionné,"
" préparer les fichiers et installer le mod. Voulez-vous continuer ?")):
if messagebox.askyesno(self.translate("Experimental functionality"),
self.translate("This will extract the selected ROM, prepare files and install mod. "
"Do you wish to continue ?")):
t = Thread(target=func)
t.setDaemon(True)
t.start()
self.button_do_everything = Button(self.frame_game_path_action, text=self.translate("Tout faire"),
self.button_do_everything = Button(self.frame_game_path_action, text=self.translate("Do everything"),
relief=RIDGE, command=do_everything)
self.button_do_everything.grid(row=1, column=2, sticky="NEWS")
self.frame_action = LabelFrame(self.root, text=self.translate("Action"))
self.button_prepare_file = Button(self.frame_action, text=self.translate("Preparer les fichiers"), relief=RIDGE,
self.button_prepare_file = Button(self.frame_action, text=self.translate("Prepare files"), relief=RIDGE,
command=self.patch_file, width=45)
self.button_prepare_file.grid(row=1, column=1, columnspan=2, sticky="NEWS")
self.button_install_mod = Button(self.frame_action, text=self.translate("Installer le mod"), relief=RIDGE,
self.button_install_mod = Button(self.frame_action, text=self.translate("Install mod"), relief=RIDGE,
command=self.install_mod, width=45)
# Le boutton d'installation du mod n'est affiché qu'après avoir préparer les fichiers
# Install mod button will only appear after prepare file step
self.progressbar = ttk.Progressbar(self.root)
self.progresslabel = Label(self.root)

View file

@ -18,32 +18,31 @@ def check_update(self):
(float(gitversion["version"]) == float(locversion["version"])) and
float(gitversion["subversion"]) > float(locversion["subversion"])):
if messagebox.askyesno(
self.translate("Mise à jour disponible !"),
self.translate("Une mise à jour est disponible, souhaitez-vous l'installer ?") +
f"\n\nVersion : {locversion['version']}.{locversion['subversion']} -> {gitversion['version']}.{gitversion['subversion']}\n"
f"Changelog :\n{gitversion['changelog']}"):
self.translate("Update available !"),
self.translate("An update is available, do you want to install it ?",
f"\n\nVersion : {locversion['version']}.{locversion['subversion']} -> "
f"{gitversion['version']}.{gitversion['subversion']}\n"
f"Changelog :\n{gitversion['changelog']}")):
if not(os.path.exists("./Updater/Updater.exe")):
dl = requests.get(gitversion["updater_bin"], allow_redirects=True)
with open("./download.zip", "wb") as file:
print(self.translate("Téléchargement de Updater en cours..."))
print(self.translate("Downloading the Updater..."))
file.write(dl.content)
print(self.translate("fin du téléchargement, "
"début de l'extraction..."))
print(self.translate("end of the download, extracting..."))
with zipfile.ZipFile("./download.zip") as file:
file.extractall("./Updater/")
print(self.translate("fin de l'extraction"))
print(self.translate("finished extracting"))
os.remove("./download.zip")
print(self.translate("lancement de l'application..."))
print(self.translate("starting application..."))
os.startfile(os.path.realpath("./Updater/Updater.exe"))
sys.exit()
except requests.ConnectionError:
messagebox.showwarning(self.translate("Attention"),
self.translate("Impossible de se connecter à internet. Le téléchargement sera "
"automatiquement désactivé."))
messagebox.showwarning(self.translate("Warning"),
self.translate("Can't connect to internet. Download will be disabled."))
self.option["disable_download"] = True
except:

View file

@ -1,3 +1,5 @@
import json
CREATE_NO_WINDOW = 0x08000000
GITHUB_REPOSITORY = "Faraphel/MKWF-Install"
GITHUB_CONTENT_ROOT = f"https://raw.githubusercontent.com/{GITHUB_REPOSITORY}/master/"
@ -17,6 +19,9 @@ region_ID = {
"E": "USA"
}
with open("./translation.json", encoding="utf-8") as f:
translation_dict = json.load(f)
def get_trackname(name=None, prefix=None, suffix=None, track=None):
if track:

View file

@ -39,11 +39,11 @@ def install_mod(self):
for ffp in fs[fp][nf]: count_rf(path=f)
###
extracted_file = []
max_step += 4 # PATCH main.dol et PATCH lecode.bin, conversion, changement d'ID
self.Progress(show=True, indeter=False, statut=self.translate("Installation du mod"), max=max_step, step=0)
max_step += 4 # PATCH main.dol and PATCH lecode.bin, converting, changing ID
self.Progress(show=True, indeter=False, statut=self.translate("Installing mod"), max=max_step, step=0)
def replace_file(path, file, subpath="/"):
self.Progress(statut=self.translate("Modification de")+f"\n{get_nodir(path)}", add=1)
self.Progress(statut=self.translate("Editing", "\n", get_nodir(path)), add=1)
extension = get_extension(path)
if extension == "szs":
@ -77,7 +77,7 @@ def install_mod(self):
for ffp in fs[fp][nf]: replace_file(path=f, subpath=nf, file=ffp)
for file in extracted_file:
self.Progress(statut=self.translate("Recompilation de")+f"\n{get_nodir(file)}", add=1)
self.Progress(statut=self.translate("Recompilating", "\n", get_nodir(file)), add=1)
subprocess.run(["./tools/szs/wszst", "CREATE", get_nodir(file) + ".d", "-d", get_nodir(file),
"--overwrite"], creationflags=CREATE_NO_WINDOW, cwd=get_dir(file),
check=True, stdout=subprocess.PIPE)
@ -106,7 +106,7 @@ def install_mod(self):
shutil.rmtree(self.path_mkwf + "/tmp/")
outputformat = self.stringvar_game_format.get()
self.Progress(statut=self.translate("Conversion en")+f" {outputformat}", add=1)
self.Progress(statut=self.translate("Converting to", " ", outputformat), add=1)
if outputformat in ["ISO", "WBFS", "CISO"]:
self.path_mkwf_format = os.path.realpath(self.path_mkwf + "/../MKWFaraphel." + outputformat.lower())
@ -116,14 +116,14 @@ def install_mod(self):
check=True, stdout=subprocess.PIPE)
shutil.rmtree(self.path_mkwf)
self.Progress(statut=self.translate("Changement de l'ID du jeu"), add=1)
self.Progress(statut=self.translate("Changing game's ID"), add=1)
subprocess.run(["./tools/wit/wit", "EDIT", get_nodir(self.path_mkwf_format), "--id",
f"RMC{self.original_region_ID}60", "--name", f"Mario Kart Wii Faraphel {self.VERSION}",
"--modify", "ALL"],
creationflags=CREATE_NO_WINDOW, cwd=get_dir(self.path_mkwf_format),
check=True, stdout=subprocess.PIPE)
messagebox.showinfo(self.translate("Fin"), self.translate("L'installation est terminé !"))
messagebox.showinfo(self.translate("End"), self.translate("The mod has been installed !"))
except: self.log_error()
finally: self.Progress(show=False)

View file

@ -5,4 +5,4 @@ from tkinter import messagebox
def log_error(self):
error = traceback.format_exc()
with open("./error.log", "a") as f: f.write(f"---\n{error}\n")
messagebox.showerror(self.translate("Erreur"), self.translate("Une erreur est survenue :") + f"\n{error}\n\n")
messagebox.showerror(self.translate("Error"), self.translate("An error occured", " :", "\n", error, "\n\n"))

View file

@ -106,7 +106,7 @@ def patch_bmg(self, gamefile): # gamefile est le fichier .szs trouvé dans le /
}
bmglang = gamefile[-len("E.txt"):-len(".txt")] # Langue du fichier
self.Progress(statut=self.translate("Patch des textes ") + bmglang, add=1)
self.Progress(statut=self.translate("Patching text", " ", bmglang), add=1)
subprocess.run(["./tools/szs/wszst", "EXTRACT", get_nodir(gamefile), "-d", get_nodir(gamefile) + ".d",
"--overwrite"], creationflags=CREATE_NO_WINDOW, cwd=get_dir(gamefile))
@ -126,10 +126,10 @@ def patch_bmg(self, gamefile): # gamefile est le fichier .szs trouvé dans le /
with open("./file/ExtraCommon.txt", "w", encoding="utf8") as f:
f.write("#BMG\n\n"
f" 703e\t= {self.translate('Aléatoire: Toutes les pistes', lang=bmglang)}\n"
f" 703f\t= {self.translate('Aléatoire: Pistes Originales', lang=bmglang)}\n"
f" 7040\t= {self.translate('Aléatoire: Custom Tracks', lang=bmglang)}\n"
f" 7041\t= {self.translate('Aléatoire: Pistes Nouvelles', lang=bmglang)}\n")
f" 703e\t= {self.translate('Random: All tracks', lang=bmglang)}\n"
f" 703f\t= {self.translate('Random: Original tracks', lang=bmglang)}\n"
f" 7040\t= {self.translate('Random: Custom Tracks', lang=bmglang)}\n"
f" 7041\t= {self.translate('Random: New tracks', lang=bmglang)}\n")
for bmgtrack in bmgtracks.split("\n"):
if "=" in bmgtrack:

View file

@ -30,9 +30,9 @@ def patch_ct_icon(self):
draw.text((4, 4), "CT", (255, 165, 0), font=font)
font = ImageFont.truetype("./file/SuperMario256.ttf", 60)
draw.text((5 - 2, 80 - 2), "%03i" % (i-10), (0, 0, 0), font=font) # i-10 car on ne compte pas les 8 coupes
draw.text((5 + 2, 80 - 2), "%03i" % (i-10), (0, 0, 0), font=font) # de base (0-7), la coupe aléatoire, et
draw.text((5 - 2, 80 + 2), "%03i" % (i-10), (0, 0, 0), font=font) # les icones droite et gauche.
draw.text((5 - 2, 80 - 2), "%03i" % (i-10), (0, 0, 0), font=font) # i-10 because first 8 cup are not
draw.text((5 + 2, 80 - 2), "%03i" % (i-10), (0, 0, 0), font=font) # counted as new, random cup,
draw.text((5 - 2, 80 + 2), "%03i" % (i-10), (0, 0, 0), font=font) # left and right arrow
draw.text((5 + 2, 80 + 2), "%03i" % (i-10), (0, 0, 0), font=font)
draw.text((5, 80), "%03i" % (i-10), (255, 165, 0), font=font)

View file

@ -12,12 +12,12 @@ def patch_file(self):
tracks, total_track = self.count_track()
max_step = len(fc["img"]) + total_track + 3 + len("EGFIS")
self.Progress(show=True, indeter=False, statut=self.translate("Conversion des fichiers"), max=max_step, step=0)
self.Progress(statut=self.translate("Configuration de LE-CODE"), add=1)
self.Progress(show=True, indeter=False, statut=self.translate("Converting files"), max=max_step, step=0)
self.Progress(statut=self.translate("Configurating LE-CODE"), add=1)
self.create_lecode_config()
self.Progress(statut=self.translate("Création de ct_icon.png"), add=1)
self.Progress(statut=self.translate("Creating ct_icon.png"), add=1)
self.patch_ct_icon()
self.Progress(statut=self.translate("Création des images descriptives"), add=1)
self.Progress(statut=self.translate("Creating descriptive images"), add=1)
self.patch_img_desc()
self.patch_image(fc)
for file in glob.glob(self.path_mkwf+"/files/Scene/UI/MenuSingle_?.szs"): self.patch_bmg(file)
@ -26,7 +26,7 @@ def patch_file(self):
if self.patch_track(tracks, total_track) != 0: return
self.button_install_mod.grid(row=2, column=1, columnspan=2, sticky="NEWS")
self.button_install_mod.config(text=f'{self.translate("Installer le mod")} (v{self.VERSION})')
self.button_install_mod.config(text=self.translate("Install mod", " (v", self.VERSION, ")"))
except: self.log_error()
finally: self.Progress(show=False)

View file

@ -4,6 +4,6 @@ import subprocess
def patch_image(self, fc):
for i, file in enumerate(fc["img"]):
self.Progress(statut=self.translate("Conversion des images") + f"\n({i + 1}/{len(fc['img'])}) {file}", add=1)
self.Progress(statut=self.translate("Converting images") + f"\n({i + 1}/{len(fc['img'])}) {file}", add=1)
subprocess.run(["./tools/szs/wimgt", "ENCODE", "./file/" + file, "-x", fc["img"][file], "--overwrite"],
creationflags=CREATE_NO_WINDOW, check=True, stdout=subprocess.PIPE)

View file

@ -40,8 +40,8 @@ def patch_track(self, tracks, total_track="?"):
nonlocal error_count, error_max, process_list
process_list[track_file] = None # Used for
self.Progress(statut=self.translate("Conversion des courses") + f"\n({i + 1}/{total_track})\n" +
"\n".join(process_list.keys()), add=1)
self.Progress(statut=self.translate("Converting tracks", f"\n({i + 1}/{total_track})\n",
"\n".join(process_list.keys())), add=1)
for _track in [get_track_szs(track_file), get_track_wu8(track_file)]:
if os.path.exists(_track):
@ -54,14 +54,14 @@ def patch_track(self, tracks, total_track="?"):
error_count += 1
if error_count > error_max: # Too much track wasn't correctly converted
messagebox.showerror(
self.translate("Erreur"),
self.translate("Trop de course ont eu une erreur du téléchargement."))
self.translate("Error"),
self.translate("Too much tracks had a download issue."))
return -1
else:
messagebox.showwarning(self.translate("Attention"),
self.translate("Impossible de télécharger cette course ! (") +
str(error_count) + "/" + str(error_max) + ")")
elif download_returncode == 2: break # Si le téléchargement est désactivé, ne pas checker le sha1
messagebox.showwarning(self.translate("Warning"),
self.translate("Can't download this track !",
f" ({error_count} / {error_max})"))
elif download_returncode == 2: break # if download is disabled, don't check sha1
if "sha1" in track:
if not self.boolvar_dont_check_track_sha1.get():
@ -69,8 +69,8 @@ def patch_track(self, tracks, total_track="?"):
error_count += 1
if error_count > error_max: # Too much track wasn't correctly converted
messagebox.showerror(
self.translate("Erreur"),
self.translate("Trop de course ont eu une erreur de vérification de sha1."))
self.translate("Error"),
self.translate("Too much tracks had an issue during sha1 check."))
return -1
continue
@ -84,9 +84,8 @@ def patch_track(self, tracks, total_track="?"):
"./file/Track/%N.szs", "--szs", "--overwrite", "--autoadd-path",
"./file/auto-add/"], creationflags=CREATE_NO_WINDOW, stderr=subprocess.PIPE)
else:
messagebox.showerror(self.translate("Erreur"),
self.translate("Impossible de convertir la course.\n"
"Réactiver le téléchargement des courses et réessayer."))
messagebox.showerror(self.translate("Erreor"),
self.translate("Can't convert track.\nEnable track download and retry."))
return -1
elif self.boolvar_del_track_after_conv.get(): os.remove(get_track_wu8(track_file))
return 0
@ -106,16 +105,15 @@ def patch_track(self, tracks, total_track="?"):
error_count += 1
if error_count > error_max: # Too much track wasn't correctly converted
messagebox.showerror(
self.translate("Erreur"),
self.translate("Trop de course ont eu une erreur de conversion."))
self.translate("Error"),
self.translate("Too much track had a conversion issue."))
return -1
else: # if the error max hasn't been reach
messagebox.showwarning(
self.translate("Attention"),
self.translate("La course ") +
get_track_wu8(track_file) +
self.translate(" n'a pas été correctement converti. (") +
str(error_count) + "/" + str(error_max) + ")")
self.translate("Warning"),
self.translate("The track", " ", get_track_wu8(track_file),
"do not have been properly converted.",
f" ({error_count} / {error_max})"))
else:
if self.boolvar_del_track_after_conv.get(): os.remove(get_track_wu8(track_file))
else:

View file

@ -1,20 +1,21 @@
import json
from .definition import translation_dict
def translate(self, text, lang = None):
if lang == None: lang = self.stringvar_language.get()
elif lang == "E": lang = "en"
def translate(self, *texts, lang=None):
if lang is None: lang = self.stringvar_language.get()
elif lang == "F": lang = "fr"
elif lang == "G": lang = "ge"
elif lang == "I": lang = "it"
elif lang == "S": lang = "sp"
with open("./translation.json", encoding="utf-8") as f:
translation = json.load(f)
if lang in translation:
_lang_trad = translation[lang]
if text in _lang_trad: return _lang_trad[text]
else:
print(f"no translation for : \"{text}\"")
return text
if lang in translation_dict:
_lang_trad = translation_dict[lang]
translated_text = ""
for text in texts:
if text in _lang_trad: translated_text += _lang_trad[text]
else: translated_text += text
return translated_text
return "".join(texts) # if no translation language is found

View file

@ -1,87 +1,84 @@
{
"en": {
"Ne pas vérifier le sha1 des courses": "Don't check for track's sha1",
"Impossible de se connecter à internet. Le téléchargement sera automatiquement désactivé.": "Can't connect to internet, download will automatically be disabled.",
"fr": {
"MKWFaraphel Installer": "MKWFaraphel Installateur",
"FST (Directory)": "FST (Dossier)",
"Advanced": "Avancé",
"Language": "Langage",
"Disable downloads": "Désactiver les téléchargements",
"Delete track after wu8 to szs conversion": "Supprimer les courses wu8 après conversion en szs",
"Don't check for update": "Ne pas vérifier les mises à jour",
"Don't check track's sha1": "Ne pas vérifier le sha1 des courses",
"Number of track conversion process": "Nombre de processus de conversion de course",
"process": "processus",
"Original game": "Jeu original",
"Wii game": "Jeu Wii",
"Error": "Erreur",
"The file path in invalid": "Le chemin de fichier est invalide",
"Warning": "Attention",
"This directory will be overwritten if you install the mod !\nAre you sure you want to use it ?": "Ce dossier sera écrasé si vous installer le mod !\nÊtes-vous sûr de vouloir l'utiliser ?",
"Extracting the game...": "Extraction du jeu...",
"This file type is not supported": "Le type de fichier n'est pas reconnu",
"This game is already modded, it is not recommended to use it to install the mod": "Cette ROM est déjà moddé, il est déconseillé de l'utiliser pour installer le mod",
"Can't find game region.\nPAL region will be used.": "Impossible de trouver la région de votre jeu.\nla région PAL sera utilisé par défaut.",
"Extract file": "Extraire le fichier",
"Experimental functionality": "Fonctionnalité expérimentale",
"This will extract the selected ROM, prepare files and install mod. Do you wish to continue ?": "Cette action va extraire / utiliser la ROM sélectionné, préparer les fichiers et installer le mod. Voulez-vous continuer ?",
"Do everything": "Tout faire",
"Action": "Action",
"Prepare files": "Préparer les fichiers",
"Install mod": "Installer le mod",
"Update available !": "Mise à jour disponible !",
"An update is available, do you want to install it ?": "Une mise à jour est disponible, souhaitez-vous l'installer ?",
"Downloading the Updater...": "Téléchargement de Updater en cours...",
"end of the download, extracting...": "fin du téléchargement, début de l'extraction...",
"finished extracting": "fin de l'extraction",
"starting application...": "lancement de l'application...",
"Can't connect to internet. Download will be disabled.": "Impossible de se connecter à internet. Le téléchargement sera désactivé.",
"Installing mod": "Installation du mod",
"Editing": "Modification de",
"Recompilating": "Recompilation de",
"Patch main.dol": "Patch main.dol",
"Patch lecode.bin": "Patch lecode.bin",
"Installation du mod": "Installing mod",
"Impossible de convertir la course.\nRéactiver le téléchargement des courses et réessayer.": "Impossible to convert track.\nEnable track download and retry.",
"Langage": "Language",
"Format": "Format",
"FST (Dossier)": "FST (Directory)",
"Avancé": "Advanced",
"Désactiver les téléchargements": "Disable downloads",
"Supprimer les courses wu8 après conversion en szs": "Delete wu8 track after conversion to szs",
"Ne pas vérifier les mises à jour": "Don't check for update",
"Nombre de processus de conversion de course :": "Number of process for track conversion :",
"1 processus": "1 process",
"2 processus": "2 process",
"4 processus": "4 process",
"8 processus": "8 process",
"La course ": "The track ",
" n'a pas été correctement converti. (": "hasn't been correctly converted. (",
"Trop de course ont eu une erreur de conversion.": "Too much track had a conversion issue.",
"Une erreur est survenue :": "An error occured :",
"Cette action va extraire / utiliser la ROM sélectionné, préparer les fichiers et installer le mod. Voulez-vous continuer ?": "This will extract the selected ROM, prepare files and install mod. Do you wish to continue ?",
"Fonctionnalité expérimentale": "Experimental functionality",
"Tout faire": "Do everything",
"Création des images descriptives": "Creation of descriptive images",
"Création de ct_icon.png": "Creating ct_icon.png",
"Patch des textes ": "Patching text ",
"Aléatoire: Toutes les pistes": "Random: All tracks",
"Aléatoire: Pistes Originales": "Random: Original tracks",
"Aléatoire: Custom Tracks": "Random: Custom Tracks",
"Aléatoire: Pistes Nouvelles": "Random: New tracks",
"MKWFaraphel Installateur": "MKWFaraphel Installer",
"Jeu Wii": "Wii game",
"Jeu original": "Original game",
"Erreur": "Error",
"Le chemin de fichier est invalide": "The file path in invalid",
"Attention": "Warning",
"Ce dossier sera écrasé si vous installer le mod !\nÊtes-vous sûr de vouloir l'utiliser ?": "This directory will be overwritten if you install the mod !\nAre you sure you want to use it ?",
"Extraction du jeu...": "Extracting the game...",
"Le type de fichier n'est pas reconnu": "This file type is not supported",
"Cette ROM est déjà moddé, il est déconseillé de l'utiliser pour installer le mod": "This game is already modded, it is not recommended to use it to install the mod",
"Extraire le fichier": "Extract file",
"Preparer les fichiers": "Prepare files",
"Action": "Action",
"Installer le mod": "Install mod",
"Dossier": "Directory",
"Langage : ": "Language : ",
"Mise à jour disponible !": "Update available !",
"Une mise à jour est disponible, souhaitez-vous l'installer ?": "An update is available, do you want to install it ?",
"Téléchargement de Updater en cours...": "Downloading the Updater...",
"fin du téléchargement, début de l'extraction...": "end of the download, extracting...",
"fin de l'extraction": "finished extracting",
"lancement de l'application...": "starting application...",
"Modification de": "Modifying",
"Recompilation de": "Recompilating",
"Conversion en": "Converting to",
"Changement de l'ID du jeu": "editing game's ID",
"Fin": "End",
"L'installation est terminé !": "The mod has been installed !",
"Conversion des fichiers": "Converting files",
"Conversion des images": "Converting images",
"Conversion des textes": "Converting texts",
"Conversion des courses": "Converting races",
"Configuration de LE-CODE": "Configurating LE-CODE"
"Converting to": "Conversion en",
"Changing game's ID": "Changement de l'ID du jeu",
"End": "Fin",
"The mod has been installed !": "L'installation est terminé !",
"An error occured": "Une erreur est survenue",
"Patching text": "Patch des textes",
"Random: All tracks": "Aléatoire: Toutes les pistes",
"Random: Original tracks": "Aléatoire: Pistes Originales",
"Random: Custom Tracks": "Aléatoire: Custom Tracks",
"Random: New tracks": "Aléatoire: Pistes Nouvelles",
"Converting files": "Conversion des fichiers",
"Configurating LE-CODE": "Configuration de LE-CODE",
"Creating ct_icon.png": "Création de ct_icon.png",
"Creating descriptive images": "Création des images descriptives",
"Converting images": "Conversion des images",
"Converting tracks": "Conversion des courses",
"Too much tracks had a download issue.": "Trop de course ont eu une erreur de téléchargement.",
"Can't download this track !": "Impossible de télécharger cette course !",
"Too much tracks had an issue during sha1 check.": "Trop de course ont eu une erreur de vérification de sha1.",
"Can't convert track.\nEnable track download and retry.": "Impossible de convertir la course.\nRéactiver le téléchargement des courses et réessayer.",
"Too much track had a conversion issue.": "Trop de course ont eu une erreur de conversion.",
"La course": "The track",
"do not have been properly converted.": "n'a pas été correctement converti."
},
"ge": {
"Aléatoire: Toutes les pistes": "Zufällig: Alle Spuren",
"Aléatoire: Pistes Originales": "Zufällig: Original-Spuren",
"Aléatoire: Custom Tracks": "Zufällig: Custom Tracks",
"Aléatoire: Pistes Nouvelles": "Zufällig: Neue Spuren"
"Random: All tracks": "Zufällig: Alle Spuren",
"Random: Original tracks": "Zufällig: Original-Spuren",
"Random: Custom Tracks": "Zufällig: Custom Tracks",
"Random: New tracks": "Zufällig: Neue Spuren"
},
"it": {
"Aléatoire: Toutes les pistes": "Casuale: Tutte le tracce",
"Aléatoire: Pistes Originales": "Casuale: Tracce originali",
"Aléatoire: Custom Tracks": "Casuale: Custom Tracks",
"Aléatoire: Pistes Nouvelles": "Casuale: Nuovi brani"
"Random: All tracks": "Casuale: Tutte le tracce",
"Random: Original tracks": "Casuale: Tracce originali",
"Random: Custom Tracks": "Casuale: Custom Tracks",
"Random: New tracks": "Casuale: Nuovi brani"
},
"sp": {
"Aléatoire: Toutes les pistes": "Aleatorio: Todas las pistas",
"Aléatoire: Pistes Originales": "Aleatorio: Pistas originales",
"Aléatoire: Custom Tracks": "Aleatorio: Custom Tracks",
"Aléatoire: Pistes Nouvelles": "Aleatorio: Pistas nuevas"
"Random: All tracks": "Aleatorio: Todas las pistas",
"Random: Original tracks": "Aleatorio: Pistas originales",
"Random: Custom Tracks": "Aleatorio: Custom Tracks",
"Random: New tracks": "Aleatorio: Pistas nuevas"
}
}