Mercurial > dive4elements > river
annotate artifacts/contrib/find-obsolete-i18n-strings.py @ 8730:cb33de3434a8
(issue1754) Proper subtitle handling for Radius
This deduplicates the subtitle and zoom / radius calculation code
by moving it out of the processors. Doing this fixes cases where
the subtitle would be removed when a the according filtered facet
was removed although it should still have shown the Range for example.
Range is now also added as a subtitle for the difference diagrams.
This adds some tasty hack (with cheese) to determine wether or
not the user has set the subtitle. See the comment in
getChartSubtitlePure in LongitudinalSectionGenerator2 for details.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 30 Apr 2015 13:06:51 +0200 |
parents | 26971f97105f |
children |
rev | line source |
---|---|
7957
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
2 |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
3 import os |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
4 import re |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
5 import sys |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
6 |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
7 KEY_RE = re.compile(r"^\s*([^\s=]+)\s*=.*$") |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
8 |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
9 def main(): |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
10 content = [] |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
11 for root, dirs, files in os.walk('.'): |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
12 for f in files: |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
13 if not (f.endswith(".java") or f.endswith(".xml")): |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
14 continue |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
15 p = os.path.join(root, f) |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
16 with open(p, "rb") as jf: |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
17 content.append(jf.read()) |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
18 |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
19 content = ''.join(content) |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
20 |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
21 for arg in sys.argv[1:]: |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
22 with open(arg, "rb") as prop: |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
23 for line in prop: |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
24 m = KEY_RE.match(line) |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
25 if not m: |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
26 continue |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
27 key = m.group(1) |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
28 if content.find(key) == -1: |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
29 print key |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
30 |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
31 if __name__ == "__main__": |
26971f97105f
Added script to find unused i18n in *.java and *.xml files.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
diff
changeset
|
32 main() |