OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 '''Interface for all gatherers. | 6 '''Interface for all gatherers. |
7 ''' | 7 ''' |
8 | 8 |
9 | 9 |
10 from grit import clique | 10 from grit import clique |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 Raises: | 93 Raises: |
94 grit.exception.NotReady() if used before Parse() has been successfully | 94 grit.exception.NotReady() if used before Parse() has been successfully |
95 called. | 95 called. |
96 grit.exception.NoSuchTranslation() if 'pseudo_if_not_available' and | 96 grit.exception.NoSuchTranslation() if 'pseudo_if_not_available' and |
97 fallback_to_english are both false and there is no translation for the | 97 fallback_to_english are both false and there is no translation for the |
98 requested language. | 98 requested language. |
99 ''' | 99 ''' |
100 raise NotImplementedError() | 100 raise NotImplementedError() |
101 | 101 |
| 102 @staticmethod |
102 def FromFile(rc_file, extkey=None, encoding = 'cp1252'): | 103 def FromFile(rc_file, extkey=None, encoding = 'cp1252'): |
103 '''Loads the resource from the file 'rc_file'. Optionally an external key | 104 '''Loads the resource from the file 'rc_file'. Optionally an external key |
104 (which gets passed to the gatherer's constructor) can be specified. | 105 (which gets passed to the gatherer's constructor) can be specified. |
105 | 106 |
106 If 'rc_file' is a filename, it will be opened for reading using 'encoding'. | 107 If 'rc_file' is a filename, it will be opened for reading using 'encoding'. |
107 Otherwise the 'encoding' parameter is ignored. | 108 Otherwise the 'encoding' parameter is ignored. |
108 | 109 |
109 Args: | 110 Args: |
110 rc_file: file('') | 'filename.rc' | 111 rc_file: file('') | 'filename.rc' |
111 extkey: e.g. 'ID_MY_DIALOG' | 112 extkey: e.g. 'ID_MY_DIALOG' |
112 encoding: 'utf-8' | 113 encoding: 'utf-8' |
113 | 114 |
114 Return: | 115 Return: |
115 grit.gather.interface.GathererBase subclass | 116 grit.gather.interface.GathererBase subclass |
116 ''' | 117 ''' |
117 raise NotImplementedError() | 118 raise NotImplementedError() |
118 FromFile = staticmethod(FromFile) | |
119 | 119 |
| 120 def SubstituteMessages(self, substituter): |
| 121 '''Applies substitutions to all messages in the gatherer. |
| 122 |
| 123 Args: |
| 124 substituter: a grit.util.Substituter object. |
| 125 ''' |
| 126 pass |
| 127 |
OLD | NEW |