Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(411)

Unified Diff: grit/format/rc_header.py

Issue 9965022: Allow substitution of messages as variables in other messages. (Closed) Base URL: https://grit-i18n.googlecode.com/svn/trunk
Patch Set: Fix unit tests for policy writers. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « grit/format/rc.py ('k') | grit/format/rc_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/format/rc_header.py
diff --git a/grit/format/rc_header.py b/grit/format/rc_header.py
index 543897b6847b23983bb805191c9b17ee0119125a..83bedb771596a0d67b171f00d0091fefefa0c8a9 100644
--- a/grit/format/rc_header.py
+++ b/grit/format/rc_header.py
@@ -18,27 +18,24 @@ from grit.extern import FP
class TopLevel(interface.ItemFormatter):
'''Writes the necessary preamble for a resource.h file.'''
- def Format(self, item, lang='', begin_item=True, output_dir='.'):
- if not begin_item:
- return ''
- else:
- header_string = '''// Copyright (c) Google Inc. %d
+ def Format(self, item, lang='', output_dir='.'):
+ header_string = '''// Copyright (c) Google Inc. %d
// All rights reserved.
// This file is automatically generated by GRIT. Do not edit.
#pragma once
''' % (util.GetCurrentYear())
- # Check for emit nodes under the rc_header. If any emit node
- # is present, we assume it means the GRD file wants to override
- # the default header, with no includes.
- for output_node in item.GetOutputFiles():
- if output_node.GetType() == 'rc_header':
- for child in output_node.children:
- if child.name == 'emit':
- if child.attrs['emit_type'] == 'prepend':
- return header_string
- # else print out the default header with include
- return header_string + '''
+ # Check for emit nodes under the rc_header. If any emit node
+ # is present, we assume it means the GRD file wants to override
+ # the default header, with no includes.
+ for output_node in item.GetOutputFiles():
+ if output_node.GetType() == 'rc_header':
+ for child in output_node.children:
+ if child.name == 'emit':
+ if child.attrs['emit_type'] == 'prepend':
+ return header_string
+ # else print out the default header with include
+ return header_string + '''
#include <atlres.h>
'''
@@ -47,11 +44,8 @@ class TopLevel(interface.ItemFormatter):
class EmitAppender(interface.ItemFormatter):
'''Adds the content of the <emit> nodes to the RC header file.'''
- def Format(self, item, lang='', begin_item=True, output_dir='.'):
- if not begin_item:
- return ''
- else:
- return '%s\n' % (item.GetCdata())
+ def Format(self, item, lang='', output_dir='.'):
+ return '%s\n' % (item.GetCdata())
class Item(interface.ItemFormatter):
'''Writes the #define line(s) for a single item in a resource.h file. If
@@ -78,10 +72,7 @@ class Item(interface.ItemFormatter):
print ('WARNING: Numeric resource IDs should be greater than 100 to avoid\n'
'conflicts with system-defined resource IDs.')
- def Format(self, item, lang='', begin_item=True, output_dir='.'):
- if not begin_item:
- return ''
-
+ def Format(self, item, lang='', output_dir='.'):
# Resources that use the RES protocol don't need
# any numerical ids generated, so we skip them altogether.
# This is accomplished by setting the flag 'generateid' to false
« no previous file with comments | « grit/format/rc.py ('k') | grit/format/rc_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698