Skip to content

Commit

Permalink
Init first version
Browse files Browse the repository at this point in the history
  • Loading branch information
Vit2060 committed Feb 13, 2023
1 parent bcd3ece commit e021b1b
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 0 deletions.
51 changes: 51 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# LOL Language Changer

![Screenshot](screenshot.png)

It's 2023 and Riot said in their 2023 season video that LOL Language option is comming at LATER OF THIS YEAR...And I was like: "How hard could it be?".

So, enjoy changing to any of these languages:

```text
en_US: English (alternatives en_GB, en_AU)
vi_VN: Vietnamese
ja_JP: Japanese
ko_KR: Korean
zh_CN: Chinese
zh_TW: Taiwanese
es_ES: Spanish (Spain)
es_MX: Spanish (Latin America)
fr_FR: French
de_DE: German
it_IT: Italian
pl_PL: Polish
ro_RO: Romanian
el_GR: Greek
pt_BR: Portuguese
hu_HU: Hungarian
ru_RU: Russian
tr_TR: Turkish
```


# Download

Please find download link in the Release Section

# Usage

1. Make sure to open League Client first.
2. Open this program, select language and click "Change"!

*Note* First time selecting a new language would take ~5 minutes to download it
![Downloading German Language Pack](german.png)

# To-do

- Support MacOS

# License

I actually have no idea how licensing works, so if you use it, clone it, do whatever with it, please credit to me, thank you ^3^

@TheDuckNiceRight
Binary file added german.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
151 changes: 151 additions & 0 deletions lol_language_changer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
import subprocess
import tkinter as tk
from tkinter import ttk
import psutil
import webbrowser

PROCESS_LIST = [
"LeagueCrashHandler.exe",
"LeagueClientUxRender.exe",
"LeagueClientUx.exe",
]

# language = "en_US"


def find_lol_path_windows():
"""
Return either Riot Client or League of Legends
Example:
E:\Riot Games\League of Legends\
E:\Riot Games\Riot Client\
"""

for process in psutil.process_iter():
try:
if process.name() in PROCESS_LIST:
return process.exe()
except (psutil.AccessDenied, psutil.NoSuchProcess):
pass

return None


def quit_lol_client():
# Check if the process is running
for process in psutil.process_iter():
if process.name() == "LeagueClientUx.exe":
# Terminate the process
process.kill()
print("The process LeagueClientUx.exe has been terminated.")


def start_lol_mac():
"""
The command for mac is
open /Applications/League\ of\ Legends.app/Contents/LoL/LeagueClient.app –args –locale= XXXXX
"""
# TODO


def start_lol_windows():
"""
The command for Windows is
"E:\Riot Games\League of Legends\LeagueClient.exe" --locale=ko_KR
"""

path = find_lol_path_windows()

if path is None:
label_status.config(text="Please open LOL Client first ^3^")
return

print("Found LOL at", path)

# Change target to
# "E:\Riot Games\League of Legends\LeagueClient.exe" --locale=ko_KR
path = path.split('\\')
path[-1] = "LeagueClient.exe"
path = '\\'.join(path)
argument = "--locale=" + get_selected_language()

# Start LOL with new language
try:
result = subprocess.run([path, argument], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8')
except Exception:
label_status.config(text="Oops, something went wrong")

# Printing the output
print(result.stdout)


# Define the options
LANGUAGE_OPTIONS = {
"English": "en_US",
"Vietnamese": "vi_VN",
"Japanese": "ja_JP",
"Korean": "ko_KR",
"Chinese": "zh_CN",
"Taiwanese": "zh_TW",
"Spanish (Spain)": "es_ES",
"Spanish (Latin America)": "es_MX",
"French": "fr_FR",
"German": "de_DE",
"Italian": "it_IT",
"Polish": "pl_PL",
"Romanian": "ro_RO",
"Greek": "el_GR",
"Portuguese": "pt_BR",
"Hungarian": "hu_HU",
"Russian": "ru_RU",
"Turkish": "tr_TR",
}


def get_selected_language():
return LANGUAGE_OPTIONS.get(combobox_language.get(), combobox_language.get())


def on_change_language(*arg):
print("Selected language:", get_selected_language())


def on_click_change():
start_lol_windows()


# Create the window
root = tk.Tk()
root.title("LOL Language Changer 0.1")
width = 310
height = 170
screenwidth = root.winfo_screenwidth()
screenheight = root.winfo_screenheight()
alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
root.geometry(alignstr)
root.resizable(False, False)

combobox_language = ttk.Combobox(root, values=list(LANGUAGE_OPTIONS.keys()))
combobox_language.pack(side=tk.LEFT)
combobox_language.current(0)
combobox_language.bind("<<ComboboxSelected>>", on_change_language)
combobox_language.place(x=15, y=10, width=168, height=30)

button_change = tk.Button(root, text="Change", command=on_click_change)
button_change.place(x=195, y=10, width=90, height=30)

label_status = tk.Label(root, text="UwU", fg="red")
label_status.place(x=10, y=45, width=302, height=35)

label_info = tk.Label(root, text="""Instruction:\n1. Open League Client.\n2. Select or enter a language code. Eg: vi_VN\n*Note: Changing language will restart your Client""")
label_info["justify"] = "left"
label_info.place(x=10, y=70, width=302, height=75)

label_info2 = tk.Label(root, text="""@TheDuckNiceRight""", fg="darkviolet", cursor="hand2")
label_info2.bind("<Button-1>", lambda e: webbrowser.open_new("http://www.ecosia.org"))
label_info2.place(x=10, y=140, width=302, height=30)

if __name__ == "__main__":
root.mainloop()
Binary file added screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e021b1b

Please sign in to comment.