Move locale to static/locale

This commit is contained in:
Umair Khan 2016-07-14 15:00:26 +05:00 committed by Tim Abbott
parent cdf2664030
commit b546391f0b
14 changed files with 13 additions and 11 deletions

View File

@ -2,10 +2,10 @@
host = https://www.transifex.com
[zulip.djangopo]
source_file = locale/en/LC_MESSAGES/django.po
source_file = static/locale/en/LC_MESSAGES/django.po
source_lang = en
type = PO
file_filter = locale/<lang>/LC_MESSAGES/django.po
file_filter = static/locale/<lang>/LC_MESSAGES/django.po
lang_map = zh-Hans: zh_CN
[zulip.translationsjson]

View File

@ -86,7 +86,7 @@ find prod-static/serve/third/gemoji/images/emoji/ -regex '.*\.[0-9a-f]+\.png' -d
cd "$TMPDIR"
tar --append -f "$TARBALL" "$prefix/prod-static" "$prefix/build_id" "$prefix/version" "$prefix/locale"
tar --append -f "$TARBALL" "$prefix/prod-static" "$prefix/build_id" "$prefix/version"
rm -rf "$prefix"

View File

@ -60,8 +60,8 @@ subprocess.check_call(['mv', os.path.join(settings.STATIC_ROOT, 'source-map'),
stdout=fp, stderr=fp)
# Move language_options.json to the production release
subprocess.check_call(['mv', 'static/locale/language_options.json',
os.path.join(settings.STATIC_ROOT, 'locale/language_options.json')],
subprocess.check_call(['mv', 'static/locale',
os.path.join(settings.STATIC_ROOT, 'locale')],
stdout=fp, stderr=fp)
fp.close()

View File

@ -16,10 +16,8 @@ class Command(compilemessages.Command):
self.extract_language_options()
def extract_language_options(self):
DEPLOY_ROOT = settings.DEPLOY_ROOT
output_path = "{}/static/locale/language_options.json".format(DEPLOY_ROOT)
locale_path = "{}/locale".format(DEPLOY_ROOT)
locale_path = "{}/locale".format(settings.STATIC_ROOT)
output_path = "{}/language_options.json".format(locale_path)
po_template = '{}/{}/LC_MESSAGES/django.po'
data = {'languages': []} # type: Dict[str, List[Dict[str, str]]]
@ -38,6 +36,9 @@ class Command(compilemessages.Command):
name = 'Simplified Chinese'
else:
filename = po_template.format(locale_path, locale)
if not os.path.exists(filename):
continue
with open(filename, 'r') as reader:
result = lang_name_re.search(reader.read())
if result:
@ -56,4 +57,4 @@ class Command(compilemessages.Command):
data['languages'].append(info)
with open(output_path, 'w') as writer:
ujson.dump(data, writer)
ujson.dump(data, writer, indent=2)

View File

@ -220,7 +220,6 @@ USE_L10N = True
USE_TZ = True
DEPLOY_ROOT = os.path.join(os.path.realpath(os.path.dirname(__file__)), '..')
LOCALE_PATHS = (os.path.join(DEPLOY_ROOT, 'locale'),)
# this directory will be used to store logs for development environment
DEVELOPMENT_LOG_DIRECTORY = os.path.join(DEPLOY_ROOT, 'var', 'log')
# Make redirects work properly behind a reverse proxy
@ -560,6 +559,8 @@ else:
else:
STATIC_ROOT = os.path.abspath('prod-static/serve')
LOCALE_PATHS = (os.path.join(STATIC_ROOT, 'locale'),)
# We want all temporary uploaded files to be stored on disk.
FILE_UPLOAD_MAX_MEMORY_SIZE = 0