Skip to content

Commit 83b7230

Browse files
committed
Add more translations
1 parent c09dc4e commit 83b7230

File tree

13 files changed

+546
-213
lines changed

13 files changed

+546
-213
lines changed

.github/workflows/build-app-wxpython.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ jobs:
1313
name: Build wxPython
1414
runs-on: macos-26
1515
if: github.repository_owner == 'hackdoc'
16-
permissions:
17-
contents: write
1816
env:
1917
# GitHub Information
2018
branch: ${{ github.ref }}
@@ -53,7 +51,25 @@ jobs:
5351
- name: Prepare Package (--prepare-package)
5452
run: >
5553
/Library/Frameworks/Python.framework/Versions/3.11/bin/python3 Build-Project.command
54+
--run-as-individual-steps
5655
--prepare-package
56+
- name: Upload AutoPkg Package to Artifacts
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: AutoPkg-Assets.pkg
60+
path: ./dist/AutoPkg-Assets.pkg
61+
62+
- name: Upload Installation Package to Artifacts
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: OCLP-R.pkg
66+
path: ./dist/OCLP-R.pkg
67+
68+
- name: Upload Uninstaller Package to Artifacts
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: OCLP-R-Uninstaller.pkg
72+
path: ./dist/OCLP-R-Uninstaller.pkg
5773
- name: Delete previous pre-release
5874
if: github.event_name == 'push'
5975
uses: dev-drprasad/delete-older-releases@v0.3.4
@@ -66,8 +82,7 @@ jobs:
6682
if: github.event_name == 'push'
6783
uses: softprops/action-gh-release@v2
6884
with:
69-
#tag_name: push-${{ github.sha }}
70-
tag_name: 3.0.1
85+
tag_name: 3.0.2
7186
name: 3.0.1 Tahoe Test
7287
body: ${{ github.event.head_commit.message }}
7388
prerelease: true

oclp_r/application_entry.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ class OpenCoreLegacyPatcher:
3636

3737
def __init__(self) -> None:
3838
self.constants: constants.Constants = constants.Constants()
39-
self.trans: dict = TranslateLanguage(self.constants).application_entry()
39+
self.trans= TranslateLanguage(self.constants).application_entry()
40+
41+
4042

4143
logging_handler.InitializeLoggingSupport(self.constants)
4244

oclp_r/constants.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
import getpass
1313
class Constants:
1414
def __init__(self) -> None:
15+
self.language_key: list = ["简体中文","English"]
16+
17+
self.language_option: str = "English" #en:English zh:中文
1518
#API Link
1619
self.kdk_api_link: str = ""
1720
self.metallib_api_link: str = ""
@@ -252,7 +255,10 @@ def __init__(self) -> None:
252255
self.apfs_trim_timeout: bool = True # Set APFS Trim timeout
253256
self.custom_sip_value: int = None # Set custom SIP value
254257
self.allow_apfs_aligned_patch: bool = True
255-
self.language_choose: int = 1 #1:en 0:zh
258+
259+
260+
261+
256262

