Skip to content

Commit a794797

Browse files
committed
add more translations
1 parent 20d0247 commit a794797

File tree

8 files changed

+278
-50
lines changed

8 files changed

+278
-50
lines changed

oclp_r/support/translate_language.py

Lines changed: 141 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,40 @@ def utilities(self):
710710
"Less than a minute ":"Less than a minute ",
711711
"Disabling Idle Sleep":"Disabling Idle Sleep",
712712
"Re-enabling Idle Sleep":"Re-enabling Idle Sleep",
713-
"Killing Process: {0} - {1}":"Killing Process: {0} - {1}"
713+
"Killing Process: {0} - {1}":"Killing Process: {0} - {1}",
714+
# dmg_mount.py
715+
"- PatcherSupportPkg resources missing, Patcher likely corrupted!!!":"- PatcherSupportPkg resources missing, Patcher likely corrupted!!!",
716+
"- Failed to mount Universal-Binaries.dmg":"- Failed to mount Universal-Binaries.dmg",
717+
"- Mounted Universal-Binaries.dmg":"- Mounted Universal-Binaries.dmg",
718+
"- Found HackdocInternal resources, mounting...":"- Found HackdocInternal resources, mounting...",
719+
"- Failed to mount HackdocInternal resources":"- Failed to mount HackdocInternal resources",
720+
"- Mounted HackdocInternal resources":"- Mounted HackdocInternal resources",
721+
"- Failed to merge HackdocInternal resources":"- Failed to merge HackdocInternal resources",
722+
"- Local PatcherSupportPkg resources available, continuing...":"- Local PatcherSupportPkg resources available, continuing...",
723+
724+
# files.py
725+
" - Skipping {file_name}, cannot locate {source_folder}":" - Skipping {file_name}, cannot locate {source_folder}",
726+
" - Installing: {file_name}":" - Installing: {file_name}",
727+
" - Found existing {file_name}, overwriting...":" - Found existing {file_name}, overwriting...",
728+
" - Removing: {file_name}":" - Removing: {file_name}",
729+
730+
# kdk_merge.py
731+
"- Matching KDK determined to already be merged, skipping":"- Matching KDK determined to already be merged, skipping",
732+
"- Backing up IOHIDEventDriver CodeSignature":"- Backing up IOHIDEventDriver CodeSignature",
733+
"- Restoring IOHIDEventDriver CodeSignature":"- Restoring IOHIDEventDriver CodeSignature",
734+
" - CodeSignature folder missing, creating":" - CodeSignature folder missing, creating",
735+
"- Merging KDK with Root Volume: {kdk_name}":"- Merging KDK with Root Volume: {kdk_name}",
736+
"- Failed to merge KDK with Root Volume":"- Failed to merge KDK with Root Volume",
737+
"- Successfully merged KDK with Root Volume":"- Successfully merged KDK with Root Volume",
738+
"Failed to install KDK":"Failed to install KDK",
739+
"Unable to get KDK info: {error_msg}":"Unable to get KDK info: {error_msg}",
740+
"Could not retrieve KDK: {error_msg}":"Could not retrieve KDK: {error_msg}",
741+
"Could not download KDK: {error_msg}":"Could not download KDK: {error_msg}",
742+
"KDK checksum validation failed: {error_msg}":"KDK checksum validation failed: {error_msg}",
743+
"KDK was not installed, but should have been: {error_msg}":"KDK was not installed, but should have been: {error_msg}",
744+
"Unable to find Kernel Debug Kit":"Unable to find Kernel Debug Kit",
745+
"- Unable to find Kernel Debug Kit":"- Unable to find Kernel Debug Kit",
746+
"- Found KDK at: {kdk_path}":"- Found KDK at: {kdk_path}"
714747
}
715748
elif self.language_point=="简体中文":
716749
trans={
@@ -721,7 +754,40 @@ def utilities(self):
721754
"Less than a minute ":"不到一分钟 ",
722755
"Disabling Idle Sleep":"正在禁用休眠",
723756
"Re-enabling Idle Sleep":"正在重新启用休眠",
724-
"Killing Process: {0} - {1}":"正在终止进程: {0} - {1}"
757+
"Killing Process: {0} - {1}":"正在终止进程: {0} - {1}",
758+
# dmg_mount.py
759+
"- PatcherSupportPkg resources missing, Patcher likely corrupted!!!":"- PatcherSupportPkg 资源缺失,修补程序可能已损坏!!!",
760+
"- Failed to mount Universal-Binaries.dmg":"- 挂载 Universal-Binaries.dmg 失败",
761+
"- Mounted Universal-Binaries.dmg":"- 已挂载 Universal-Binaries.dmg",
762+
"- Found HackdocInternal resources, mounting...":"- 找到 HackdocInternal 资源,正在挂载...",
763+
"- Failed to mount HackdocInternal resources":"- 挂载 HackdocInternal 资源失败",
764+
"- Mounted HackdocInternal resources":"- 已挂载 HackdocInternal 资源",
765+
"- Failed to merge HackdocInternal resources":"- 合并 HackdocInternal 资源失败",
766+
"- Local PatcherSupportPkg resources available, continuing...":"- 本地 PatcherSupportPkg 资源可用,继续...",
767+
768+
# files.py
769+
" - Skipping {file_name}, cannot locate {source_folder}":" - 跳过 {file_name},无法定位 {source_folder}",
770+
" - Installing: {file_name}":" - 正在安装: {file_name}",
771+
" - Found existing {file_name}, overwriting...":" - 找到现有 {file_name},正在覆盖...",
772+
" - Removing: {file_name}":" - 正在删除: {file_name}",
773+
774+
# kdk_merge.py
775+
"- Matching KDK determined to already be merged, skipping":"- 匹配的 KDK 已确定已合并,跳过",
776+
"- Backing up IOHIDEventDriver CodeSignature":"- 正在备份 IOHIDEventDriver 代码签名",
777+
"- Restoring IOHIDEventDriver CodeSignature":"- 正在恢复 IOHIDEventDriver 代码签名",
778+
" - CodeSignature folder missing, creating":" - 代码签名文件夹缺失,正在创建",
779+
"- Merging KDK with Root Volume: {kdk_name}":"- 正在将 KDK 与根卷合并: {kdk_name}",
780+
"- Failed to merge KDK with Root Volume":"- 将 KDK 与根卷合并失败",
781+
"- Successfully merged KDK with Root Volume":"- 成功将 KDK 与根卷合并",
782+
"Failed to install KDK":"安装 KDK 失败",
783+
"Unable to get KDK info: {error_msg}":"无法获取 KDK 信息: {error_msg}",
784+
"Could not retrieve KDK: {error_msg}":"无法检索 KDK: {error_msg}",
785+
"Could not download KDK: {error_msg}":"无法下载 KDK: {error_msg}",
786+
"KDK checksum validation failed: {error_msg}":"KDK 校验和验证失败: {error_msg}",
787+
"KDK was not installed, but should have been: {error_msg}":"KDK 未安装,但应该已安装: {error_msg}",
788+
"Unable to find Kernel Debug Kit":"无法找到内核调试工具包",
789+
"- Unable to find Kernel Debug Kit":"- 无法找到内核调试工具包",
790+
"- Found KDK at: {kdk_path}":"- 在 {kdk_path} 找到 KDK"
725791
}
726792
return trans
727793

@@ -2956,6 +3022,79 @@ def sys_patch_helpers(self):
29563022
}
29573023
return trans
29583024

3025+
def utilities(self):
3026+
if self.language_point=="English":
3027+
trans={
3028+
# dmg_mount.py
3029+
"- PatcherSupportPkg resources missing, Patcher likely corrupted!!!":"- PatcherSupportPkg resources missing, Patcher likely corrupted!!!",
3030+
"- Failed to mount Universal-Binaries.dmg":"- Failed to mount Universal-Binaries.dmg",
3031+
"- Mounted Universal-Binaries.dmg":"- Mounted Universal-Binaries.dmg",
3032+
"- Found HackdocInternal resources, mounting...":"- Found HackdocInternal resources, mounting...",
3033+
"- Failed to mount HackdocInternal resources":"- Failed to mount HackdocInternal resources",
3034+
"- Mounted HackdocInternal resources":"- Mounted HackdocInternal resources",
3035+
"- Failed to merge HackdocInternal resources":"- Failed to merge HackdocInternal resources",
3036+
"- Local PatcherSupportPkg resources available, continuing...":"- Local PatcherSupportPkg resources available, continuing...",
3037+
3038+
# files.py
3039+
" - Skipping {file_name}, cannot locate {source_folder}":" - Skipping {file_name}, cannot locate {source_folder}",
3040+
" - Installing: {file_name}":" - Installing: {file_name}",
3041+
" - Found existing {file_name}, overwriting...":" - Found existing {file_name}, overwriting...",
3042+
" - Removing: {file_name}":" - Removing: {file_name}",
3043+
3044+
# kdk_merge.py
3045+
"- Matching KDK determined to already be merged, skipping":"- Matching KDK determined to already be merged, skipping",
3046+
"- Backing up IOHIDEventDriver CodeSignature":"- Backing up IOHIDEventDriver CodeSignature",
3047+
"- Restoring IOHIDEventDriver CodeSignature":"- Restoring IOHIDEventDriver CodeSignature",
3048+
" - CodeSignature folder missing, creating":" - CodeSignature folder missing, creating",
3049+
"- Merging KDK with Root Volume: {kdk_name}":"- Merging KDK with Root Volume: {kdk_name}",
3050+
"- Failed to merge KDK with Root Volume":"- Failed to merge KDK with Root Volume",
3051+
"- Successfully merged KDK with Root Volume":"- Successfully merged KDK with Root Volume",
3052+
"Failed to install KDK":"Failed to install KDK",
3053+
"Unable to get KDK info: {error_msg}":"Unable to get KDK info: {error_msg}",
3054+
"Could not retrieve KDK: {error_msg}":"Could not retrieve KDK: {error_msg}",
3055+
"Could not download KDK: {error_msg}":"Could not download KDK: {error_msg}",
3056+
"KDK checksum validation failed: {error_msg}":"KDK checksum validation failed: {error_msg}",
3057+
"KDK was not installed, but should have been: {error_msg}":"KDK was not installed, but should have been: {error_msg}",
3058+
"- Unable to find Kernel Debug Kit":"- Unable to find Kernel Debug Kit",
3059+
"- Found KDK at: {kdk_path}":"- Found KDK at: {kdk_path}"
3060+
}
3061+
elif self.language_point=="简体中文":
3062+
trans={
3063+
# dmg_mount.py
3064+
"- PatcherSupportPkg resources missing, Patcher likely corrupted!!!":"- PatcherSupportPkg 资源缺失,修补程序可能已损坏!!!",
3065+
"- Failed to mount Universal-Binaries.dmg":"- 挂载 Universal-Binaries.dmg 失败",
3066+
"- Mounted Universal-Binaries.dmg":"- 已挂载 Universal-Binaries.dmg",
3067+
"- Found HackdocInternal resources, mounting...":"- 找到 HackdocInternal 资源,正在挂载...",
3068+
"- Failed to mount HackdocInternal resources":"- 挂载 HackdocInternal 资源失败",
3069+
"- Mounted HackdocInternal resources":"- 已挂载 HackdocInternal 资源",
3070+
"- Failed to merge HackdocInternal resources":"- 合并 HackdocInternal 资源失败",
3071+
"- Local PatcherSupportPkg resources available, continuing...":"- 本地 PatcherSupportPkg 资源可用,继续...",
3072+
3073+
# files.py
3074+
" - Skipping {file_name}, cannot locate {source_folder}":" - 跳过 {file_name},无法定位 {source_folder}",
3075+
" - Installing: {file_name}":" - 正在安装: {file_name}",
3076+
" - Found existing {file_name}, overwriting...":" - 找到现有 {file_name},正在覆盖...",
3077+
" - Removing: {file_name}":" - 正在删除: {file_name}",
3078+
3079+
# kdk_merge.py
3080+
"- Matching KDK determined to already be merged, skipping":"- 匹配的 KDK 已确定已合并,跳过",
3081+
"- Backing up IOHIDEventDriver CodeSignature":"- 正在备份 IOHIDEventDriver 代码签名",
3082+
"- Restoring IOHIDEventDriver CodeSignature":"- 正在恢复 IOHIDEventDriver 代码签名",
3083+
" - CodeSignature folder missing, creating":" - 代码签名文件夹缺失,正在创建",
3084+
"- Merging KDK with Root Volume: {kdk_name}":"- 正在将 KDK 与根卷合并: {kdk_name}",
3085+
"- Failed to merge KDK with Root Volume":"- 将 KDK 与根卷合并失败",
3086+
"- Successfully merged KDK with Root Volume":"- 成功将 KDK 与根卷合并",
3087+
"Failed to install KDK":"安装 KDK 失败",
3088+
"Unable to get KDK info: {error_msg}":"无法获取 KDK 信息: {error_msg}",
3089+
"Could not retrieve KDK: {error_msg}":"无法检索 KDK: {error_msg}",
3090+
"Could not download KDK: {error_msg}":"无法下载 KDK: {error_msg}",
3091+
"KDK checksum validation failed: {error_msg}":"KDK 校验和验证失败: {error_msg}",
3092+
"KDK was not installed, but should have been: {error_msg}":"KDK 未安装,但应该已安装: {error_msg}",
3093+
"- Unable to find Kernel Debug Kit":"- 无法找到内核调试工具包",
3094+
"- Found KDK at: {kdk_path}":"- 在 {kdk_path} 找到 KDK"
3095+
}
3096+
return trans
3097+
29593098
class TranslateLanguage_efi_builder:
29603099
def __init__(self, global_constants: Constants) -> None:
29613100
self.file_name: str = ".com.hackdoc.oclp-r.plist"

