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

Side by Side Diff: cms/bin/generate_static_pages.py

Issue 29337938: Issue 2992 - Localise pages with no strings (Closed)
Patch Set: Created March 8, 2016, 2:18 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus web scripts, 3 # This file is part of the Adblock Plus web scripts,
4 # Copyright (C) 2006-2016 Eyeo GmbH 4 # Copyright (C) 2006-2016 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return config.get("locale_overrides", page) 85 return config.get("locale_overrides", page)
86 except ConfigParser.Error: 86 except ConfigParser.Error:
87 return page 87 return page
88 88
89 pagelist = set() 89 pagelist = set()
90 blacklist = set() 90 blacklist = set()
91 for page, format in source.list_pages(): 91 for page, format in source.list_pages():
92 for locale in locales: 92 for locale in locales:
93 if locale == defaultlocale: 93 if locale == defaultlocale:
94 pagelist.add((locale, page)) 94 pagelist.add((locale, page))
95 elif source.has_locale(locale, page): 95 else:
96 params = get_page_params(source, locale, page, format) 96 params = get_page_params(source, locale, page, format)
97 if params["translation_ratio"] >= MIN_TRANSLATED: 97 if params["translation_ratio"] >= MIN_TRANSLATED:
98 pagelist.add((locale, page)) 98 pagelist.add((locale, page))
99 else: 99 else:
100 blacklist.add((locale, get_locale_file(page))) 100 blacklist.add((locale, get_locale_file(page)))
101 101
102 # Override existance check to avoid linking to pages we don't generate 102 # Override existance check to avoid linking to pages we don't generate
103 orig_has_locale = source.has_locale 103 orig_has_locale = source.has_locale
104 def has_locale(locale, page): 104 def has_locale(locale, page):
105 page = get_locale_file(page) 105 page = get_locale_file(page)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 os.rmdir(path) 141 os.rmdir(path)
142 remove_unknown(output_dir) 142 remove_unknown(output_dir)
143 143
144 if __name__ == "__main__": 144 if __name__ == "__main__":
145 if len(sys.argv) < 3: 145 if len(sys.argv) < 3:
146 print >>sys.stderr, "Usage: %s source_repository output_dir" % sys.argv[0] 146 print >>sys.stderr, "Usage: %s source_repository output_dir" % sys.argv[0]
147 sys.exit(1) 147 sys.exit(1)
148 148
149 repo, output_dir = sys.argv[1:3] 149 repo, output_dir = sys.argv[1:3]
150 generate_pages(repo, output_dir) 150 generate_pages(repo, output_dir)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld