1#!/usr/bin/env bash 2# 3# Check if folders with localized documentation are in sync 4# 5# 1. Traverse each folder with language version and generate a sorted list 6# of all the files inside 7# 2. Compare the sorted lists of files and flag differences 8# 9# Note: 10# All differences between folders with language versions should be resolved 11# before releasing documentation 12# 13 14RESULT=0 15STARS='***************************************************' 16 17find en -type f | cut -d/ -f2- | sort > file_list_en 18find zh_CN -type f | cut -d/ -f2- | sort > file_list_zh_CN 19 20# format is to display new or different filenames 21DIFF_FORMAT="--unchanged-line-format= --old-line-format=[en]:%L --new-line-format=[zh_CN]:%L" 22 23FOLDER_DIFFERENCES=$(diff $DIFF_FORMAT file_list_en file_list_zh_CN) 24if ! [ -z "$FOLDER_DIFFERENCES" ]; then 25 echo "$STARS" 26 echo "Build failed due to the following differences in 'en' and 'zh_CN' folders:" 27 echo "$FOLDER_DIFFERENCES" 28 echo "$STARS" 29 echo "Please synchronize contents of 'en' and 'zh_CN' folders to contain files with identical names" 30 RESULT=1 31fi 32 33# remove temporary files 34rm file_list_en file_list_zh_CN 35 36exit $RESULT 37