Translation sync job: add only *.po files to git

All *.po files in locale/ subdirectories are needed to added
by git without *.pot files in locale/ directory.

Change-Id: I5b76cfe3a4583199d49dff4a567b678d9e8e1534
This commit is contained in:
Ian Y. Choi 2016-12-05 22:57:53 +09:00
parent 1dea6e08be
commit 4fba65e5e4

View File

@ -37,6 +37,17 @@ function cleanup_module {
compress_po_files "$modulename"
}
# Add all po files to the git repo in a target directory
function git_add_po_files {
local target_dir=$1
local po_file_count=`find $1 -name *.po | wc -l`
if [ $po_file_count -ne 0 ]; then
git add $target_dir/*/*
fi
}
# Propose updates for manuals
function propose_manuals {
@ -63,10 +74,10 @@ function propose_manuals {
for FILE in ${DocFolder}/*; do
DOCNAME=${FILE#${DocFolder}/}
if [ -d ${DocFolder}/${DOCNAME}/locale ] ; then
git add ${DocFolder}/${DOCNAME}/locale/*/*
git_add_po_files ${DocFolder}/${DOCNAME}/locale
fi
if [ -d ${DocFolder}/${DOCNAME}/source/locale ] ; then
git add ${DocFolder}/${DOCNAME}/source/locale/*/*
git_add_po_files ${DocFolder}/${DOCNAME}/source/locale
fi
done
}
@ -81,7 +92,7 @@ function propose_training_guides {
cleanup_module "doc/upstream-training"
# Add all changed files to git
git add doc/upstream-training/source/locale/*/*
git_add_po_files doc/upstream-training/source/locale
}
@ -100,7 +111,7 @@ function propose_python_django {
# Now add all changed files to git.
# Note we add them here to not have to differentiate in the functions
# between new files and files already under git control.
git add $modulename/locale/*/*
git_add_po_files $modulename/locale
# Cleanup po and pot files
cleanup_module "$modulename"
@ -116,7 +127,7 @@ function propose_python_django {
# Some files were changed, add changed files again to git, so
# that we can run git diff properly.
git add $modulename/locale/*/*
git_add_po_files $modulename/locale
fi
}
@ -176,7 +187,7 @@ function propose_releasenotes {
# Add all changed files to git - if there are
# translated files at all.
if [ -d releasenotes/source/locale/ ] ; then
git add releasenotes/source/locale/*/*
git_add_po_files releasenotes/source/locale
fi
fi