Skip to content

Commit 20d0247

Browse files
committed
add more translations
1 parent 5cce9fe commit 20d0247

File tree

13 files changed

+395
-109
lines changed

13 files changed

+395
-109
lines changed

oclp_r/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(self) -> None:
2222
# Patcher Versioning
2323
self.patcher_version: str = "3.0.1" # OCLP-R
2424
self.patcher_support_pkg_version: str = "1.11.0" # PatcherSupportPkg
25-
self.copyright_date: str = "Copyright © 2020-2025 Dortania and Hackdoc"
25+
self.copyright_date: str = "Copyright © 2020-2026 Dortania and Hackdoc"
2626
self.patcher_name: str = "OCLP-R"
2727

2828
# URLs

oclp_r/support/translate_language.py

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2799,6 +2799,163 @@ def kernelcache(self):
27992799
}
28002800
return trans
28012801

2802+
def mount(self):
2803+
if self.language_point=="English":
2804+
trans={
2805+
"Failed to parse diskutil output.":"Failed to parse diskutil output.",
2806+
"Failed to mount root volume":"Failed to mount root volume",
2807+
"{root_volume_identifier} has already been unmounted.":"{root_volume_identifier} has already been unmounted.",
2808+
"Attempted to mount root volume, but failed: {result}":"Attempted to mount root volume, but failed: {result}",
2809+
"Failed to unmount root volume":"Failed to unmount root volume",
2810+
"Failed to create APFS snapshot":"Failed to create APFS snapshot",
2811+
"- This is an APFS bug with Monterey and newer! Perform a clean installation to ensure your APFS volume is built correctly":"- This is an APFS bug with Monterey and newer! Perform a clean installation to ensure your APFS volume is built correctly",
2812+
"Failed to revert APFS snapshot":"Failed to revert APFS snapshot"
2813+
}
2814+
elif self.language_point=="简体中文":
2815+
trans={
2816+
"Failed to parse diskutil output.":"解析diskutil输出失败",
2817+
"Failed to mount root volume":"挂载根卷失败",
2818+
"{root_volume_identifier} has already been unmounted.":"{root_volume_identifier} 已经卸载",
2819+
"Attempted to mount root volume, but failed: {result}":"尝试挂载根卷失败: {result}",
2820+
"Failed to unmount root volume":"卸载根卷失败",
2821+
"Failed to create APFS snapshot":"创建APFS快照失败",
2822+
"- This is an APFS bug with Monterey and newer! Perform a clean installation to ensure your APFS volume is built correctly":"- 这是Monterey及更新版本的APFS错误!请执行干净安装以确保您的APFS卷正确构建",
2823+
"Failed to revert APFS snapshot":"恢复APFS快照失败"
2824+
}
2825+
return trans
2826+
2827+
def sys_patch(self):
2828+
if self.language_point=="English":
2829+
trans={
2830+
"- Unmounting root volume":"- Unmounting root volume",
2831+
"- Running sanity checks before patching":"- Running sanity checks before patching",
2832+
"- Failed to find SystemVersion.plist on mounted root volume":"- Failed to find SystemVersion.plist on mounted root volume",
2833+
"An update is in progress on your machine and patching cannot continue until it is cancelled or finished":"An update is in progress on your machine and patching cannot continue until it is cancelled or finished",
2834+
"- Failed to parse SystemVersion.plist":"- Failed to parse SystemVersion.plist",
2835+
"- Cleaning LaunchPad Settings":"- Cleaning LaunchPad Settings",
2836+
"- Unpatching complete":"- Unpatching complete",
2837+
"\nPlease reboot the machine for patches to take effect":"\nPlease reboot the machine for patches to take effect",
2838+
"- Patching complete":"- Patching complete",
2839+
"Note: Apple will require you to open System Preferences -> Security to allow the new kernel extensions to be loaded":"Note: Apple will require you to open System Preferences -> Security to allow the new kernel extensions to be loaded",
2840+
"- Rebuilding dyld shared cache":"- Rebuilding dyld shared cache",
2841+
"- Rebuilding preboot kernel cache":"- Rebuilding preboot kernel cache",
2842+
"- Found SkylightPlugins folder, removing old plugins":"- Found SkylightPlugins folder, removing old plugins",
2843+
"- Creating SkylightPlugins folder":"- Creating SkylightPlugins folder",
2844+
"- Removing non-Metal Enforcement Preference: {arg}":"- Removing non-Metal Enforcement Preference: {arg}",
2845+
"- Writing patchset information to Root Volume":"- Writing patchset information to Root Volume",
2846+
"- Running patches for {model}":"- Running patches for {model}",
2847+
"- Installing Patchset: {patch}":"- Installing Patchset: {patch}",
2848+
"- Remove Files at: {remove_patch_directory}":"- Remove Files at: {remove_patch_directory}",
2849+
"- Handling Installs in: {install_patch_directory}":"- Handling Installs in: {install_patch_directory}",
2850+
"- Running Process as Root:\n{process}":"- Running Process as Root:\n{process}",
2851+
"- Running Process:\n{process}":"- Running Process:\n{process}",
2852+
"Failed to find MetalLibSupportPkg: {error_msg}":"Failed to find MetalLibSupportPkg: {error_msg}",
2853+
"Using MetalLibSupportPkg: {metallib_installed_path}":"Using MetalLibSupportPkg: {metallib_installed_path}",
2854+
"Could not download MetalLibSupportPkg: {error_msg}":"Could not download MetalLibSupportPkg: {error_msg}",
2855+
"Failed to install MetalLibSupportPkg":"Failed to install MetalLibSupportPkg",
2856+
"- Running Preflight Checks before patching":"- Running Preflight Checks before patching",
2857+
"- Finished Preflight, starting patching":"- Finished Preflight, starting patching",
2858+
"- Starting Patch Process":"- Starting Patch Process",
2859+
"- Determining Required Patch set for Darwin {detected_os}":"- Determining Required Patch set for Darwin {detected_os}",
2860+
"- No Root Patches required for your machine!":"- No Root Patches required for your machine!",
2861+
"- Verifying whether Root Patching possible":"- Verifying whether Root Patching possible",
2862+
"- Cannot continue with patching!!!":"- Cannot continue with patching!!!",
2863+
"- Patcher is capable of patching":"- Patcher is capable of patching",
2864+
"- Critical resources missing, cannot continue with patching!!!":"- Critical resources missing, cannot continue with patching!!!",
2865+
"- Failed to mount root volume, cannot continue with patching!!!":"- Failed to mount root volume, cannot continue with patching!!!",
2866+
"- Failed sanity checks, cannot continue with patching!!!":"- Failed sanity checks, cannot continue with patching!!!",
2867+
"- Please ensure that you do not have any updates pending":"- Please ensure that you do not have any updates pending",
2868+
"- Starting Unpatch Process":"- Starting Unpatch Process",
2869+
"- Cannot continue with unpatching!!!":"- Cannot continue with unpatching!!!",
2870+
"- Failed to mount root volume, cannot continue with unpatching!!!":"- Failed to mount root volume, cannot continue with unpatching!!!",
2871+
"Failed to find {source_file}":"Failed to find {source_file}",
2872+
"Failed to find MetalLibSupportPkg: {error_msg}":"Failed to find MetalLibSupportPkg: {error_msg}",
2873+
"Could not download MetalLibSupportPkg: {error_msg}":"Could not download MetalLibSupportPkg: {error_msg}",
2874+
"Failed to install MetalLibSupportPkg":"Failed to install MetalLibSupportPkg",
2875+
"Unknown Dynamic Patchset: {variant}":"Unknown Dynamic Patchset: {variant}"
2876+
}
2877+
elif self.language_point=="简体中文":
2878+
trans={
2879+
"- Unmounting root volume":"- 正在卸载根卷",
2880+
"- Running sanity checks before patching":"- 正在运行修补前的完整性检查",
2881+
"- Failed to find SystemVersion.plist on mounted root volume":"- 在挂载的根卷上找不到 SystemVersion.plist",
2882+
"An update is in progress on your machine and patching cannot continue until it is cancelled or finished":"您的机器正在进行更新,修补无法继续,直到更新被取消或完成",
2883+
"- Failed to parse SystemVersion.plist":"- 解析 SystemVersion.plist 失败",
2884+
"- Cleaning LaunchPad Settings":"- 正在清理 LaunchPad 设置",
2885+
"- Unpatching complete":"- 取消修补完成",
2886+
"\nPlease reboot the machine for patches to take effect":"\n请重启机器以使补丁生效",
2887+
"- Patching complete":"- 修补完成",
2888+
"Note: Apple will require you to open System Preferences -> Security to allow the new kernel extensions to be loaded":"注意:Apple 将要求您打开系统偏好设置 -> 安全以允许加载新的内核扩展",
2889+
"- Rebuilding dyld shared cache":"- 正在重建 dyld 共享缓存",
2890+
"- Rebuilding preboot kernel cache":"- 正在重建预启动内核缓存",
2891+
"- Found SkylightPlugins folder, removing old plugins":"- 找到 SkylightPlugins 文件夹,正在删除旧插件",
2892+
"- Creating SkylightPlugins folder":"- 正在创建 SkylightPlugins 文件夹",
2893+
"- Removing non-Metal Enforcement Preference: {arg}":"- 正在删除非 Metal 强制偏好设置: {arg}",
2894+
"- Writing patchset information to Root Volume":"- 正在将补丁集信息写入根卷",
2895+
"- Running patches for {model}":"- 正在为 {model} 运行补丁",
2896+
"- Installing Patchset: {patch}":"- 正在安装补丁集: {patch}",
2897+
"- Remove Files at: {remove_patch_directory}":"- 正在删除文件位置: {remove_patch_directory}",
2898+
"- Handling Installs in: {install_patch_directory}":"- 正在处理安装位置: {install_patch_directory}",
2899+
"- Running Process as Root:\n{process}":"- 正在以 Root 身份运行进程:\n{process}",
2900+
"- Running Process:\n{process}":"- 正在运行进程:\n{process}",
2901+
"Failed to find MetalLibSupportPkg: {error_msg}":"找不到 MetalLibSupportPkg: {error_msg}",
2902+
"Using MetalLibSupportPkg: {metallib_installed_path}":"正在使用 MetalLibSupportPkg: {metallib_installed_path}",
2903+
"Could not download MetalLibSupportPkg: {error_msg}":"无法下载 MetalLibSupportPkg: {error_msg}",
2904+
"Failed to install MetalLibSupportPkg":"安装 MetalLibSupportPkg 失败",
2905+
"- Running Preflight Checks before patching":"- 正在运行修补前的预检检查",
2906+
"- Finished Preflight, starting patching":"- 预检完成,开始修补",
2907+
"- Starting Patch Process":"- 开始修补过程",
2908+
"- Determining Required Patch set for Darwin {detected_os}":"- 正在确定 Darwin {detected_os} 所需的补丁集",
2909+
"- No Root Patches required for your machine!":"- 您的机器不需要根补丁!",
2910+
"- Verifying whether Root Patching possible":"- 正在验证根修补是否可能",
2911+
"- Cannot continue with patching!!!":"- 无法继续修补!!!",
2912+
"- Patcher is capable of patching":"- 修补程序能够进行修补",
2913+
"- Critical resources missing, cannot continue with patching!!!":"- 关键资源缺失,无法继续修补!!!",
2914+
"- Failed to mount root volume, cannot continue with patching!!!":"- 挂载根卷失败,无法继续修补!!!",
2915+
"- Failed sanity checks, cannot continue with patching!!!":"- 完整性检查失败,无法继续修补!!!",
2916+
"- Please ensure that you do not have any updates pending":"- 请确保您没有任何待处理的更新",
2917+
"- Starting Unpatch Process":"- 开始取消修补过程",
2918+
"- Cannot continue with unpatching!!!":"- 无法继续取消修补!!!",
2919+
"- Failed to mount root volume, cannot continue with unpatching!!!":"- 挂载根卷失败,无法继续取消修补!!!",
2920+
"Failed to find {source_file}":"找不到 {source_file}",
2921+
"Failed to find MetalLibSupportPkg: {error_msg}":"找不到 MetalLibSupportPkg: {error_msg}",
2922+
"Could not download MetalLibSupportPkg: {error_msg}":"无法下载 MetalLibSupportPkg: {error_msg}",
2923+
"Failed to install MetalLibSupportPkg":"安装 MetalLibSupportPkg 失败",
2924+
"Unknown Dynamic Patchset: {variant}":"未知的动态补丁集: {variant}"
2925+
}
2926+
return trans
2927+
2928+
def sys_patch_helpers(self):
2929+
if self.language_point=="English":
2930+
trans={
2931+
"Found unsupported Board ID {reported_board_id}, performing AppleIntelSNBGraphicsFB bin patching":"Found unsupported Board ID {reported_board_id}, performing AppleIntelSNBGraphicsFB bin patching",
2932+
"Replacing {board_to_patch} with {reported_board_id}":"Replacing {board_to_patch} with {reported_board_id}",
2933+
"Error: Board ID {reported_board_id} is longer than {board_to_patch}":"Error: Board ID {reported_board_id} is longer than {board_to_patch}",
2934+
"Error: Could not find {path}":"Error: Could not find {path}",
2935+
"Disabling WindowServer Caching":"Disabling WindowServer Caching",
2936+
"Installing Kernel Collection syncing utility":"Installing Kernel Collection syncing utility",
2937+
"- Failed to install RSRRepair":"- Failed to install RSRRepair",
2938+
"Merging GPUCompiler.framework libraries to match binary":"Merging GPUCompiler.framework libraries to match binary",
2939+
"Host's Board ID is longer than the kext's Board ID, cannot patch!!!":"Host's Board ID is longer than the kext's Board ID, cannot patch!!!",
2940+
"Failed to find AppleIntelSNBGraphicsFB.kext, cannot patch!!!":"Failed to find AppleIntelSNBGraphicsFB.kext, cannot patch!!!",
2941+
"Failed to find GPUCompiler libraries at {dest_dir}":"Failed to find GPUCompiler libraries at {dest_dir}"
2942+
}
2943+
elif self.language_point=="简体中文":
2944+
trans={
2945+
"Found unsupported Board ID {reported_board_id}, performing AppleIntelSNBGraphicsFB bin patching":"发现不支持的 Board ID {reported_board_id},正在执行 AppleIntelSNBGraphicsFB 二进制修补",
2946+
"Replacing {board_to_patch} with {reported_board_id}":"正在将 {board_to_patch} 替换为 {reported_board_id}",
2947+
"Error: Board ID {reported_board_id} is longer than {board_to_patch}":"错误:Board ID {reported_board_id} 比 {board_to_patch} 长",
2948+
"Error: Could not find {path}":"错误:找不到 {path}",
2949+
"Disabling WindowServer Caching":"正在禁用 WindowServer 缓存",
2950+
"Installing Kernel Collection syncing utility":"正在安装内核集合同步工具",
2951+
"- Failed to install RSRRepair":"- 安装 RSRRepair 失败",
2952+
"Merging GPUCompiler.framework libraries to match binary":"正在合并 GPUCompiler.framework 库以匹配二进制文件",
2953+
"Host's Board ID is longer than the kext's Board ID, cannot patch!!!":"主机的 Board ID 比 kext 的 Board ID 长,无法修补!!!",
2954+
"Failed to find AppleIntelSNBGraphicsFB.kext, cannot patch!!!":"找不到 AppleIntelSNBGraphicsFB.kext,无法修补!!!",
2955+
"Failed to find GPUCompiler libraries at {dest_dir}":"在 {dest_dir} 找不到 GPUCompiler 库"
2956+
}
2957+
return trans
2958+
28022959
class TranslateLanguage_efi_builder:
28032960
def __init__(self, global_constants: Constants) -> None:
28042961
self.file_name: str = ".com.hackdoc.oclp-r.plist"

