2828from . import (
2929 utilities ,
3030 defaults ,
31- validation
31+ validation ,
32+ translate_language
3233)
3334
3435
@@ -38,6 +39,7 @@ class arguments:
3839
3940 def __init__ (self , global_constants : constants .Constants ) -> None :
4041 self .constants : constants .Constants = global_constants
42+ self .trans = translate_language .TranslateLanguage (self .constants ).arguements ()
4143
4244 self .args = utilities .check_cli_args ()
4345
@@ -82,7 +84,7 @@ def _validation_handler(self) -> None:
8284 """
8385 Enter validation mode
8486 """
85- logging .info ("Set Validation Mode" )
87+ logging .info (self . trans [ "Set Validation Mode" ] )
8688 validation .PatcherValidation (self .constants )
8789
8890
@@ -91,9 +93,9 @@ def _sys_patch_handler(self) -> None:
9193 Start root volume patching
9294 """
9395
94- logging .info ("Set System Volume patching" )
96+ logging .info (self . trans [ "Set System Volume patching" ] )
9597 if "Library/InstallerSandboxes/" in str (self .constants .payload_path ):
96- logging .info ("- Running from Installer Sandbox, blocking OS updaters" )
98+ logging .info (self . trans [ "- Running from Installer Sandbox, blocking OS updaters" ] )
9799 thread = threading .Thread (target = sys_patch .PatchSysVolume (self .constants .custom_model or self .constants .computer .real_model , self .constants , None ).start_patch )
98100 thread .start ()
99101 while thread .is_alive ():
@@ -107,7 +109,7 @@ def _sys_unpatch_handler(self) -> None:
107109 """
108110 Start root volume unpatching
109111 """
110- logging .info ("Set System Volume unpatching" )
112+ logging .info (self . trans [ "Set System Volume unpatching" ] )
111113 sys_patch .PatchSysVolume (self .constants .custom_model or self .constants .computer .real_model , self .constants , None ).start_unpatch ()
112114
113115
@@ -116,25 +118,25 @@ def _sys_patch_auto_handler(self) -> None:
116118 Start root volume auto patching
117119 """
118120
119- logging .info ("Set Auto patching" )
121+ logging .info (self . trans [ "Set Auto patching" ] )
120122 StartAutomaticPatching (self .constants ).start_auto_patch ()
121123
122124
123125 def _prepare_for_update_handler (self ) -> None :
124126 """
125127 Prepare host for macOS update
126128 """
127- logging .info ("Preparing host for macOS update" )
129+ logging .info (self . trans [ "Preparing host for macOS update" ] )
128130
129131 os_data = utilities .fetch_staged_update (variant = "Update" )
130132 if os_data [0 ] is None :
131- logging .info ("No update staged, skipping" )
133+ logging .info (self . trans [ "No update staged, skipping" ] )
132134 return
133135
134136 os_version = os_data [0 ]
135137 os_build = os_data [1 ]
136138
137- logging .info (f"Preparing for update to { os_version } ({ os_build } )" )
139+ logging .info (f"{ self . trans [ ' Preparing for update to' ] } { os_version } ({ os_build } )" )
138140
139141 self ._clean_le_handler ()
140142
@@ -145,7 +147,7 @@ def _cache_os_handler(self) -> None:
145147 """
146148 results = subprocess .run (["/bin/ps" , "-ax" ], stdout = subprocess .PIPE )
147149 if results .stdout .decode ("utf-8" ).count ("OCLP-R --cache_os" ) > 1 :
148- logging .info ("Another instance of OS caching is running, exiting" )
150+ logging .info (self . trans [ "Another instance of OS caching is running, exiting" ] )
149151 return
150152
151153 gui_entry .EntryPoint (self .constants ).start (entry = gui_entry .SupportedEntryPoints .OS_CACHE )
@@ -160,100 +162,100 @@ def _clean_le_handler(self) -> None:
160162 if self .constants .detected_os < os_data .os_data .sonoma :
161163 return
162164
163- logging .info ("Cleaning /Library/Extensions" )
165+ logging .info (self . trans [ "Cleaning /Library/Extensions" ] )
164166
165167 for kext in Path ("/Library/Extensions" ).glob ("*.kext" ):
166168 if not Path (f"{ kext } /Contents/Info.plist" ).exists ():
167169 continue
168170 try :
169171 kext_plist = plistlib .load (open (f"{ kext } /Contents/Info.plist" , "rb" ))
170172 except Exception as e :
171- logging .info (f" - Failed to load plist for { kext .name } : { e } " )
173+ logging .info (f" { self . trans [ ' - Failed to load plist for' ] } { kext .name } : { e } " )
172174 continue
173175 if "GPUCompanionBundles" not in kext_plist :
174176 continue
175- logging .info (f" - Removing { kext .name } " )
177+ logging .info (f" { self . trans [ ' - Removing' ] } { kext .name } " )
176178 subprocess_wrapper .run_as_root (["/bin/rm" , "-rf" , kext ])
177179
178180
179181 def _build_handler (self ) -> None :
180182 """
181183 Start config building process
182184 """
183- logging .info ("Set OpenCore Build" )
185+ logging .info (self . trans [ "Set OpenCore Build" ] )
184186
185187 if self .args .model :
186188 if self .args .model :
187- logging .info (f"- Using custom model: { self .args .model } " )
189+ logging .info (f"{ self . trans [ ' - Using custom model:' ] } { self .args .model } " )
188190 self .constants .custom_model = self .args .model
189191 defaults .GenerateDefaults (self .constants .custom_model , False , self .constants )
190192 elif self .constants .computer .real_model not in model_array .SupportedSMBIOS and self .constants .allow_oc_everywhere is False :
191193 logging .info (
192- """Your model is not supported by this patcher for running unsupported OSes!"
194+ self . trans [ """Your model is not supported by this patcher for running unsupported OSes!
193195
194- If you plan to create the USB for another machine, please select the "Change Model" option in the menu."""
196+ If you plan to create the USB for another machine, please select the "Change Model" option in the menu.""" ]
195197 )
196198 sys .exit (1 )
197199 else :
198- logging .info (f"- Using detected model: { self .constants .computer .real_model } " )
200+ logging .info (f"{ self . trans [ ' - Using detected model:' ] } { self .constants .computer .real_model } " )
199201 defaults .GenerateDefaults (self .constants .custom_model , True , self .constants )
200202
201203 if self .args .verbose :
202- logging .info ("- Set verbose configuration" )
204+ logging .info (self . trans [ "- Set verbose configuration" ] )
203205 self .constants .verbose_debug = True
204206 else :
205207 self .constants .verbose_debug = False # Override Defaults detected
206208
207209 if self .args .debug_oc :
208- logging .info ("- Set OpenCore DEBUG configuration" )
210+ logging .info (self . trans [ "- Set OpenCore DEBUG configuration" ] )
209211 self .constants .opencore_debug = True
210212
211213 if self .args .debug_kext :
212- logging .info ("- Set kext DEBUG configuration" )
214+ logging .info (self . trans [ "- Set kext DEBUG configuration" ] )
213215 self .constants .kext_debug = True
214216
215217 if self .args .hide_picker :
216- logging .info ("- Set HidePicker configuration" )
218+ logging .info (self . trans [ "- Set HidePicker configuration" ] )
217219 self .constants .showpicker = False
218220
219221 if self .args .disable_sip :
220- logging .info ("- Set Disable SIP configuration" )
222+ logging .info (self . trans [ "- Set Disable SIP configuration" ] )
221223 self .constants .sip_status = False
222224 else :
223225 self .constants .sip_status = True # Override Defaults detected
224226
225227 if self .args .disable_smb :
226- logging .info ("- Set Disable SecureBootModel configuration" )
228+ logging .info (self . trans [ "- Set Disable SecureBootModel configuration" ] )
227229 self .constants .secure_status = False
228230 else :
229231 self .constants .secure_status = True # Override Defaults detected
230232
231233 if self .args .vault :
232- logging .info ("- Set Vault configuration" )
234+ logging .info (self . trans [ "- Set Vault configuration" ] )
233235 self .constants .vault = True
234236
235237 if self .args .firewire :
236- logging .info ("- Set FireWire Boot configuration" )
238+ logging .info (self . trans [ "- Set FireWire Boot configuration" ] )
237239 self .constants .firewire_boot = True
238240
239241 if self .args .nvme :
240- logging .info ("- Set NVMe Boot configuration" )
242+ logging .info (self . trans [ "- Set NVMe Boot configuration" ] )
241243 self .constants .nvme_boot = True
242244
243245 if self .args .wlan :
244- logging .info ("- Set Wake on WLAN configuration" )
246+ logging .info (self . trans [ "- Set Wake on WLAN configuration" ] )
245247 self .constants .enable_wake_on_wlan = True
246248
247249 if self .args .disable_tb :
248- logging .info ("- Set Disable Thunderbolt configuration" )
250+ logging .info (self . trans [ "- Set Disable Thunderbolt configuration" ] )
249251 self .constants .disable_tb = True
250252
251253 if self .args .force_surplus :
252- logging .info ("- Forcing SurPlus override configuration" )
254+ logging .info (self . trans [ "- Forcing SurPlus override configuration" ] )
253255 self .constants .force_surplus = True
254256
255257 if self .args .moderate_smbios :
256- logging .info ("- Set Moderate SMBIOS Patching configuration" )
258+ logging .info (self . trans [ "- Set Moderate SMBIOS Patching configuration" ] )
257259 self .constants .serial_settings = "Moderate"
258260
259261 if self .args .smbios_spoof :
@@ -264,10 +266,10 @@ def _build_handler(self) -> None:
264266 elif self .args .smbios_spoof == "Advanced" :
265267 self .constants .serial_settings = "Advanced"
266268 else :
267- logging .info (f"- Unknown SMBIOS arg passed: { self .args .smbios_spoof } " )
269+ logging .info (f"{ self . trans [ ' - Unknown SMBIOS arg passed:' ] } { self .args .smbios_spoof } " )
268270
269271 if self .args .support_all :
270- logging .info ("- Building for natively supported model" )
272+ logging .info (self . trans [ "- Building for natively supported model" ] )
271273 self .constants .allow_oc_everywhere = True
272274 self .constants .serial_settings = "None"
273275
0 commit comments