Last active
August 31, 2025 14:45
-
-
Save Laicure/701d119afe37345998a7a3dfb60b3b8a to your computer and use it in GitHub Desktop.
removes non-english (retains base) localizations on MacOS. Used for Apple Script and export as Application.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on run | |
| -- 1) Cleanup: delete all non‑English .lproj under /Applications | |
| set cleanupCmd to "find /Applications -type d -name '*.lproj' " & ¬ | |
| "! -iname 'en.lproj' ! -iname 'Base.lproj' " & ¬ | |
| "-print0 | while IFS= read -r -d '' DIR; do " & ¬ | |
| "P=\"$DIR\"; " & ¬ | |
| "while [[ \"$P\" != \"/\" && ! ( \"$P\" == *.app || \"$P\" == *.framework || \"$P\" == *.bundle ) ]]; do " & ¬ | |
| "P=${P%/*}; done; " & ¬ | |
| "NAME=$(basename \"$P\" .app); " & ¬ | |
| "NAME=$(basename \"$NAME\" .framework); " & ¬ | |
| "NAME=$(basename \"$NAME\" .bundle); " & ¬ | |
| "LANG=$(basename \"$DIR\" .lproj); " & ¬ | |
| "echo \"Deleting $NAME $LANG\"; rm -rf \"$DIR\"; " & ¬ | |
| "done" | |
| do shell script cleanupCmd with administrator privileges | |
| -- 2) Verification: find any leftovers | |
| set checkCmd to "find /Applications -type d -name '*.lproj' " & ¬ | |
| "! -iname 'en.lproj' ! -iname 'Base.lproj' -print" | |
| set leftovers to do shell script checkCmd | |
| -- 3) Notify or report leftovers | |
| if leftovers = "" then | |
| display notification "No non‑English .lproj folders remain." with title "Cleanup Complete" | |
| else | |
| display dialog "Leftover folders found: | |
| " & leftovers buttons {"OK"} default button 1 with title "Leftovers Detected" | |
| end if | |
| end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment