Created
November 8, 2016 13:55
-
-
Save kapouer/260b2a0f7d83cb675a33a22dc36af99a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cd ../public | |
poFiles=../lang/*.po | |
destDir=langs | |
for poFile in ${poFiles}; do | |
lang=`basename -s .po ${poFile}` | |
rm -rf "${destDir}/${lang}" | |
find ./*.html ./articles/*.html ./templates/*.html ./components/*.html | while read -r templateFile; do | |
destFile=${destDir}/${lang}/${templateFile} | |
targetDir=`dirname ${destFile}` | |
mkdir -p ${targetDir} | |
rm -f ${destFile} | |
# [[ ${templateFile} =~ ^*edit-*$ ]] && echo "yes" | |
po2txt --progress=none -i ${poFile} -t ${templateFile} > ${destFile} | |
# symlink equal files | |
if cmp -s "${templateFile}" "${destFile}" || echo ${templateFile} | grep -q "edit-"; then | |
relPath=`realpath --relative-to=${targetDir} ${templateFile}` | |
rm "${destFile}" | |
ln -s "${relPath}" "${destFile}" | |
else | |
echo "${destFile}" | |
fi | |
done; | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment