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

Side by Side Diff: remoting/tools/remove_official_branding.py

Issue 11275101: Fix branding in chromoting string resources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
(Empty)
1 #!/usr/bin/env python
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
4 # found in the LICENSE file.
5
6 """Replaces "Chrome Remote Desktop" with "Chromoting" in GRD files"""
7
8 import sys
9 from optparse import OptionParser
10 import xml.dom.minidom as minidom
11
12 def update_xml_node(element):
13 for child in element.childNodes:
14 if child.nodeType == minidom.Node.ELEMENT_NODE:
15 update_xml_node(child)
16 elif child.nodeType == minidom.Node.TEXT_NODE:
17 child.replaceWholeText(
18 child.data.replace("Chrome Remote Desktop", "Chromoting"))
19
20 def remove_official_branding(input_file, output_file):
21 xml = minidom.parse(input_file)
22
23 # Remove all translations.
24 for translations in xml.getElementsByTagName("translations"):
25 for translation in translations.getElementsByTagName("file"):
26 translations.removeChild(translation)
27
28 for outputs in xml.getElementsByTagName("outputs"):
29 for output in outputs.getElementsByTagName("output"):
30 lang = output.getAttribute("lang")
31 if lang and lang != "en":
32 outputs.removeChild(output)
33
34 # Update branding.
35 update_xml_node(xml)
36
37 out = file(output_file, "w")
38 out.write(xml.toxml(encoding = "UTF-8"))
39 out.close()
40
41 def main():
42 usage = 'Usage: remove_official_branding <input.grd> <output.grd>'
43 parser = OptionParser(usage=usage)
44 options, args = parser.parse_args()
45 if len(args) != 2:
46 parser.error('two positional arguments expected')
47
48 return remove_official_branding(args[0], args[1])
49
50 if __name__ == '__main__':
51 sys.exit(main())
52
OLDNEW
« build/grit_action.gypi ('K') | « remoting/resources/string_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698