Index: cms/bin/generate_static_pages.py |
=================================================================== |
--- a/cms/bin/generate_static_pages.py |
+++ b/cms/bin/generate_static_pages.py |
@@ -74,36 +74,39 @@ def generate_pages(repo, output_dir): |
config = source.read_config() |
defaultlocale = config.get("general", "defaultlocale") |
locales = list(source.list_locales()) |
if defaultlocale not in locales: |
locales.append(defaultlocale) |
# First pass: compile the list of pages with given translation level |
+ def get_locale_file(page): |
+ try: |
+ return config.get("locale_overrides", page) |
+ except ConfigParser.Error: |
+ return page |
+ |
pagelist = set() |
blacklist = set() |
for page, format in source.list_pages(): |
for locale in locales: |
if locale == defaultlocale: |
pagelist.add((locale, page)) |
elif source.has_locale(locale, page): |
params = get_page_params(source, locale, page, format) |
if params["translation_ratio"] >= MIN_TRANSLATED: |
pagelist.add((locale, page)) |
else: |
- blacklist.add((locale, page)) |
+ blacklist.add((locale, get_locale_file(page))) |
# Override existance check to avoid linking to pages we don't generate |
orig_has_locale = source.has_locale |
def has_locale(locale, page): |
- try: |
- page = config.get("locale_overrides", page) |
- except ConfigParser.Error: |
- pass |
+ page = get_locale_file(page) |
if (locale, page) in blacklist: |
return False |
return orig_has_locale(locale, page) |
source.has_locale = has_locale |
source.resolve_link.clear_cache() |
# Second pass: actually generate pages this time |
for locale, page in pagelist: |