Open raspi opened 7 years ago
That looks like a bug.
Looking at this and your other ticket I'm wondering what your are trying to do. Can you explain what the problem is you're trying to solve?
I'm trying to write shell script which updates main default.pot and after that all other locales of Pyramid application.
#!/bin/bash -e
export APP=$1
export HERE="$(dirname $(readlink -f "$0"))"
export PYTHONDONTWRITEBYTECODE=1
export VENV="$HERE"
python3 -m venv $VENV
./rm_python_cache.sh
LOCALEFILES="$HERE/locale-files.txt"
echo "Generating file list.."
find "$HERE/$APP" -type f -iname "*.py" > "$LOCALEFILES"
find "$HERE/$APP" -type f -iname "*.pt" >> "$LOCALEFILES"
LOCALEDIR="$HERE/$APP/locale"
mkdir -p "$LOCALEDIR"
LOCALEPOT="$LOCALEDIR/default.pot"
strace -e trace=open $VENV/bin/pot-create --config "lang.conf" --files-from $LOCALEFILES --output "$LOCALEPOT"
#$VENV/bin/pot-create --config "lang.conf" --directory $APP/* --output "$LOCALEPOT"
echo ""
cd "$LOCALEDIR"
echo "Updating .po files.."
find . -type f -iname "*.po" -exec bash -c "echo 'file: {}'; msgmerge --update '{}' '$LOCALEPOT'" \;
echo ""
echo "Generating .mo files.."
find . -type f -iname "*.po" -print0 | while read -d '' -r file; do
MOFILE="${file%.*}.mo"
echo "${file} -> $MOFILE"
msgfmt "${file}" -o "$MOFILE"
done
echo ""
echo "Listing files:"
find . -type f
echo ""
cd -
echo "Done."
Doesn't https://github.com/wichert/lingua/blob/master/docs/examples/i18n.sh already do that?
I wasn't aware of that script. Sometimes I also need to add files to translatable filelist with certain rules and exclude or include some files. So that script is just very stripped down version.
If you use
--files-from
parameter pot-create doesn't find file(s).locale-files.txt: