|
Revision 3062, 0.9 kB
(checked in by paul, 2 years ago)
|
Removed trunk/dabo/tools directory; moved those scripts to the exising trunk/tools directory.
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
"""This script scans project directories and generates the .pot files needed for localization.""" |
|---|
| 2 |
import os |
|---|
| 3 |
import popen2 |
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
def processLoc(proj, drct, xtra=None): |
|---|
| 7 |
if xtra is None: |
|---|
| 8 |
pth = drct |
|---|
| 9 |
xtra = "" |
|---|
| 10 |
else: |
|---|
| 11 |
pth = os.path.join(drct, xtra) |
|---|
| 12 |
flist = os.listdir(pth) |
|---|
| 13 |
for fname in flist: |
|---|
| 14 |
if fname.startswith("."): |
|---|
| 15 |
# Hidden file; skip |
|---|
| 16 |
continue |
|---|
| 17 |
fullname = os.path.join(pth, fname) |
|---|
| 18 |
newXtra = os.path.join(xtra, fname) |
|---|
| 19 |
if os.path.isdir(fullname): |
|---|
| 20 |
upd, ins = processLoc(proj, drct, newXtra) |
|---|
| 21 |
updated += upd |
|---|
| 22 |
inserted += ins |
|---|
| 23 |
else: |
|---|
| 24 |
if fname.endswith(".py"): |
|---|
| 25 |
os.system("pygettext.py -a -X %s" % fullname) |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
def main(): |
|---|
| 29 |
### NOTE: This must be configured with your local paths |
|---|
| 30 |
projects = {"dabo": "/path/to/dabo/", |
|---|
| 31 |
"ide": "/path/to/ide/", |
|---|
| 32 |
"demo": "/path/to/demo/"} |
|---|
| 33 |
for project, drct in projects.items(): |
|---|
| 34 |
processLoc(project, drct) |
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
if __name__ == "__main__": |
|---|
| 38 |
main() |
|---|