Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: cms/bin/generate_static_pages.py

Issue 5694103719247872: Issue 2133 - Allow to specify default translation inline in pages rather than in a separate file (Closed)
Patch Set: Addressed comments Created March 12, 2015, 8:56 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cms/converters.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/bin/generate_static_pages.py
===================================================================
--- a/cms/bin/generate_static_pages.py
+++ b/cms/bin/generate_static_pages.py
@@ -57,20 +57,22 @@ def generate_pages(repo, output_dir):
# Cache the result for some functions - we can assume here that the data
# never changes
source.resolve_link = memoize(source.resolve_link)
source.read_config = memoize(source.read_config)
source.read_template = memoize(source.read_template)
source.read_locale = memoize(source.read_locale)
source.read_include = memoize(source.read_include)
+ config = source.read_config()
+ defaultlocale = config.get("general", "defaultlocale")
locales = list(source.list_locales())
for page, format in source.list_pages():
for locale in locales:
- if source.has_locale(locale, page):
+ if locale == defaultlocale or source.has_locale(locale, page):
pagedata = process_page(source, locale, page, format)
# Make sure links to static files are versioned
pagedata = re.sub(r'(<script\s[^<>]*\bsrc="/[^"<>]+)', r"\1?%s" % source.version, pagedata)
pagedata = re.sub(r'(<link\s[^<>]*\bhref="/[^"<>]+)', r"\1?%s" % source.version, pagedata)
pagedata = re.sub(r'(<img\s[^<>]*\bsrc="/[^"<>]+)', r"\1?%s" % source.version, pagedata)
write_file([locale] + page.split("/"), pagedata)
« no previous file with comments | « no previous file | cms/converters.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld