summaryrefslogtreecommitdiff
path: root/sphinx/util/osutil.py
diff options
context:
space:
mode:
authorTakayuki Shimizukawa <shimizukawa@gmail.com>2013-04-15 00:56:13 +0900
committerTakayuki Shimizukawa <shimizukawa@gmail.com>2013-04-15 00:56:13 +0900
commitc8ebb875deb8681a04e838f91b78a1b21e774470 (patch)
tree8e0aa6b94babd2884d767dd37b9b8d256d47e66e /sphinx/util/osutil.py
parentb91f70be6eaf6034b59c7c153c89cf51f6d7bf34 (diff)
downloadsphinx-git-c8ebb875deb8681a04e838f91b78a1b21e774470.tar.gz
Rebuild i18n target document when catalog updated
Diffstat (limited to 'sphinx/util/osutil.py')
-rw-r--r--sphinx/util/osutil.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py
index 6cb310eb0..a6235f895 100644
--- a/sphinx/util/osutil.py
+++ b/sphinx/util/osutil.py
@@ -16,6 +16,7 @@ import time
import errno
import locale
import shutil
+import gettext
from os import path
# Errnos that we need.
@@ -161,4 +162,17 @@ def find_catalog(docname, compaction):
return ret
+
+def find_catalog_files(docname, srcdir, locale_dirs, lang, compaction):
+ from sphinx.util.pycompat import relpath
+ if not(lang and locale_dirs):
+ return []
+
+ domain = find_catalog(docname, compaction)
+ files = [gettext.find(domain, path.join(srcdir, dir_), [lang])
+ for dir_ in locale_dirs]
+ files = [relpath(f, srcdir) for f in files if f]
+ return files
+
+
fs_encoding = sys.getfilesystemencoding() or sys.getdefaultencoding()