1212
1313from .. import constants
1414
15- from ..support import generate_smbios
15+ from ..support import generate_smbios , translate_language
1616from ..detections import device_probe
1717
1818from ..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