Skip to content

Commit

Permalink
properly substitute line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
newhinton committed Apr 28, 2024
1 parent 225d481 commit e8f9c59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ jobs:
exit 1
fi
TRANSLATIONS=$(./scripts/generateFilelist.sh ${{ github.event.pull_request.commits }} ${{needs.string-change-verification.outputs.files}})
TRANSLATIONS="${TRANSLATIONS//'%'/'%25'}"
TRANSLATIONS="${TRANSLATIONS//$'\n'/'%0A'}"
TRANSLATIONS="${TRANSLATIONS//$'\r'/'%0D'}"
echo "TRANSLATIONS=$TRANSLATIONS" >> $GITHUB_OUTPUT
shell: sh
- name: Upload Raw Translations
Expand Down
6 changes: 5 additions & 1 deletion scripts/generateFilelist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ fi

DIFF=$(git diff -U0 HEAD~$1 ${@:2} | grep -E "^\+" | grep -v +++ | cut -c 2- | sed 's/^[ \t]*\(.*$\)/\1/')
echo "<xml>$DIFF</xml>" | xmlstarlet sel -t -m '//string' -v . -n > changed_texts.txt
cat changed_texts.txt
TRANSLATIONS=$(cat changed_texts.txt)
TRANSLATIONS="${TRANSLATIONS//'%'/'%25'}"
TRANSLATIONS="${TRANSLATIONS//$'\n'/'%0A'}"
TRANSLATIONS="${TRANSLATIONS//$'\r'/'%0D'}"
echo $TRANSLATIONS

0 comments on commit e8f9c59

Please sign in to comment.