Chromium Code Reviews

Side by Side Diff: grit/format/policy_templates/writers/admx_writer.py

Issue 695613003: Fix duplicated strings in ADMX templates. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: added tests Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 from xml.dom import minidom 6 from xml.dom import minidom
7 from grit.format.policy_templates.writers import xml_formatted_writer 7 from grit.format.policy_templates.writers import xml_formatted_writer
8 8
9 9
10 def GetWriter(config): 10 def GetWriter(config):
(...skipping 14 matching lines...)
25 25
26 # The ADMX "policies" element that contains the ADMX "policy" elements that 26 # The ADMX "policies" element that contains the ADMX "policy" elements that
27 # are generated. 27 # are generated.
28 _active_policies_elem = None 28 _active_policies_elem = None
29 29
30 def _AdmlString(self, name): 30 def _AdmlString(self, name):
31 '''Creates a reference to the named string in an ADML file. 31 '''Creates a reference to the named string in an ADML file.
32 Args: 32 Args:
33 name: Name of the referenced ADML string. 33 name: Name of the referenced ADML string.
34 ''' 34 '''
35 name = name.replace('.', '_')
35 return '$(string.' + name + ')' 36 return '$(string.' + name + ')'
36 37
37 def _AdmlStringExplain(self, name): 38 def _AdmlStringExplain(self, name):
38 '''Creates a reference to the named explanation string in an ADML file. 39 '''Creates a reference to the named explanation string in an ADML file.
39 Args: 40 Args:
40 name: Name of the referenced ADML explanation. 41 name: Name of the referenced ADML explanation.
41 ''' 42 '''
43 name = name.replace('.', '_')
42 return '$(string.' + name + '_Explain)' 44 return '$(string.' + name + '_Explain)'
43 45
44 def _AdmlPresentation(self, name): 46 def _AdmlPresentation(self, name):
45 '''Creates a reference to the named presentation element in an ADML file. 47 '''Creates a reference to the named presentation element in an ADML file.
46 Args: 48 Args:
47 name: Name of the referenced ADML presentation element. 49 name: Name of the referenced ADML presentation element.
48 ''' 50 '''
49 return '$(presentation.' + name + ')' 51 return '$(presentation.' + name + ')'
50 52
51 def _AddPolicyNamespaces(self, parent, prefix, namespace): 53 def _AddPolicyNamespaces(self, parent, prefix, namespace):
(...skipping 315 matching lines...)
367 self._AddCategories(self.config['win_recommended_category_path']) 369 self._AddCategories(self.config['win_recommended_category_path'])
368 self._active_policies_elem = self.AddElement(policy_definitions_elem, 370 self._active_policies_elem = self.AddElement(policy_definitions_elem,
369 'policies') 371 'policies')
370 self._active_mandatory_policy_group_name = \ 372 self._active_mandatory_policy_group_name = \
371 self.config['win_mandatory_category_path'][-1] 373 self.config['win_mandatory_category_path'][-1]
372 self._active_recommended_policy_group_name = \ 374 self._active_recommended_policy_group_name = \
373 self.config['win_recommended_category_path'][-1] 375 self.config['win_recommended_category_path'][-1]
374 376
375 def GetTemplateText(self): 377 def GetTemplateText(self):
376 return self.ToPrettyXml(self._doc) 378 return self.ToPrettyXml(self._doc)
OLDNEW

Powered by Google App Engine