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

Delta Between Two Patch Sets: cms/converters.py

Issue 29317015: Issue 2625 - [cms] Crowdin synchronisation script (Closed)
Left Patch Set: Addressed further feedback Created July 11, 2015, 7:17 p.m.
Right Patch Set: Give query_params a default value Created July 16, 2015, 12:47 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « cms/bin/translate.py ('k') | cms/sources.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2015 Eyeo GmbH 4 # Copyright (C) 2006-2015 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 if locale == self._params["defaultlocale"]: 141 if locale == self._params["defaultlocale"]:
142 result = default 142 result = default
143 elif name in localedata: 143 elif name in localedata:
144 result = localedata[name].strip() 144 result = localedata[name].strip()
145 else: 145 else:
146 result = default 146 result = default
147 self.missing_translations += 1 147 self.missing_translations += 1
148 self.total_translations += 1 148 self.total_translations += 1
149 149
150 # Perform callback with the string if required, e.g. for the translations sc ript 150 # Perform callback with the string if required, e.g. for the translations sc ript
151 if self._params["localized_string_callback"]: 151 callback = self._params["localized_string_callback"]
152 self._params["localized_string_callback"](page, locale, name, result, 152 if callback:
153 comment, fixed_strings) 153 callback(page, locale, name, result, comment, fixed_strings)
154 154
155 155
156 # Insert fixed strings 156 # Insert fixed strings
157 for i, fixed_string in enumerate(fixed_strings, 1): 157 for i, fixed_string in enumerate(fixed_strings, 1):
158 result = result.replace("{%d}" % i, fixed_string) 158 result = result.replace("{%d}" % i, fixed_string)
159 159
160 # Insert attributes 160 # Insert attributes
161 result = escape(result) 161 result = escape(result)
162 def stringify_attribute((name, value)): 162 def stringify_attribute((name, value)):
163 return '%s="%s"' % ( 163 return '%s="%s"' % (
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 stack.pop() 405 stack.pop()
406 stack[-1]["subitems"].append(item) 406 stack[-1]["subitems"].append(item)
407 stack.append(item) 407 stack.append(item)
408 return structured 408 return structured
409 409
410 converters = { 410 converters = {
411 "html": RawConverter, 411 "html": RawConverter,
412 "md": MarkdownConverter, 412 "md": MarkdownConverter,
413 "tmpl": TemplateConverter, 413 "tmpl": TemplateConverter,
414 } 414 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld