1
0
Files
electrum/contrib/build_locale.sh
SomberNight 3567a4cfb0 mv git submodule electrum-locale from contrib to electrum/locale
- this merges `contrib/deterministic-build/locale` and `electrum/locale`
- it is now once again possible have translations when running from a local git clone
    - which was already possible in the past before crowdin removed their unauthenticated APIs
        - see https://github.com/spesmilo/electrum/issues/9531
    - however, the translations available are the often-old frozen strings from electrum-locale
        - while previously one could just download the latest strings from crowdin
2025-04-14 17:18:30 +00:00

31 lines
756 B
Bash
Executable File

#!/bin/bash
#
# This script converts human-readable (.po) locale files to compiled (.mo) locale files.
set -e
if [[ ! -d "$1" || -z "$2" ]]; then
echo "usage: $0 locale_source_dir locale_dest_dir"
echo " The dirs can match, to build in place."
# ^ note: these are the paths to the "inner" locale/ dir
exit 1
fi
# convert $1 and $2 to abs paths
SRC_DIR="$(realpath "$1" 2> /dev/null || grealpath "$1")"
DST_DIR="$(realpath "$2" 2> /dev/null || grealpath "$2")"
if ! which msgfmt > /dev/null 2>&1; then
echo "Please install gettext"
exit 1
fi
cd "$SRC_DIR"
mkdir -p "$DST_DIR"
for i in *; do
dir="$DST_DIR/$i/LC_MESSAGES"
mkdir -p "$dir"
(msgfmt --output-file="$dir/electrum.mo" "$i/electrum.po" || true)
done