Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit d5d3192

Browse files
committed
otf locale changing
1 parent b5943eb commit d5d3192

File tree

7 files changed

+36
-12
lines changed

7 files changed

+36
-12
lines changed

requirements.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
urllib3
2-
cursor
31
psutil
2+
cursor
3+
pyperclip
44
Flask
5-
valclient
6-
iso8601
75
requests
8-
pyperclip
9-
pystray
106
pypresence
7+
urllib3
8+
iso8601
9+
pystray
1110
Flask_Cors
11+
valclient
1212
InquirerPy
1313
Pillow

src/localization/locales.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Locales = {
22
"en-US": {
3+
"author": "@cm_an#2434",
34
"config": {
45
"version": "version",
56
"region": "region",
@@ -148,6 +149,7 @@
148149
},
149150
"es-ES": {},
150151
"es-MX": {
152+
"author": "@janinha#6244",
151153
"config": { ##fix any grammar mistakes you can find
152154
"version": "versión",
153155
"region": "región",
@@ -256,6 +258,7 @@
256258
"ko-KR": {},
257259
"pl-PL": {},
258260
"pt-BR": {
261+
"author": "@janinha#6244",
259262
"config": {
260263
"version": "versão",
261264
"region": "região",

src/localization/localization.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ def get_config_value(*keys):
5555

5656
@staticmethod
5757
def set_locale(config):
58-
Localizer.locale = config["locale"][0]
58+
for locale,data in Locales.items():
59+
if data != {}:
60+
for key,value in data["config"].items():
61+
if key == "locale" and value in config.keys():
62+
Localizer.locale = config[value][0]
5963

6064
@staticmethod
6165
def prompt_locale(config):

src/utilities/config/app_config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"region": ["",Client.fetch_regions()],
1212
"client_id": 811469787657928704,
1313
"presence_refresh_interval": 3,
14-
"locale": ["",list(Locales.keys())],
14+
"locale": ["",[locale for locale,data in Locales.items() if data != {}]],
1515
"presences": {
1616
"menu": {
1717
"show_rank_in_comp_lobby": True,
@@ -140,4 +140,4 @@ def create_default_config():
140140
os.mkdir(Filepath.get_appdata_folder())
141141
with open(Filepath.get_path(os.path.join(Filepath.get_appdata_folder(), "config.json")), "w") as f:
142142
json.dump(default_config, f)
143-
return Config.fetch_config()
143+
return Config.fetch_config()

src/utilities/config/modify_config.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,18 @@ def config_menu(self, section, choices, callback=None, callback_args=None):
4343
if isinstance(choices[choice], dict):
4444
self.config_menu(choice, choices[choice], callback=self.config_menu,callback_args=(section, choices, callback, callback_args))
4545
else:
46-
choices[choice] = self.config_set(choice, choices[choice])
46+
if choice == Localizer.get_config_key("locale"):
47+
#translate config
48+
old_locale = choices[choice]
49+
new_locale = self.config_set(choice, choices[choice])[0]
50+
self.config = Config.localize_config(self.config,True)
51+
self.config["locale"][0] = new_locale
52+
Localizer.locale = new_locale
53+
self.config = Config.localize_config(self.config,False)
54+
Localizer.config = self.config
55+
else:
56+
choices[choice] = self.config_set(choice, choices[choice])
57+
4758
self.config_menu(section, choices, callback, callback_args)
4859

4960
@staticmethod

src/utilities/program_data.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,14 @@ def modify_isntalls(payload):
3737

3838
@staticmethod
3939
def create_installs_file():
40+
Program_Data.check_for_folder()
4041
with open(Program_Data.installs_path, "w") as f:
4142
payload = {}
4243
json.dump(payload, f)
4344

44-
return Program_Data.fetch_installs()
45+
return Program_Data.fetch_installs()
46+
47+
@staticmethod
48+
def check_for_folder():
49+
if not os.path.isdir(Program_Data.installs_path):
50+
os.makedirs(Program_Data.installs_path)

version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,5 @@
1818
StringStruct(u'LegalCopyright', u'Colin Hartigan'),
1919
StringStruct(u'OriginalFilename', u'valorant-rpc.exe'),
2020
StringStruct(u'ProductName', u'VALORANT-rpc'),
21-
StringStruct(u'ProductVersion', u'3.0')])]),
21+
StringStruct(u'ProductVersion', u'3.1.0')])]),
2222
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])])

0 commit comments

Comments
 (0)