Fix locale update script under rpl 2.x

rpl 2.1.0 guesses each file's character encoding instead of assuming
UTF-8, and aborts on some locale files, leaving the script's later
steps unrun. Pin the encoding, and use -exec + so a failure in one of
these passes actually stops the script.

Also drop the ⏎ replacement, which hasn't matched anything since 2013
and would now insert real newlines rather than literal \n, truncating
.properties entries.
This commit is contained in:
Dan Stillman 2026-08-17 09:57:38 -04:00
parent 844bd87824
commit 5a6c9245f0

View file

@ -16,18 +16,16 @@ cp -R $LOCALES_DIR/en-US/zotero/* en-US-new
cp -R $LOCALES_DIR/ locales/
rm -rf locales/en-US
# Correct various errors
find locales -name '*.dtd' -exec perl -pi -e "s/&([^\s])/&\$1/g" {} \;
find locales -name '*.properties' -exec rpl 'S%' '%S' {} \;
find locales -name '*.properties' -exec rpl '/n' '\\n' {} \;
find locales -name '*.properties' -exec rpl '\\\\' '\\' {} \;
find locales -name '*.properties' -exec rpl '\\n\\n\\(?!n)' '\\n\\n' {} \;
find locales -name '*.dtd' -exec perl -pi -e "s/&([^\s])/&\$1/g" {} +
find locales -name '*.properties' -exec rpl --encoding=UTF-8 'S%' '%S' {} +
find locales -name '*.properties' -exec rpl --encoding=UTF-8 '/n' '\\n' {} +
find locales -name '*.properties' -exec rpl --encoding=UTF-8 '\\\\' '\\' {} +
find locales -name '*.properties' -exec rpl --encoding=UTF-8 '\\n\\n\\(?!n)' '\\n\\n' {} +
# Run merge script
$SCRIPT_DIR/localizer
rsync -a --progress --verbose $WORK_DIR/output/locale/ $LOCALES_DIR/
rpl -R ⏎ '\n' "$LOCALES_DIR"
rm -rf en-US-new locales content-locales output
$SCRIPT_DIR/filter_connector_json "$LOCALES_DIR"