diff --git a/create_documentation b/create_documentation
index b76a9d43d430db62db592720cc861772bcf6ec90_Y3JlYXRlX2RvY3VtZW50YXRpb24=..bc3421b5dccc00145e3aca81db6a48f4d6cc6b75_Y3JlYXRlX2RvY3VtZW50YXRpb24= 100755
--- a/create_documentation
+++ b/create_documentation
@@ -13,7 +13,8 @@
 project_home=$(cd $here && cd .. && echo $PWD)
 project_name_from_home=$(basename $project_home)
 project_name=${DRONE_REPO_NAME:-project_name_from_home}
+languages=(${LANGUAGES:-en})
 
 format=html
 out_dir=${project_home}/_build/$format
 
@@ -16,7 +17,9 @@
 
 format=html
 out_dir=${project_home}/_build/$format
 
+error=0
+
 # color stuff
 autoload colors && colors
 for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do
@@ -29,5 +32,5 @@
 
 # determine branch name
 if [ -n "$DRONE_BRANCH" ]; then
-branch="$DRONE_BRANCH"
+    branch="$DRONE_BRANCH"
 elif [ -e ".git" ]; then
@@ -33,3 +36,3 @@
 elif [ -e ".git" ]; then
-branch="$(git rev-parse --abbrev-ref HEAD)"
+    branch="$(git rev-parse --abbrev-ref HEAD)"
 elif [ -e ".hg" ]; then
@@ -35,3 +38,3 @@
 elif [ -e ".hg" ]; then
-branch="$(hg id -b)"
+    branch="$(hg id -b)"
 else
@@ -37,4 +40,4 @@
 else
-echo "${RED}WARN${RESET} - Branch name not found"
-branch="unknown"
+    echo "${RED}WARN${RESET} - Branch name not found"
+    branch="unknown"
 fi
@@ -40,5 +43,6 @@
 fi
+echo "${YELLOW}INFO ${RESET} - Branch name: $branch"
 
 for doc_dir in doc docs; do
     if [[ -d "$doc_dir" ]] ; then
 	pushd $doc_dir
@@ -41,6 +45,6 @@
 
 for doc_dir in doc docs; do
     if [[ -d "$doc_dir" ]] ; then
 	pushd $doc_dir
-	for language in "en" ; do
+	for language in $languages ; do
 	    make -e SPHINXOPTS=-Dlanguage=${language} $format
@@ -46,10 +50,10 @@
 	    make -e SPHINXOPTS=-Dlanguage=${language} $format
-	    # TODO read value from Makefile
-	    builddir=_build
-	    dest_dir=$out_dir/$project_name/$language/$branch
-	    if [[ $? -eq 0 ]] ; then
+            if [[ $? -eq 0 ]] ; then
+		# TODO read value from Makefile
+		builddir=_build
+		dest_dir=$out_dir/$project_name/$language/$branch
 		echo "${YELLOW}INFO ${RESET} - Documentation generation done for $doc_dir (superproject), copy to $dest_dir"
 		mkdir -p $dest_dir
 		cp -r $builddir/$format/. $dest_dir
 	    else
 		echo "${RED}ERROR${RESET} - Documentation generation failed for $doc_dir (superproject)"
@@ -51,8 +55,9 @@
 		echo "${YELLOW}INFO ${RESET} - Documentation generation done for $doc_dir (superproject), copy to $dest_dir"
 		mkdir -p $dest_dir
 		cp -r $builddir/$format/. $dest_dir
 	    else
 		echo "${RED}ERROR${RESET} - Documentation generation failed for $doc_dir (superproject)"
+		((error++))
 	    fi
 	done
 	popd
@@ -74,5 +79,13 @@
         pushd $module_path
         module=$(basename $module_path)
         has_doc=""
+	if [ -e ".git" ]; then
+	    branch="$(git rev-parse --abbrev-ref HEAD)"
+	elif [ -e ".hg" ]; then
+	    branch="$(hg identify --branch)"
+	else
+	    echo "${RED}WARN${RESET} - Branch name not found"
+	    branch="default"
+	fi
         for doc_dir in doc docs ; do
 	    if [[ -d $doc_dir && -e $doc_dir/Makefile ]]; then
@@ -77,5 +90,6 @@
         for doc_dir in doc docs ; do
 	    if [[ -d $doc_dir && -e $doc_dir/Makefile ]]; then
+		echo "${YELLOW}INFO ${RESET} - Branch name: $branch"
 		has_doc=True
 		echo ${YELLOW}INFO ${RESET} - Makefile found in $dir/$module_path/$doc_dir
 		pushd $doc_dir
@@ -79,11 +93,4 @@
 		has_doc=True
 		echo ${YELLOW}INFO ${RESET} - Makefile found in $dir/$module_path/$doc_dir
 		pushd $doc_dir
-		if [ -e ".git" ]; then
-		    branch="$(git rev-parse --abbrev-ref HEAD)"
-		elif [ -e ".hg" ]; then
-		    branch="$(hg id -b)"
-		else
-		    branch="default"
-		fi
 		# TODO read value from Makefile
@@ -89,3 +96,3 @@
 		# TODO read value from Makefile
-		for language in "en" ; do
+		for language in $languages ; do
     		    make -e SPHINXOPTS=-Dlanguage=${language} $format
@@ -91,5 +98,2 @@
     		    make -e SPHINXOPTS=-Dlanguage=${language} $format
-		    # TODO read value from Makefile
-		    builddir=_build
-		    dest_dir=$out_dir/$module/$language/$branch
 		    if [[ $? -eq 0 ]] ; then
@@ -95,6 +99,9 @@
 		    if [[ $? -eq 0 ]] ; then
+			# TODO read value from Makefile
+			builddir=_build
+			dest_dir=$out_dir/$module/$language/$branch
 			echo ${YELLOW}INFO ${RESET} - Documentation generation done for $dir/$module_path/$doc_dir, copy to $dest_dir
 			mkdir -p $dest_dir
 			cp -r $builddir/$format/. $dest_dir
 		    else
 			echo ${RED}ERROR${RESET} - Documentation generation failed for $dir/$module_path/$doc_dir
@@ -96,8 +103,9 @@
 			echo ${YELLOW}INFO ${RESET} - Documentation generation done for $dir/$module_path/$doc_dir, copy to $dest_dir
 			mkdir -p $dest_dir
 			cp -r $builddir/$format/. $dest_dir
 		    else
 			echo ${RED}ERROR${RESET} - Documentation generation failed for $dir/$module_path/$doc_dir
+			((error++))
 		    fi
 		done
 		popd
@@ -111,3 +119,5 @@
 done
 
 popd
+
+exit $error