Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 Loading... | |
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"] |
Sebastian Noack
2015/07/14 11:31:08
I would rather not duplicate the key lookup:
ca
kzar
2015/07/14 12:54:31
Done.
| |
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 Loading... | |
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 } |
LEFT | RIGHT |