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

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

Issue 92213002: Add support for Chrome policy type that references external data (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 7 years 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
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 6
7 from grit.format.policy_templates.writers import plist_helper 7 from grit.format.policy_templates.writers import plist_helper
8 from grit.format.policy_templates.writers import template_writer 8 from grit.format.policy_templates.writers import template_writer
9 9
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return self.FlattenGroupsAndSortPolicies(policy_list) 42 return self.FlattenGroupsAndSortPolicies(policy_list)
43 43
44 def WritePolicy(self, policy): 44 def WritePolicy(self, policy):
45 '''Add strings to the stringtable corresponding a given policy. 45 '''Add strings to the stringtable corresponding a given policy.
46 46
47 Args: 47 Args:
48 policy: The policy for which the strings will be added to the 48 policy: The policy for which the strings will be added to the
49 string table. 49 string table.
50 ''' 50 '''
51 desc = policy['desc'] 51 desc = policy['desc']
52 if policy['type'] in ('int-enum','string-enum'): 52 if policy['type'] == 'external':
53 # This type can only be set through cloud policy.
54 return
55 elif policy['type'] in ('int-enum','string-enum'):
53 # Append the captions of enum items to the description string. 56 # Append the captions of enum items to the description string.
54 item_descs = [] 57 item_descs = []
55 for item in policy['items']: 58 for item in policy['items']:
56 item_descs.append(str(item['value']) + ' - ' + item['caption']) 59 item_descs.append(str(item['value']) + ' - ' + item['caption'])
57 desc = '\n'.join(item_descs) + '\n' + desc 60 desc = '\n'.join(item_descs) + '\n' + desc
58 61
59 self._AddToStringTable(policy['name'], policy['label'], desc) 62 self._AddToStringTable(policy['name'], policy['label'], desc)
60 63
61 def BeginTemplate(self): 64 def BeginTemplate(self):
62 app_name = plist_helper.GetPlistFriendlyName(self.config['app_name']) 65 app_name = plist_helper.GetPlistFriendlyName(self.config['app_name'])
63 self._AddToStringTable( 66 self._AddToStringTable(
64 app_name, 67 app_name,
65 self.config['app_name'], 68 self.config['app_name'],
66 self.messages['mac_chrome_preferences']['text']) 69 self.messages['mac_chrome_preferences']['text'])
67 70
68 def Init(self): 71 def Init(self):
69 # A buffer for the lines of the string table being generated. 72 # A buffer for the lines of the string table being generated.
70 self._out = [] 73 self._out = []
71 74
72 def GetTemplateText(self): 75 def GetTemplateText(self):
73 return '\n'.join(self._out) 76 return '\n'.join(self._out)
OLDNEW
« no previous file with comments | « grit/format/policy_templates/writers/json_writer.py ('k') | grit/format/policy_templates/writers/plist_writer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698