oclp_r/support/validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def _validate_sys_patch(self) -> None:
233233

234234
atexit.register(self._unmount_dmg)
235235

236-
for supported_os in [os_data.os_data.big_sur, os_data.os_data.monterey, os_data.os_data.ventura, os_data.os_data.sonoma, os_data.os_data.sequoia]:
236+
for supported_os in [os_data.os_data.big_sur, os_data.os_data.monterey, os_data.os_data.ventura, os_data.os_data.sonoma, os_data.os_data.sequoia, os_data.os_data.tahoe]:
237237
for i in range(0, 10):
238238
self._validate_root_patch_files(supported_os, i)
239239

oclp_r/sys_patch/sys_patch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def _execute_patchset(self, required_patches: dict):
391391
destination_folder_path = str(self.mount_location) + remove_patch_directory
392392
else:
393393
destination_folder_path = str(self.mount_location_data) + remove_patch_directory
394-
remove_file(destination_folder_path, remove_patch_file)
394+
remove_file(destination_folder_path, remove_patch_file,self.trans)
395395

396396

397397
for method_install in [PatchType.OVERWRITE_SYSTEM_VOLUME, PatchType.OVERWRITE_DATA_VOLUME, PatchType.MERGE_SYSTEM_VOLUME, PatchType.MERGE_DATA_VOLUME]:
@@ -430,7 +430,7 @@ def _execute_patchset(self, required_patches: dict):
430430

