| OLD | NEW |
| 1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
| 2 # Copyright (C) 2006-present eyeo GmbH | 2 # Copyright (C) 2006-present eyeo GmbH |
| 3 # | 3 # |
| 4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
| 5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
| 6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
| 7 # | 7 # |
| 8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 # | 108 # |
| 109 # Localizable files helpers | 109 # Localizable files helpers |
| 110 # | 110 # |
| 111 | 111 |
| 112 @staticmethod | 112 @staticmethod |
| 113 def localizable_file_filename(locale, filename): | 113 def localizable_file_filename(locale, filename): |
| 114 return 'locales/%s/%s' % (locale, filename) | 114 return 'locales/%s/%s' % (locale, filename) |
| 115 | 115 |
| 116 def list_localizable_files(self): | 116 def list_localizable_files(self): |
| 117 default_locale = self.read_config().get('general', 'defaultlocale') | 117 default_locale = self.read_config().get('general', 'defaultlocale') |
| 118 return filter( | 118 return filter(lambda f: os.path.splitext(f)[1].lower() != '.json', |
| 119 lambda f: os.path.splitext(f)[1].lower() != '.json', | 119 self.list_files('locales/%s' % default_locale)) |
| 120 self.list_files('locales/%s' % default_locale) | |
| 121 ) | |
| 122 | 120 |
| 123 def has_localizable_file(self, locale, filename): | 121 def has_localizable_file(self, locale, filename): |
| 124 return self.has_file(self.localizable_file_filename(locale, filename)) | 122 return self.has_file(self.localizable_file_filename(locale, filename)) |
| 125 | 123 |
| 126 def read_localizable_file(self, locale, filename): | 124 def read_localizable_file(self, locale, filename): |
| 127 return self.read_file(self.localizable_file_filename(locale, filename),
binary=True)[0] | 125 return self.read_file(self.localizable_file_filename(locale, filename),
binary=True)[0] |
| 128 | 126 |
| 129 # | 127 # |
| 130 # Static file helpers | 128 # Static file helpers |
| 131 # | 129 # |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 'resolve_link', | 448 'resolve_link', |
| 451 'read_config', | 449 'read_config', |
| 452 'read_template', | 450 'read_template', |
| 453 'read_locale', | 451 'read_locale', |
| 454 'read_include', | 452 'read_include', |
| 455 'exec_file', | 453 'exec_file', |
| 456 ]: | 454 ]: |
| 457 setattr(source, fname, _memoize(getattr(source, fname))) | 455 setattr(source, fname, _memoize(getattr(source, fname))) |
| 458 | 456 |
| 459 return source | 457 return source |
| OLD | NEW |