Jump to content
LaunchBox Community Forums

100dedo

Members
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

100dedo's Achievements

4-Bit Adder

4-Bit Adder (2/7)

1

Reputation

  1. Yesterday I posted this script that translates XML files, and consequently changes the description language of games and platforms, to the one you are interested in. It is possible to use both the executable and run the script itself via Python.
  2. Hey guys. I was having the same problem here. I looked for many posts here and on the internet and nothing. The only way I found to translate the metadata was to create a python script myself. How difficult it was, I will share it with you. To work you need: - Back up Lauchbox metadata (currently going to tools/file management/Create data backup); - Download/install the latest version of python and run the attached .exe. - Run the attached .exe file and choose the files to translate. - Restore the already translated backup. If the .exe file doesn't work, alternatively run the code below (you need Python too): import xml.etree.ElementTree as ET from googletrans import Translator from tkinter import Tk, filedialog # Função de tradução de texto def translate_text(text, dest_language): translator = Translator() try: translated_text = translator.translate(text, dest=dest_language).text return translated_text except Exception as e: print(f"Erro na tradução: {e}") return text # Função para traduzir o campo "Notes" em um arquivo XML def translate_notes_in_xml(file_path, dest_language): tree = ET.parse(file_path) root = tree.getroot() for element in root.iter('Notes'): if element.text and not element.text.isspace(): translated_text = translate_text(element.text, dest_language) element.text = translated_text tree.write(file_path) # Função para escolher vários arquivos XML def choose_files(): root = Tk() root.withdraw() files = filedialog.askopenfilenames(filetypes=[("XML Files", "*.xml")]) root.destroy() return files # Função para traduzir o campo "Notes" em vários arquivos XML escolhidos def translate_notes_in_selected_files(files, dest_language): for file_path in files: print(f"Traduzindo campo 'Notes' no arquivo: {file_path}") translate_notes_in_xml(file_path, dest_language) # Escolha de vários arquivos XML selected_files = choose_files() # Escolha do idioma de destino destination_language = input("Enter the target language code (e.g. pt for Portuguese, fr for French, it for Italian, etc.): ") # Verifica se arquivos foram selecionados e se o idioma foi fornecido if selected_files and destination_language: translate_notes_in_selected_files(selected_files, destination_language) else: print("Nenhum arquivo selecionado ou idioma de destino não fornecido.") translate.7z
×
×
  • Create New...