Last active
August 31, 2025 14:45
-
-
Save Laicure/701d119afe37345998a7a3dfb60b3b8a to your computer and use it in GitHub Desktop.
Revisions
-
Laicure revised this gist
Aug 31, 2025 . 1 changed file with 8 additions and 8 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,17 @@ on run -- Count non-English .lproj folders (exclude any en* variants, English, and Base) set countCmd to "find /Applications -type d -name '*.lproj' " & ¬ "! -iname 'en*.lproj' ! -iname 'english.lproj' ! -iname 'base.lproj' -print | wc -l" set countBefore to do shell script countCmd -- text if countBefore is "0" then display notification "No non-English .lproj folders found; nothing to delete." with title "Cleanup Complete" return end if -- Cleanup: delete them with admin privileges, echoing deletions (output not visible in the .app UI) set cleanupCmd to "find /Applications -type d -name '*.lproj' " & ¬ "! -iname 'en*.lproj' ! -iname 'english.lproj' ! -iname 'base.lproj' " & ¬ "-print0 | while IFS= read -r -d '' DIR; do " & ¬ "P=\"$DIR\"; " & ¬ "while [[ \"$P\" != \"/\" && ! ( \"$P\" == *.app || \"$P\" == *.framework || \"$P\" == *.bundle ) ]]; do " & ¬ @@ -24,6 +24,6 @@ on run "done" do shell script cleanupCmd with administrator privileges -- Notify how many were deleted display notification (countBefore & " non-English .lproj folders deleted.") with title "Cleanup Complete" end run -
Laicure revised this gist
Jul 23, 2025 . 1 changed file with 26 additions and 27 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,30 +1,29 @@ on run -- 0) Count how many non‑English .lproj folders there are set countCmd to "find /Applications -type d -name '*.lproj' " & ¬ "! -iname 'en.lproj' ! -iname 'Base.lproj' -print | wc -l" set countBefore to do shell script countCmd -- this is already text if countBefore is "0" then display notification "No non‑English .lproj folders found; nothing to delete." with title "Cleanup Complete" return end if -- 1) Cleanup: delete them with sudo 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) Notify how many were deleted display notification (countBefore & " non‑English .lproj folders deleted.") with title "Cleanup Complete" end run -
Laicure renamed this gist
Jul 16, 2025 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
Laicure created this gist
Jul 16, 2025 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ 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