Mercurial > dive4elements > river
annotate flys-artifacts/contrib/add-i18n-numbers.py @ 4556:5e25a2b19ddd
Add GaugeOverview to Fixanalysis
Show the gauge info panel when the fixanalysis is selected. Currently all
entries in the tree are expanded independend from the selected ranges in the
fixanalysis.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 16 Nov 2012 12:33:25 +0100 |
parents | 003940a7d6c9 |
children |
rev | line source |
---|---|
3157
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 """ Add unique numbers in front of properties values |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 to identfy the key without knowing the real key. |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 """ |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 import sys |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 import re |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import os |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 BLACK_LISTED_KEYS = [ |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 re.compile(r".*\.file$") |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 ] |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 BLACK_LISTED_VALUES = [ |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 re.compile(r"^http.*$") |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 ] |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 NUMBERED = re.compile(r"^\s*([^\s]+)\s*=\s*\[([0-9a-zA-Z]+)\]\s*(.+)$") |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 UNUMBERED = re.compile(r"^\s*([^\s]+)\s*=\s*(.+)$") |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 ALPHA = "0123456789" \ |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 "abcdefghijklmnopqrstuvwxyz" \ |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 def decode_ibase62(s): |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 t, c = 0, 1 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 for x in s[::-1]: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 i = ALPHA.find(x) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 t += i*c |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 c *= len(ALPHA) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 return t |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 def ibase62(i): |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 if i == 0: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 return "0" |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 out = [] |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 if i < 0: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 out.append("-") |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 i = -1 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 while i > 0: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 out.append(ALPHA[i % len(ALPHA)]) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 i //= len(ALPHA) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 out.reverse() |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 return ''.join(out) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 def is_blacklisted(key, value): |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 for bl in BLACK_LISTED_KEYS: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 if bl.match(key): |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 return True |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 for bl in BLACK_LISTED_VALUES: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 if bl.match(value): |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 return True |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 return False |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 def find_key(already_numbered, value): |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 for k, v in already_numbered.iteritems(): |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 if v == value: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 return k |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 return None |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 def decorated_content(infile, outfile, already_numbered): |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 for line in infile: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 line = line.strip() |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 m = NUMBERED.match(line) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 if m: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 key, num, value = m.groups() |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 decoded_num = decode_ibase62(num) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 last = find_key(already_numbered, decoded_num) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 if last is None: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 already_numbered[key] = decoded_num |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 elif last != key: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 print >> sys.stderr, "WARN: Number clash: " \ |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 "%s leeds to '%s' and '%s'" % (num, key, last) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 print >> outfile, line |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 continue |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 m = UNUMBERED.match(line) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 if m: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 key, value = m.groups(1) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 if is_blacklisted(key, value): |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 print >> outfile, line |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 else: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 num = already_numbered.setdefault(key, len(already_numbered)) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 print >> outfile, "%s=[%s] %s" % (key, ibase62(num), m.group(2)) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 continue |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 print >> outfile, line |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 def tmp_fname(fname): |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 name = fname + ".tmp" |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 i = 0 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 while os.path.exists(name): |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 name = "%s.tmp%d" % (fname, i) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 i += 1 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 return name |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 def decorate_file(fname, already_numbered): |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 tmp = tmp_fname(fname) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 with open(fname, "r") as infile: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 with open(tmp, "w") as outfile: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 decorated_content(infile, outfile, already_numbered) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 os.rename(tmp, fname) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 def main(): |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 already_numbered = {} |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 for fname in sys.argv[1:]: |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 print >> sys.stderr, "checking %s" % fname |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
115 decorate_file(fname, already_numbered) |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 if __name__ == "__main__": |
003940a7d6c9
I18N: Added script to make keys of property file identifiable with short numbers through the UI.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 main() |