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 '''Handling of the <message> element. | 6 '''Handling of the <message> element. |
7 ''' | 7 ''' |
8 | 8 |
9 import re | 9 import re |
10 import types | 10 import types |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 in the specified encoding, where |encoding| is one of the encoding values | 217 in the specified encoding, where |encoding| is one of the encoding values |
218 accepted by util.Encode. This is used to generate the data pack data file. | 218 accepted by util.Encode. This is used to generate the data pack data file. |
219 ''' | 219 ''' |
220 from grit.format import rc_header | 220 from grit.format import rc_header |
221 id_map = rc_header.GetIds(self.GetRoot()) | 221 id_map = rc_header.GetIds(self.GetRoot()) |
222 id = id_map[self.GetTextualIds()[0]] | 222 id = id_map[self.GetTextualIds()[0]] |
223 | 223 |
224 message = self.ws_at_start + self.Translate(lang) + self.ws_at_end | 224 message = self.ws_at_start + self.Translate(lang) + self.ws_at_end |
225 return id, util.Encode(message, encoding) | 225 return id, util.Encode(message, encoding) |
226 | 226 |
| 227 def IsResourceMapSource(self): |
| 228 return True |
| 229 |
| 230 def GeneratesResourceMapEntry(self, output_all_resource_defines, |
| 231 is_active_descendant): |
| 232 return is_active_descendant |
| 233 |
227 @staticmethod | 234 @staticmethod |
228 def Construct(parent, message, name, desc='', meaning='', translateable=True): | 235 def Construct(parent, message, name, desc='', meaning='', translateable=True): |
229 '''Constructs a new message node that is a child of 'parent', with the | 236 '''Constructs a new message node that is a child of 'parent', with the |
230 name, desc, meaning and translateable attributes set using the same-named | 237 name, desc, meaning and translateable attributes set using the same-named |
231 parameters and the text of the message and any placeholders taken from | 238 parameters and the text of the message and any placeholders taken from |
232 'message', which must be a tclib.Message() object.''' | 239 'message', which must be a tclib.Message() object.''' |
233 # Convert type to appropriate string | 240 # Convert type to appropriate string |
234 translateable = 'true' if translateable else 'false' | 241 translateable = 'true' if translateable else 'false' |
235 | 242 |
236 node = MessageNode() | 243 node = MessageNode() |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 raise exception.TooManyExamples() | 292 raise exception.TooManyExamples() |
286 | 293 |
287 def GetTextualIds(self): | 294 def GetTextualIds(self): |
288 # The 'name' attribute is not an ID. | 295 # The 'name' attribute is not an ID. |
289 return [] | 296 return [] |
290 | 297 |
291 | 298 |
292 class ExNode(base.ContentNode): | 299 class ExNode(base.ContentNode): |
293 '''An <ex> element.''' | 300 '''An <ex> element.''' |
294 pass | 301 pass |
OLD | NEW |