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

Side by Side Diff: grit/tool/transl2tc.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, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « grit/tool/resize.py ('k') | grit/tool/transl2tc_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 '''The 'grit transl2tc' tool. 6 '''The 'grit transl2tc' tool.
7 ''' 7 '''
8 8
9 9
10 import getopt 10 import getopt
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 source_rc: Complete text of source RC file 108 source_rc: Complete text of source RC file
109 source_path: Path to the source RC file 109 source_path: Path to the source RC file
110 transl_rc: Complete text of translated RC file 110 transl_rc: Complete text of translated RC file
111 transl_path: Path to the translated RC file 111 transl_path: Path to the translated RC file
112 112
113 Return: 113 Return:
114 { id1 : text1, '12345678' : 'Hello USERNAME, howzit?' } 114 { id1 : text1, '12345678' : 'Hello USERNAME, howzit?' }
115 ''' 115 '''
116 source_grd = self.rc2grd.Process(source_rc, source_path) 116 source_grd = self.rc2grd.Process(source_rc, source_path)
117 self.VerboseOut('Read %s into GRIT format, running gatherers.\n' % source_pa th) 117 self.VerboseOut('Read %s into GRIT format, running gatherers.\n' % source_pa th)
118 source_grd.SetOutputContext(current_grd.output_language,
119 current_grd.defines)
118 source_grd.RunGatherers(recursive=True, debug=self.o.extra_verbose) 120 source_grd.RunGatherers(recursive=True, debug=self.o.extra_verbose)
119 transl_grd = self.rc2grd.Process(transl_rc, transl_path) 121 transl_grd = self.rc2grd.Process(transl_rc, transl_path)
122 transl_grd.SetOutputContext(current_grd.output_language,
123 current_grd.defines)
120 self.VerboseOut('Read %s into GRIT format, running gatherers.\n' % transl_pa th) 124 self.VerboseOut('Read %s into GRIT format, running gatherers.\n' % transl_pa th)
121 transl_grd.RunGatherers(recursive=True, debug=self.o.extra_verbose) 125 transl_grd.RunGatherers(recursive=True, debug=self.o.extra_verbose)
122 self.VerboseOut('Done running gatherers for %s.\n' % transl_path) 126 self.VerboseOut('Done running gatherers for %s.\n' % transl_path)
123 127
124 # Proceed to create a map from ID to translation, getting the ID from the 128 # Proceed to create a map from ID to translation, getting the ID from the
125 # source GRD and the translation from the translated GRD. 129 # source GRD and the translation from the translated GRD.
126 id2transl = {} 130 id2transl = {}
127 for source_node in source_grd: 131 for source_node in source_grd:
128 source_cliques = source_node.GetCliques() 132 source_cliques = source_node.GetCliques()
129 if not len(source_cliques): 133 if not len(source_cliques):
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 None 249 None
246 ''' 250 '''
247 for id, text in translations: 251 for id, text in translations:
248 text = text.replace('<', '&lt;').replace('>', '&gt;') 252 text = text.replace('<', '&lt;').replace('>', '&gt;')
249 output_file.write(id) 253 output_file.write(id)
250 output_file.write(' ') 254 output_file.write(' ')
251 output_file.write(text) 255 output_file.write(text)
252 output_file.write('\n') 256 output_file.write('\n')
253 WriteTranslations = staticmethod(WriteTranslations) 257 WriteTranslations = staticmethod(WriteTranslations)
254 258
OLDNEW
« no previous file with comments | « grit/tool/resize.py ('k') | grit/tool/transl2tc_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698