Skip to content

Commit

Permalink
Update sync_translations_to_master.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
past-due committed Jun 27, 2024
1 parent 80ee9c9 commit 6c3b62e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions .ci/sync_translations_to_master.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,15 @@ find * -prune -type d | while IFS= read -r d; do
# Split translated file into front matter and content
python3 "${split_script}" "${file}"

# Use yq to merge translated front-matter back into full base file front-matter
yq eval-all 'select(fileIndex == 0) *? select(fileIndex == 1)' "${working_dir}/base_frontmatter/${file}.base_frontmatter" "${file}.frontmatter" > "${file}.frontmatter.merged"
if [ -s "${file}.frontmatter" ]; then
# Use yq to merge translated front-matter back into full base file front-matter
printf "\t%s\n" "+ Merging front-matter"
yq eval-all 'select(fileIndex == 0) *? select(fileIndex == 1)' "${working_dir}/base_frontmatter/${file}.base_frontmatter" "${file}.frontmatter" > "${file}.frontmatter.merged"
else
# Just use base front matter
printf "\t%s\n" "+ Using base front-matter"
cp "${working_dir}/base_frontmatter/${file}.base_frontmatter" "${file}.frontmatter.merged"
fi

# Concatenate the merged front-matter with the translated content
echo "---" > "${file}.merged"
Expand Down

0 comments on commit 6c3b62e

Please sign in to comment.