build: refactor out locale generation into build_locale.sh
This commit is contained in:
@@ -6,7 +6,7 @@ PROJECT_ROOT="$(dirname "$(readlink -e "$0")")/../../.."
|
||||
CONTRIB="$PROJECT_ROOT/contrib"
|
||||
CONTRIB_SDIST="$CONTRIB/build-linux/sdist"
|
||||
DISTDIR="$PROJECT_ROOT/dist"
|
||||
LOCALE="$PROJECT_ROOT/electrum/locale/"
|
||||
LOCALE="$PROJECT_ROOT/electrum/locale"
|
||||
|
||||
. "$CONTRIB"/build_tools_util.sh
|
||||
|
||||
@@ -24,21 +24,12 @@ python3 -m pip install --upgrade pip
|
||||
git submodule update --init
|
||||
|
||||
(
|
||||
cd "$CONTRIB/deterministic-build/electrum-locale/"
|
||||
if ! which msgfmt > /dev/null 2>&1; then
|
||||
echo "Please install gettext"
|
||||
exit 1
|
||||
fi
|
||||
# We include both source (.po) and compiled (.mo) locale files in the source dist.
|
||||
# Maybe we should exclude the compiled locale files? see https://askubuntu.com/a/144139
|
||||
# (also see MANIFEST.in)
|
||||
rm -rf "$LOCALE"
|
||||
for i in ./locale/*; do
|
||||
dir="$PROJECT_ROOT/electrum/$i/LC_MESSAGES"
|
||||
mkdir -p "$dir"
|
||||
msgfmt --output-file="$dir/electrum.mo" "$i/electrum.po" || true
|
||||
cp $i/electrum.po "$PROJECT_ROOT/electrum/$i/electrum.po"
|
||||
done
|
||||
cp -r "$CONTRIB/deterministic-build/electrum-locale/locale/" "$LOCALE/"
|
||||
"$CONTRIB/build_locale.sh" "$LOCALE"
|
||||
)
|
||||
|
||||
(
|
||||
|
||||
16
contrib/build_locale.sh
Executable file
16
contrib/build_locale.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "usage: $0 path/to/locale"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! which msgfmt > /dev/null 2>&1; then
|
||||
echo "Please install gettext"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for i in "$1/"*; do
|
||||
mkdir -p "$i/LC_MESSAGES"
|
||||
(msgfmt --output-file="$i/LC_MESSAGES/electrum.mo" "$i/electrum.po" || true)
|
||||
done
|
||||
Reference in New Issue
Block a user