Bumping manifests a=b2g-bump
[gecko.git] / intl / locale / props2arrays.py
blobdd2f4b69f319e95030b5df66f87c589b347c546a
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 import sys
7 mappings = {}
9 propFile = open(sys.argv[1], "r");
11 for line in propFile:
12 line = line.strip()
13 if not line.startswith('#'):
14 parts = line.split("=", 1)
15 if len(parts) == 2 and len(parts[0]) > 0:
16 mappings[parts[0].strip()] = parts[1].strip()
18 propFile.close()
20 keys = mappings.keys()
21 keys.sort()
23 hFile = open(sys.argv[2], "w");
25 hFile.write("// This is a generated file. Please do not edit.\n")
26 hFile.write("// Please edit the corresponding .properties file instead.\n")
28 first = 1
29 for key in keys:
30 if first:
31 first = 0
32 else:
33 hFile.write(',\n')
34 hFile.write('{ "%s", "%s", (const char*)NS_INT32_TO_PTR(%d) }'
35 % (key, mappings[key], len(mappings[key])));
36 hFile.write('\n')
37 hFile.flush()
38 hFile.close()