431431
destination_folder_path = updated_destination_folder_path
432432

433-
install_new_file(source_folder_path, destination_folder_path, install_file, method_install)
433+
install_new_file(source_folder_path, destination_folder_path, install_file, method_install,self.trans)
434434

435435
if PatchType.EXECUTE in required_patches[patch]:
436436
for process in required_patches[patch][PatchType.EXECUTE]:

oclp_r/sys_patch/utilities/dmg_mount.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,25 @@
1010

1111
from ... import constants
1212

13-
from ...support import subprocess_wrapper
13+
from ...support import subprocess_wrapper, translate_language
1414

1515

1616
class PatcherSupportPkgMount:
1717

1818
def __init__(self, global_constants: constants.Constants) -> None:
1919
self.constants: constants.Constants = global_constants
2020
self.icon_path = str(self.constants.app_icon_path).replace("/", ":")[1:]
21+
22+
# Initialize translation
23+
self.trans = translate_language.TranslateLanguage_sys_patch(global_constants).utilities()
2124

2225

2326
def _mount_universal_binaries_dmg(self) -> bool:
2427
"""
2528
Mount PatcherSupportPkg's Universal-Binaries.dmg
2629
"""
2730
if not Path(self.constants.payload_local_binaries_root_path_dmg).exists():
28-
logging.info("- PatcherSupportPkg resources missing, Patcher likely corrupted!!!")
31+
logging.info(self.trans["- PatcherSupportPkg resources missing, Patcher likely corrupted!!!"])
2932
return False
3033

3134
output = subprocess.run(
@@ -39,11 +42,11 @@ def _mount_universal_binaries_dmg(self) -> bool:
3942
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
4043
)
4144
if output.returncode != 0:
42-
logging.info("- Failed to mount Universal-Binaries.dmg")
45+
logging.info(self.trans["- Failed to mount Universal-Binaries.dmg"])
4346
subprocess_wrapper.log(output)
4447
return False
4548

46-
logging.info("- Mounted Universal-Binaries.dmg")
49+
logging.info(self.trans["- Mounted Universal-Binaries.dmg"])
4750
return True
4851

4952

@@ -58,7 +61,7 @@ def _mount_hackdoc_internal_resources_dmg(self) -> bool:
5861
if self.constants.cli_mode is True:
5962
return True
6063

61-
logging.info("- Found HackdocInternal resources, mounting...")
64+
logging.info(self.trans["- Found HackdocInternal resources, mounting..."])
6265

6366
for i in range(3):
6467
key = self._request_decryption_key(i)
@@ -72,7 +75,7 @@ def _mount_hackdoc_internal_resources_dmg(self) -> bool:
7275
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
7376
)
7477
if output.returncode != 0:
75-
logging.info("- Failed to mount HackdocInternal resources")
78+
logging.info(self.trans["- Failed to mount HackdocInternal resources"])
7679
subprocess_wrapper.log(output)
7780

7881
if "Authentication error" not in output.stdout.decode():
@@ -84,7 +87,7 @@ def _mount_hackdoc_internal_resources_dmg(self) -> bool:
8487
continue
8588
break
8689

87-
logging.info("- Mounted HackdocInternal resources")
90+
logging.info(self.trans["- Mounted HackdocInternal resources"])
8891
return self._merge_hackdoc_internal_resources()
8992

9093

@@ -99,7 +102,7 @@ def _merge_hackdoc_internal_resources(self) -> bool:
99102
stdout=subprocess.PIPE, stderr=subprocess.STDOUT
100103
)
101104
if result.returncode != 0:
102-
logging.info("- Failed to merge HackdocInternal resources")
105+
logging.info(self.trans["- Failed to merge HackdocInternal resources"])
103106
subprocess_wrapper.log(result)
104107
return False
105108

@@ -171,7 +174,7 @@ def mount(self) -> bool:
171174
"""
172175
# If already mounted, skip
173176
if Path(self.constants.payload_local_binaries_root_path).exists():
174-
logging.info("- Local PatcherSupportPkg resources available, continuing...")
177+
logging.info(self.trans["- Local PatcherSupportPkg resources available, continuing..."])
175178
return True
176179

177180
if self._mount_universal_binaries_dmg() is False:

0 commit comments

Comments
 (0)