mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Make poupdate work correctly without a i18n directory
This commit is contained in:
parent
0ed5d65384
commit
9b7a3dc4c9
1 changed files with 23 additions and 17 deletions
40
bin/poupdate
40
bin/poupdate
|
@ -318,6 +318,11 @@ if __name__ == '__main__':
|
||||||
transl = translations.Translations.from_parsed_options(options)
|
transl = translations.Translations.from_parsed_options(options)
|
||||||
|
|
||||||
gettext_directory = options.gettext_directory
|
gettext_directory = options.gettext_directory
|
||||||
|
|
||||||
|
if (options.pots or options.pos) and not os.path.exists(gettext_directory):
|
||||||
|
print "Error: Gettext directory doesn't exist. Skipping pot/po creation"
|
||||||
|
options.pots = options.pos = False
|
||||||
|
|
||||||
if options.pots:
|
if options.pots:
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
print 'Creating pots in', gettext_directory
|
print 'Creating pots in', gettext_directory
|
||||||
|
@ -337,27 +342,28 @@ if __name__ == '__main__':
|
||||||
for lang, stream in csv_streams.items():
|
for lang, stream in csv_streams.items():
|
||||||
streams[lang].append(stream)
|
streams[lang].append(stream)
|
||||||
|
|
||||||
# Merge in the PO files
|
if os.path.exists(gettext_directory):
|
||||||
if options.langs:
|
# Merge in the PO files
|
||||||
langs = options.langs.split(',')
|
if options.langs:
|
||||||
else:
|
langs = options.langs.split(',')
|
||||||
langs = all_langs(gettext_directory)
|
else:
|
||||||
|
langs = all_langs(gettext_directory)
|
||||||
|
|
||||||
for lang in langs:
|
for lang in langs:
|
||||||
language_directory = os.path.join(gettext_directory, lang)
|
language_directory = os.path.join(gettext_directory, lang)
|
||||||
if options.verbose:
|
|
||||||
print 'Merging translations for %s in %s' % (lang, language_directory)
|
|
||||||
pos = merge_pos(transl, lang, language_directory)
|
|
||||||
|
|
||||||
if options.pos:
|
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
print 'Writing POs for %s' % lang
|
print 'Merging translations for %s in %s' % (lang, language_directory)
|
||||||
save_pos(pos, lang, gettext_directory=gettext_directory)
|
pos = merge_pos(transl, lang, language_directory)
|
||||||
|
|
||||||
if options.verbose:
|
if options.pos:
|
||||||
print_stats(pos)
|
if options.verbose:
|
||||||
|
print 'Writing POs for %s' % lang
|
||||||
|
save_pos(pos, lang, gettext_directory=gettext_directory)
|
||||||
|
|
||||||
streams[lang].append(yield_po_messages(pos))
|
if options.verbose:
|
||||||
|
print_stats(pos)
|
||||||
|
|
||||||
|
streams[lang].append(yield_po_messages(pos))
|
||||||
|
|
||||||
if options.csv:
|
if options.csv:
|
||||||
for lang, lang_streams in streams.items():
|
for lang, lang_streams in streams.items():
|
||||||
|
|
Loading…
Reference in a new issue