scripts/localize.sh
23 lines · 925 bytes · executable
1#!/bin/sh
2# Compiles l10n/Localizable.xcstrings into the .lproj folders of each bundle folder given (an
3# app's Contents/Resources, an iOS app or extension folder). English is the source language:
4# its folder is empty, so the keys show as they are. With --developer-id, the DeveloperID table
5# too: the license and update strings, which only the Developer ID Mac app shows.
6# Usage: scripts/localize.sh [--developer-id] <folder>...
7set -eu
8
9cd "$(dirname "$0")/.."
10work="$(mktemp -d)"
11xcrun xcstringstool compile l10n/Localizable.xcstrings --output-directory "$work" > /dev/null
12if [ "${1:-}" = --developer-id ]; then
13 shift
14 xcrun xcstringstool compile l10n/DeveloperID.xcstrings --output-directory "$work" > /dev/null
15fi
16mkdir -p "$work/en.lproj"
17for folder in "$@"; do
18 for lproj in "$work"/*.lproj; do
19 rm -rf "$folder/$(basename "$lproj")"
20 cp -R "$lproj" "$folder/"
21 done
22done
23rm -rf "$work"