Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Modified makemessages so it creates .pot files once per invocation.

It creates a `locale/django.pot` file once instead of one
`locale/<locale_code>/django.pot` file for every locale involved.

Thanks Michal Čihař for the report and patch.
  • Loading branch information...
commit 248aee16066b2a336f16c844580cf043d853874b 1 parent eee8652
@ramiro ramiro authored
View
24 django/core/management/commands/makemessages.py
@@ -234,8 +234,6 @@ def write_po_file(pofile, potfile, domain, locale, verbosity, stdout,
"#. #-#-#-#-# %s.pot (PACKAGE VERSION) #-#-#-#-#\n" % domain, "")
with open(pofile, 'w') as fp:
fp.write(msgs)
- if not keep_pot:
- os.unlink(potfile)
if no_obsolete:
msgs, errors, status = _popen(
'msgattrib %s %s -o "%s" --no-obsolete "%s"' %
@@ -314,6 +312,16 @@ def make_messages(locale=None, domain='django', verbosity=1, all=False,
wrap = '--no-wrap' if no_wrap else ''
location = '--no-location' if no_location else ''
+ potfile = os.path.join(localedir, '%s.pot' % str(domain))
+
+ if os.path.exists(potfile):
+ os.unlink(potfile)
+
+ for dirpath, file in find_files(".", ignore_patterns, verbosity,
+ stdout, symlinks=symlinks):
+ process_file(file, dirpath, potfile, domain, verbosity, extensions,
+ wrap, location, keep_pot, stdout)
+
for locale in locales:
if verbosity > 0:
stdout.write("processing language %s\n" % locale)
@@ -322,20 +330,14 @@ def make_messages(locale=None, domain='django', verbosity=1, all=False,
os.makedirs(basedir)
pofile = os.path.join(basedir, '%s.po' % str(domain))
- potfile = os.path.join(basedir, '%s.pot' % str(domain))
-
- if os.path.exists(potfile):
- os.unlink(potfile)
-
- for dirpath, file in find_files(".", ignore_patterns, verbosity,
- stdout, symlinks=symlinks):
- process_file(file, dirpath, potfile, domain, verbosity, extensions,
- wrap, location, keep_pot, stdout)
if os.path.exists(potfile):
write_po_file(pofile, potfile, domain, locale, verbosity, stdout,
not invoked_for_django, wrap, location, no_obsolete, keep_pot)
+ if not keep_pot:
+ os.unlink(potfile)
+
class Command(NoArgsCommand):
option_list = NoArgsCommand.option_list + (
View
3  tests/regressiontests/i18n/commands/extraction.py
@@ -297,8 +297,9 @@ def test_no_location_disabled(self):
class KeepPotFileExtractorTests(ExtractorTests):
+ POT_FILE='locale/django.pot'
+
def setUp(self):
- self.POT_FILE = self.PO_FILE + 't'
super(KeepPotFileExtractorTests, self).setUp()
def tearDown(self):
Please sign in to comment.
Something went wrong with that request. Please try again.