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

Side by Side Diff: remoting/webapp/verify-translations.py

Issue 15650018: Remove verify-translations.py (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2011 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 """Verifies that the message tags in the 2nd and subsequent JSON message files
7 match those specified in the first.
8
9 This is typically run when the translations are updated before a release, to
10 check that nothing got missed.
11 """
12
13 import json
14 import sys
15 import string
16
17 def CheckTranslation(filename, translation, messages):
18 """Check |messages| for missing Ids in |translation|, and similarly for unused
19 Ids. If there are missing/unused Ids then report them and return failure.
20 """
21 message_tags = set(map(string.lower, messages.keys()))
22 translation_tags = set(map(string.lower, translation.keys()))
23 if message_tags == translation_tags:
24 return True
25
26 undefined_tags = message_tags - translation_tags
27 if undefined_tags:
28 print '%s: Missing: %s' % (filename, ", ".join(undefined_tags))
29
30 unused_tags = translation_tags - message_tags
31 if unused_tags:
32 print '%s: Unused: %s' % (filename, ", ".join(unused_tags))
33
34 return False
35
36
37 def main():
38 if len(sys.argv) < 3:
39 print 'Usage: verify-translations.py <messages> <translation-files...>'
40 return 1
41
42 en_messages = json.load(open(sys.argv[1], 'r'))
43 exit_code = 0
44 for f in sys.argv[2:]:
45 translation = json.load(open(f, 'r'))
46 if not CheckTranslation(f, translation, en_messages):
47 exit_code = 1
48
49 return exit_code
50
51
52 if __name__ == '__main__':
53 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698