1
0

build: refactor out locale generation into build_locale.sh

This commit is contained in:
yanmaani
2021-12-10 12:00:00 +00:00
parent 0fca35fa40
commit 45b8f11c68
2 changed files with 19 additions and 12 deletions

View File

@@ -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
View 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