257263
## Non-Metal OS support
258264
self.legacy_accel_support = [
@@ -269,7 +275,7 @@ def __init__(self) -> None:
269275
###https://gitapi.simplehac.top
270276
self.github_mirror: str = ""
271277
self.api_link()
272-
278+
273279
def api_link(self):
274280
if self.github_proxy_link!="SimpleHac":
275281
self.kdk_api_link="https://dortania.github.io/KdkSupportPkg/manifest.json"

oclp_r/efi_builder/graphics_audio.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ def _imac_mxm_patching(self) -> None:
490490
else:
491491
logging.info(self.trans["- Failed to find vendor"])
492492
elif not self.constants.custom_model and self.model in model_array.LegacyGPU and self.computer.dgpu:
493-
logging.info(f"- Detected dGPU: {utilities.friendly_hex(self.computer.dgpu.vendor_id)}:{utilities.friendly_hex(self.computer.dgpu.device_id)}")
493+
logging.info(self.trans["- Detected dGPU: "] + f"{utilities.friendly_hex(self.computer.dgpu.vendor_id)}:{utilities.friendly_hex(self.computer.dgpu.device_id)}")
494494
if self.computer.dgpu.arch in [
495495
device_probe.AMD.Archs.Legacy_GCN_7000,
496496
device_probe.AMD.Archs.Legacy_GCN_8000,

oclp_r/efi_builder/misc.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from .. import constants
1414

15-
from ..support import generate_smbios
15+
from ..support import generate_smbios, translate_language
1616
from ..detections import device_probe
1717

1818
from ..datasets import (
@@ -35,6 +35,8 @@ def __init__(self, model: str, global_constants: constants.Constants, config: di
3535
self.config: dict = config
3636
self.constants: constants.Constants = global_constants
3737
self.computer: device_probe.Computer = self.constants.computer
38+
self.translator = translate_language.TranslateLanguage_efi_builder(self.constants)
39+
self.trans = self.translator.misc()
3840

3941
self._build()
4042

@@ -73,7 +75,7 @@ def _feature_unlock_handling(self) -> None:
7375

7476
support.BuildSupport(self.model, self.constants, self.config).enable_kext("FeatureUnlock.kext", self.constants.featureunlock_version, self.constants.featureunlock_path)
7577
if self.constants.fu_arguments is not None and self.constants.fu_arguments != "":
76-
logging.info(f"- Adding additional FeatureUnlock args: {self.constants.fu_arguments}")
78+
logging.info(self.trans["- Adding additional FeatureUnlock args: {}"].format(self.constants.fu_arguments))
7779
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += self.constants.fu_arguments
7880

7981

@@ -86,7 +88,7 @@ def _restrict_events_handling(self) -> None:
8688
patch_args = ",".join(self._re_generate_patch_arguments())
8789

8890
if block_args != "":
89-
logging.info(f"- Setting RestrictEvents block arguments: {block_args}")
91+
logging.info(self.trans["- Setting RestrictEvents block arguments: {}"].format(block_args))
9092
support.BuildSupport(self.model, self.constants, self.config).enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
9193
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revblock"] = block_args
9294

@@ -95,7 +97,7 @@ def _restrict_events_handling(self) -> None:
9597
patch_args = "none"
9698

9799
if patch_args != "":
98-
logging.info(f"- Setting RestrictEvents patch arguments: {patch_args}")
100+
logging.info(self.trans["- Setting RestrictEvents patch arguments: {}"].format(patch_args))
99101
support.BuildSupport(self.model, self.constants, self.config).enable_kext("RestrictEvents.kext", self.constants.restrictevents_version, self.constants.restrictevents_path)
100102
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["revpatch"] = patch_args
101103

@@ -121,13 +123,13 @@ def _re_generate_block_arguments(self) -> list:
121123

122124
# Resolve memory error reporting on MacPro7,1 SMBIOS
123125
if self.model in model_array.MacPro:
124-
logging.info("- Disabling memory error reporting")
126+
logging.info(self.trans["- Disabling memory error reporting"])
125127
re_block_args.append("pcie")
126128

127129
# Resolve mediaanalysisd crashing on 3802 GPUs
128130
# Applicable for systems that are the primary iCloud Photos library host, with large amounts of unprocessed faces
129131
if self.constants.disable_mediaanalysisd is True:
130-
logging.info("- Disabling mediaanalysisd")
132+
logging.info(self.trans["- Disabling mediaanalysisd"])
131133
re_block_args.append("media")
132134

133135
return re_block_args
@@ -152,7 +154,7 @@ def _re_generate_patch_arguments(self) -> list:
152154
# Resolve CoreGraphics.framework crashing on Ivy Bridge in macOS 13.3+
153155
# Ref: https://github.com/acidanthera/RestrictEvents/pull/12
154156
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] == cpu_data.CPUGen.ivy_bridge.value:
155-
logging.info("- Fixing CoreGraphics support on Ivy Bridge")
157+
logging.info(self.trans["- Fixing CoreGraphics support on Ivy Bridge"])
156158
re_patch_args.append("f16c")
157159

158160
return re_patch_args
@@ -188,7 +190,7 @@ def _firewire_handling(self) -> None:
188190

189191
# Enable FireWire Boot Support
190192
# Applicable for both native FireWire and Thunderbolt to FireWire adapters
191-
logging.info("- Enabling FireWire Boot Support")
193+
logging.info(self.trans["- Enabling FireWire Boot Support"])
192194
support.BuildSupport(self.model, self.constants, self.config).enable_kext("IOFireWireFamily.kext", self.constants.fw_kext, self.constants.fw_family_path)
193195
support.BuildSupport(self.model, self.constants, self.config).enable_kext("IOFireWireSBP2.kext", self.constants.fw_kext, self.constants.fw_sbp2_path)
194196
support.BuildSupport(self.model, self.constants, self.config).enable_kext("IOFireWireSerialBusProtocolTransport.kext", self.constants.fw_kext, self.constants.fw_bus_path)
@@ -203,7 +205,7 @@ def _topcase_handling(self) -> None:
203205
# macOS 14.4 Beta 1 strips SPI-based top case support for Broadwell through Kaby Lake MacBooks (and MacBookAir6,x)
204206
if self.model.startswith("MacBook") and self.model in smbios_data.smbios_dictionary:
205207
if self.model.startswith("MacBookAir6") or (cpu_data.CPUGen.broadwell <= smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.CPUGen.kaby_lake):
206-
logging.info("- Enabling SPI-based top case support")
208+
logging.info(self.trans["- Enabling SPI-based top case support"])
207209
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleHSSPISupport.kext", self.constants.apple_spi_version, self.constants.apple_spi_path)
208210
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleHSSPIHIDDriver.kext", self.constants.apple_spi_hid_version, self.constants.apple_spi_hid_path)
209211
support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleTopCaseInjector.kext", self.constants.topcase_inj_version, self.constants.top_case_inj_path)
@@ -249,7 +251,7 @@ def _thunderbolt_handling(self) -> None:
249251
"""
250252

251253
if self.constants.disable_tb is True and self.model in ["MacBookPro11,1", "MacBookPro11,2", "MacBookPro11,3", "MacBookPro11,4", "MacBookPro11,5"]:
252-
logging.info("- Disabling 2013-2014 laptop Thunderbolt Controller")
254+
logging.info(self.trans["- Disabling 2013-2014 laptop Thunderbolt Controller"])
253255
if self.model in ["MacBookPro11,3", "MacBookPro11,5"]:
254256
# 15" dGPU models: IOACPIPlane:/_SB/PCI0@0/PEG1@10001/UPSB@0/DSB0@0/NHI0@0
255257
tb_device_path = "PciRoot(0x0)/Pci(0x1,0x1)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)"
@@ -295,7 +297,7 @@ def _usb_handling(self) -> None:
295297
(self.model in model_array.Missing_USB_Map or self.model in model_array.Missing_USB_Map_Ventura)
296298
or self.constants.serial_settings in ["Moderate", "Advanced"])
297299
):
298-
logging.info("- Adding USB-Map.kext and USB-Map-Tahoe.kext")
300+
logging.info(self.trans["- Adding USB-Map.kext and USB-Map-Tahoe.kext"])
299301
Path(self.constants.map_kext_folder).mkdir()
300302
Path(self.constants.map_kext_folder_tahoe).mkdir()
301303
Path(self.constants.map_contents_folder).mkdir()
@@ -324,7 +326,7 @@ def _usb_handling(self) -> None:
324326
smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.CPUGen.penryn.value or \
325327
self.model in ["MacPro4,1", "MacPro5,1", "Xserve3,1"]
326328
):
327-
logging.info("- Adding UHCI/OHCI USB support")
329+
logging.info(self.trans["- Adding UHCI/OHCI USB support"])
328330
shutil.copy(self.constants.apple_usb_11_injector_path, self.constants.kexts_path)
329331
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBOHCI.kext")["Enabled"] = True
330332
support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("USB1.1-Injector.kext/Contents/PlugIns/AppleUSBOHCIPCI.kext")["Enabled"] = True
@@ -341,19 +343,19 @@ def _debug_handling(self) -> None:
341343
"""
342344

343345
if self.constants.verbose_debug is True:
344-
logging.info("- Enabling Verbose boot")
346+
logging.info(self.trans["- Enabling Verbose boot"])
345347
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -v"
346348

347349
if self.constants.kext_debug is True:
348-
logging.info("- Enabling DEBUG Kexts")
350+
logging.info(self.trans["- Enabling DEBUG Kexts"])
349351
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -liludbgall liludump=90"
350352
# Disabled due to macOS Monterey crashing shortly after kernel init
351353
# Use DebugEnhancer.kext instead
352354
# self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " msgbuf=1048576"
353355
support.BuildSupport(self.model, self.constants, self.config).enable_kext("DebugEnhancer.kext", self.constants.debugenhancer_version, self.constants.debugenhancer_path)
354356

355357
if self.constants.opencore_debug is True:
356-
logging.info("- Enabling DEBUG OpenCore")
358+
logging.info(self.trans["- Enabling DEBUG OpenCore"])
357359
self.config["Misc"]["Debug"]["Target"] = 0x43
358360
self.config["Misc"]["Debug"]["DisplayLevel"] = 0x80000042
359361

@@ -363,23 +365,23 @@ def _general_oc_handling(self) -> None:
363365
General OpenCorePkg Handler
364366
"""
365367

366-
logging.info("- Adding OpenCanopy GUI")
368+
logging.info(self.trans["- Adding OpenCanopy GUI"])
367369
shutil.copy(self.constants.gui_path, self.constants.oc_folder)
368370
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("OpenCanopy.efi", "UEFI", "Drivers")["Enabled"] = True
369371
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("OpenRuntime.efi", "UEFI", "Drivers")["Enabled"] = True
370372
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("OpenLinuxBoot.efi", "UEFI", "Drivers")["Enabled"] = True
371373
support.BuildSupport(self.model, self.constants, self.config).get_efi_binary_by_path("ResetNvramEntry.efi", "UEFI", "Drivers")["Enabled"] = True
372374

373375
if self.constants.showpicker is False:
374-
logging.info("- Hiding OpenCore picker")
376+
logging.info(self.trans["- Hiding OpenCore picker"])
375377
self.config["Misc"]["Boot"]["ShowPicker"] = False
376378

377379
if self.constants.oc_timeout != 5:
378-
logging.info(f"- Setting custom OpenCore picker timeout to {self.constants.oc_timeout} seconds")
380+
logging.info(self.trans["- Setting custom OpenCore picker timeout to {self.constants.oc_timeout} seconds"].format(self=self))
379381
self.config["Misc"]["Boot"]["Timeout"] = self.constants.oc_timeout
380382

381383
if self.constants.vault is True:
382-
logging.info("- Setting Vault configuration")
384+
logging.info(self.trans["- Setting Vault configuration"])
383385
self.config["Misc"]["Security"]["Vault"] = "Secure"
384386

385387
def _t1_handling(self) -> None:
@@ -389,7 +391,7 @@ def _t1_handling(self) -> None:
389391
if self.model not in ["MacBookPro13,2", "MacBookPro13,3", "MacBookPro14,2", "MacBookPro14,3"]:
390392
return
391393

392-
logging.info("- Enabling T1 Security Chip support")
394+
logging.info(self.trans["- Enabling T1 Security Chip support"])
393395

394396
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Block"], "Identifier", "com.apple.driver.AppleSSE")["Enabled"] = True
395397
support.BuildSupport(self.model, self.constants, self.config).get_item_by_kv(self.config["Kernel"]["Block"], "Identifier", "com.apple.driver.AppleKeyStore")["Enabled"] = True

0 commit comments

Comments
 (0)