mirror of
https://github.com/django/django.git
synced 2025-03-25 08:40:45 +00:00
[1.7.x] Updated Django makemessages process
makemessages should now automatically distribute translatable strings in the proper locale files, for Django too (see 50a8ab7cd1e6). Backport of 7999ed9b69 from master.
This commit is contained in:
parent
ed98757e4b
commit
db2aacff99
@ -257,8 +257,6 @@ class Command(NoArgsCommand):
|
|||||||
self.locale_paths = [os.path.abspath(os.path.join('conf', 'locale'))]
|
self.locale_paths = [os.path.abspath(os.path.join('conf', 'locale'))]
|
||||||
self.default_locale_path = self.locale_paths[0]
|
self.default_locale_path = self.locale_paths[0]
|
||||||
self.invoked_for_django = True
|
self.invoked_for_django = True
|
||||||
# Ignoring all contrib apps
|
|
||||||
self.ignore_patterns += ['contrib/*']
|
|
||||||
else:
|
else:
|
||||||
self.locale_paths.extend(list(settings.LOCALE_PATHS))
|
self.locale_paths.extend(list(settings.LOCALE_PATHS))
|
||||||
# Allow to run makemessages inside an app dir
|
# Allow to run makemessages inside an app dir
|
||||||
|
@ -84,21 +84,17 @@ def update_catalogs(resources=None, languages=None):
|
|||||||
Update the en/LC_MESSAGES/django.po (main and contrib) files with
|
Update the en/LC_MESSAGES/django.po (main and contrib) files with
|
||||||
new/updated translatable strings.
|
new/updated translatable strings.
|
||||||
"""
|
"""
|
||||||
contrib_dirs = _get_locale_dirs(resources, include_core=False)
|
if resources is not None:
|
||||||
|
print("`update_catalogs` will always process all resources.")
|
||||||
|
contrib_dirs = _get_locale_dirs(None, include_core=False)
|
||||||
|
|
||||||
os.chdir(os.path.join(os.getcwd(), 'django'))
|
os.chdir(os.path.join(os.getcwd(), 'django'))
|
||||||
print("Updating main en catalog")
|
print("Updating en catalogs for Django and contrib apps...")
|
||||||
call_command('makemessages', locale=['en'])
|
call_command('makemessages', locale=['en'])
|
||||||
_check_diff('core', os.path.join(os.getcwd(), 'conf', 'locale'))
|
_check_diff('core', os.path.join(os.getcwd(), 'conf', 'locale'))
|
||||||
|
|
||||||
# Contrib catalogs
|
# Stats for contrib catalogs
|
||||||
for name, dir_ in contrib_dirs:
|
for name, dir_ in contrib_dirs:
|
||||||
os.chdir(os.path.join(dir_, '..'))
|
|
||||||
print("Updating en catalog in %s" % dir_)
|
|
||||||
if name.endswith('-js'):
|
|
||||||
call_command('makemessages', locale=['en'], domain='djangojs')
|
|
||||||
else:
|
|
||||||
call_command('makemessages', locale=['en'])
|
|
||||||
_check_diff(name, dir_)
|
_check_diff(name, dir_)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user