session-ios/Session/Meta/Translations/bin/pull-translations

47 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -x
set -e
BIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $BIN_DIR/..
# Pull all translations which are at least 80% complete
tx pull -a --minimum-perc=80
# Legacy hack: pull *any existing* translations regardless of their completion.
# Once supported, we don't want to drop any translations.
tx pull --force
for dir in *.lproj
do
# en.lproj is already utf-8
if [[ "$dir" = "en.lproj" ]]; then
continue
fi
pushd $dir
# Transifex pulls utf-16, but our string linting script needs utf-8.
# Plus we can see the string diffs in GH this way.
iconv -f utf-16 -t utf-8 Localizable.strings > Localizable.strings.utf8
mv Localizable.strings.utf8 Localizable.strings
popd
done
# Get and build iStringsCheck from https://github.com/FredericJacobs/iStringsCheck
# This does some checks to make sure all strings are present and that interpolated strings have the right number of arguments
LINT_CMD=../../../l10n_lint/target/debug/l10n_lint
if [ -e $LINT_CMD ]
then
$LINT_CMD en.lproj/Localizable.strings .
else
echo "Missing string linter. See: https://github.com:WhisperSystems/l10n_lint"
exit 1
fi
echo "Make sure you register any new localizations in XCode! (Go to Project > Signal > Localizations > Add Localizations)"