Skip to content

Instantly share code, notes, and snippets.

@Laicure
Last active August 31, 2025 14:45
Show Gist options
  • Select an option

  • Save Laicure/701d119afe37345998a7a3dfb60b3b8a to your computer and use it in GitHub Desktop.

Select an option

Save Laicure/701d119afe37345998a7a3dfb60b3b8a to your computer and use it in GitHub Desktop.

Revisions

  1. Laicure revised this gist Aug 31, 2025. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions RemoveLocalizations.scpt
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,17 @@
    on run
    -- 0) Count how many nonEnglish .lproj folders there are
    -- 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 'Base.lproj' -print | wc -l"
    set countBefore to do shell script countCmd -- this is already text
    "! -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 nonEnglish .lproj folders found; nothing to delete." with title "Cleanup Complete"
    display notification "No non-English .lproj folders found; nothing to delete." with title "Cleanup Complete"
    return
    end if

    -- 1) Cleanup: delete them with sudo
    -- 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 'Base.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

    -- 2) Notify how many were deleted
    display notification (countBefore & " nonEnglish .lproj folders deleted.") with title "Cleanup Complete"
    -- Notify how many were deleted
    display notification (countBefore & " non-English .lproj folders deleted.") with title "Cleanup Complete"
    end run
  2. Laicure revised this gist Jul 23, 2025. 1 changed file with 26 additions and 27 deletions.
    53 changes: 26 additions & 27 deletions RemoveLocalizations.scpt
    Original file line number Diff line number Diff line change
    @@ -1,30 +1,29 @@
    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:
    -- 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

    " & leftovers buttons {"OK"} default button 1 with title "Leftovers Detected"
    end if
    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
  3. Laicure renamed this gist Jul 16, 2025. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. Laicure created this gist Jul 16, 2025.
    30 changes: 30 additions & 0 deletions RemoveLocalizations.app
    Original 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