oclp_r/sys_patch/kernelcache/kernel_collection/auxiliary.py

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,18 @@
77

88
from ..base.cache import BaseKernelCache
99
from ....support import subprocess_wrapper
10+
from ....support import translate_language
1011

1112

1213
class AuxiliaryKernelCollection(BaseKernelCache):
1314

14-
def __init__(self, mount_location: str) -> None:
15+
def __init__(self, mount_location: str, global_constants=None) -> None:
1516
self.mount_location = mount_location
17+
self.global_constants = global_constants
18+
if global_constants:
19+
self.trans = translate_language.TranslateLanguage_sys_patch(global_constants).kernelcache()
20+
else:
21+
self.trans = None
1622

1723

1824
def _kmutil_arguments(self) -> list[str]:
@@ -40,28 +46,43 @@ def _force_auxiliary_usage(self) -> bool:
4046
collection to be used.
4147
"""
4248

43-
logging.info("- Forcing Auxiliary Kernel Collection usage")
49+
if self.trans:
50+
logging.info(self.trans["- Forcing Auxiliary Kernel Collection usage"])
51+
else:
52+
logging.info("- Forcing Auxiliary Kernel Collection usage")
4453
result = subprocess_wrapper.run_as_root(["/usr/bin/killall", "syspolicyd", "kernelmanagerd"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
4554
if result.returncode != 0:
46-
logging.info("- Unable to kill syspolicyd and kernelmanagerd")
55+
if self.trans:
56+
logging.info(self.trans["- Unable to kill syspolicyd and kernelmanagerd"])
57+
else:
58+
logging.info("- Unable to kill syspolicyd and kernelmanagerd")
4759
subprocess_wrapper.log(result)
4860
return False
4961

5062
for file in ["KextPolicy", "KextPolicy-shm", "KextPolicy-wal"]:
5163
result = subprocess_wrapper.run_as_root(["/bin/rm", f"/private/var/db/SystemPolicyConfiguration/{file}"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
5264
if result.returncode != 0:
53-
logging.info(f"- Unable to remove {file}")
65+
if self.trans:
66+
logging.info(self.trans["- Unable to remove {file}"].format(file=file))
67+
else:
68+
logging.info(f"- Unable to remove {file}")
5469
subprocess_wrapper.log(result)
5570
return False
5671

5772
return True
5873

5974

6075
def rebuild(self) -> None:
61-
logging.info("- Building new Auxiliary Kernel Collection")
76+
if self.trans:
77+
logging.info(self.trans["- Building new Auxiliary Kernel Collection"])
78+
else:
79+
logging.info("- Building new Auxiliary Kernel Collection")
6280
result = subprocess_wrapper.run_as_root(self._kmutil_arguments(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
6381
if result.returncode != 0:
64-
logging.info("- Unable to build Auxiliary Kernel Collection")
82+
if self.trans:
83+
logging.info(self.trans["- Unable to build Auxiliary Kernel Collection"])
84+
else:
85+
logging.info("- Unable to build Auxiliary Kernel Collection")
6586
subprocess_wrapper.log(result)
6687
return False
6788

0 commit comments

Comments
 (0)