mirror of
https://github.com/zotero/zotero.git
synced 2026-09-08 22:21:04 +00:00
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 5a6c9245f0)
34 lines
1.1 KiB
Bash
Executable file
34 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
ROOT_DIR="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
|
|
|
WORK_DIR="$SCRIPT_DIR/work"
|
|
LOCALES_DIR="$ROOT_DIR/chrome/locale"
|
|
|
|
rm -rf "$WORK_DIR"
|
|
mkdir "$WORK_DIR"
|
|
cd $WORK_DIR
|
|
# Create temporary directories for merge script
|
|
mkdir en-US-new locales content-locales output
|
|
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 --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/
|
|
|
|
rm -rf en-US-new locales content-locales output
|
|
|
|
$SCRIPT_DIR/filter_connector_json "$LOCALES_DIR"
|
|
|
|
cd "$ROOT_DIR/resource/schema/global"
|
|
./scripts/update-schema
|