Revision af2a766f
Compatibilité ascendante pour Babel
Change-Id: Ia07a1f762c8734648f94395b487d7a68a340cb38
babeljs.py | ||
---|---|---|
38 | 38 |
po_files = [] |
39 | 39 |
js_files = [] |
40 | 40 |
|
41 |
if isinstance(self.domain, list): |
|
42 |
domains = self.domain |
|
43 |
else: |
|
44 |
domains = [self.domain] |
|
45 |
|
|
41 | 46 |
if not self.input_file: |
42 | 47 |
if self.locale: |
43 |
po_files.append((self.locale, |
|
44 |
os.path.join(self.directory, self.locale, |
|
45 |
'LC_MESSAGES', |
|
46 |
self.domain + '.po'))) |
|
47 |
js_files.append(os.path.join(self.directory, self.locale, |
|
48 |
'LC_MESSAGES', |
|
49 |
self.domain + '.js')) |
|
48 |
for domain in domains: |
|
49 |
basename = os.path.join(self.directory, self.locale, |
|
50 |
'LC_MESSAGES', domain) |
|
51 |
po_files.append( (self.locale, basename + '.po') ) |
|
52 |
js_files.append( basename + '.js') |
|
50 | 53 |
else: |
51 | 54 |
for locale in os.listdir(self.directory): |
52 |
po_file = os.path.join(self.directory, locale, |
|
53 |
'LC_MESSAGES', self.domain + '.po') |
|
54 |
if os.path.exists(po_file): |
|
55 |
po_files.append((locale, po_file)) |
|
56 |
js_files.append(os.path.join(self.directory, locale, |
|
57 |
'LC_MESSAGES', |
|
58 |
self.domain + '.js')) |
|
55 |
for domain in domains: |
|
56 |
basename = os.path.join(self.directory, locale, |
|
57 |
'LC_MESSAGES', domain) |
|
58 |
if os.path.exists(basename + '.po'): |
|
59 |
po_files.append( (locale, basename + '.po') ) |
|
60 |
js_files.append(basename + '.js') |
|
59 | 61 |
else: |
60 |
po_files.append((self.locale, self.input_file))
|
|
62 |
po_files.append( (self.locale, self.input_file) )
|
|
61 | 63 |
if self.output_file: |
62 | 64 |
js_files.append(self.output_file) |
63 | 65 |
else: |
64 |
js_files.append(os.path.join(self.directory, self.locale, |
|
65 |
'LC_MESSAGES', |
|
66 |
self.domain + '.js')) |
|
66 |
for domain in domains: |
|
67 |
js_files.append(os.path.join( |
|
68 |
self.directory, |
|
69 |
self.locale, |
|
70 |
'LC_MESSAGES', |
|
71 |
domain + '.js' |
|
72 |
)) |
|
67 | 73 |
|
68 | 74 |
for js_file, (locale, po_file) in zip(js_files, po_files): |
69 | 75 |
infile = open(po_file, 'r') |
... | ... | |
106 | 112 |
outfile.write(').install();') |
107 | 113 |
finally: |
108 | 114 |
outfile.close() |
109 |
|
Also available in: Unified diff