From 89c835bfc6aeded4ec1ba763aeecbb04806a5aa8 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 17 Aug 2026 09:57:38 -0400 Subject: [PATCH] Fix locale update script under rpl 2.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. (cherry picked from commit 5a6c9245f0f7e429dfe6eab78ab0ef1b3745a624) --- scripts/locale/run | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/locale/run b/scripts/locale/run index ac9a6acfd2..028f5b5d21 100755 --- a/scripts/locale/run +++ b/scripts/locale/run @@ -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"