Skip to content

Instantly share code, notes, and snippets.

@claudep
Created June 12, 2013 16:03
Show Gist options
  • Select an option

  • Save claudep/5766706 to your computer and use it in GitHub Desktop.

Select an option

Save claudep/5766706 to your computer and use it in GitHub Desktop.
diff --git a/docs/fixtures/doc_releases.json b/docs/fixtures/doc_releases.json
index 56b5394..aa93fe8 100644
--- a/docs/fixtures/doc_releases.json
+++ b/docs/fixtures/doc_releases.json
@@ -82,5 +82,17 @@
"version": "1.5",
"docs_subdir": "docs"
}
+ },
+ {
+ "pk": 8,
+ "model": "docs.documentrelease",
+ "fields": {
+ "lang": "fr",
+ "scm": "git",
+ "scm_url": "git://github.com/django/django.git@stable/1.5.x",
+ "is_default": false,
+ "version": "1.5",
+ "docs_subdir": "docs"
+ }
}
]
diff --git a/docs/management/commands/update_docs.py b/docs/management/commands/update_docs.py
index 8a0b0c8..2919807 100644
--- a/docs/management/commands/update_docs.py
+++ b/docs/management/commands/update_docs.py
@@ -58,14 +58,23 @@ class Command(NoArgsCommand):
# Do this dynamically in case we add other SCM later.
getattr(self, 'update_%s' % release.scm)(release.scm_url, destdir)
- #
- # Use Sphinx to build the release docs into JSON and HTML documents.
- #
if release.docs_subdir:
source_dir = destdir.child(*release.docs_subdir.split('/'))
else:
source_dir = destdir
+ if release.lang != 'en':
+ scm_url = release.scm_url.replace('django.git', 'django-docs-translation.git')
+ trans_dir = destdir.child('django-docs-translation')
+ if not trans_dir.exists():
+ trans_dir.mkdir()
+ getattr(self, 'update_%s' % release.scm)(scm_url, trans_dir)
+ trans_dir.child('translations').write_link(source_dir.child('locale'))
+ subprocess.call("cd %s && make translations" % trans_dir)
+
+ #
+ # Use Sphinx to build the release docs into JSON and HTML documents.
+ #
for builder in ('json', 'html'):
# Wipe and re-create the build directory. See #18930.
build_dir = destdir.child('_build', builder)
@@ -78,6 +87,7 @@ class Command(NoArgsCommand):
print " building %s (%s -> %s)" % (builder, source_dir, build_dir)
sphinx.cmdline.main(['sphinx-build',
'-b', builder,
+ '-D', 'language=%s' % release.lang,
'-q', # Be vewy qwiet
source_dir, # Source file directory
build_dir, # Destination directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment