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" 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 # Propose updates for manuals
function propose_manuals { function propose_manuals {
@ -63,10 +74,10 @@ function propose_manuals {
for FILE in ${DocFolder}/*; do for FILE in ${DocFolder}/*; do
DOCNAME=${FILE#${DocFolder}/} DOCNAME=${FILE#${DocFolder}/}
if [ -d ${DocFolder}/${DOCNAME}/locale ] ; then if [ -d ${DocFolder}/${DOCNAME}/locale ] ; then
git add ${DocFolder}/${DOCNAME}/locale/*/* git_add_po_files ${DocFolder}/${DOCNAME}/locale
fi fi
if [ -d ${DocFolder}/${DOCNAME}/source/locale ] ; then if [ -d ${DocFolder}/${DOCNAME}/source/locale ] ; then
git add ${DocFolder}/${DOCNAME}/source/locale/*/* git_add_po_files ${DocFolder}/${DOCNAME}/source/locale
fi fi
done done
} }
@ -81,7 +92,7 @@ function propose_training_guides {
cleanup_module "doc/upstream-training" cleanup_module "doc/upstream-training"
# Add all changed files to git # 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. # Now add all changed files to git.
# Note we add them here to not have to differentiate in the functions # Note we add them here to not have to differentiate in the functions
# between new files and files already under git control. # 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 po and pot files
cleanup_module "$modulename" cleanup_module "$modulename"
@ -116,7 +127,7 @@ function propose_python_django {
# Some files were changed, add changed files again to git, so # Some files were changed, add changed files again to git, so
# that we can run git diff properly. # that we can run git diff properly.
git add $modulename/locale/*/* git_add_po_files $modulename/locale
fi fi
} }
@ -176,7 +187,7 @@ function propose_releasenotes {
# Add all changed files to git - if there are # Add all changed files to git - if there are
# translated files at all. # translated files at all.
if [ -d releasenotes/source/locale/ ] ; then if [ -d releasenotes/source/locale/ ] ; then
git add releasenotes/source/locale/*/* git_add_po_files releasenotes/source/locale
fi fi
fi fi