diff --git a/.tx/config b/.tx/config index 0c2fac36ec..244e45fb98 100644 --- a/.tx/config +++ b/.tx/config @@ -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//LC_MESSAGES/django.po +file_filter = static/locale//LC_MESSAGES/django.po lang_map = zh-Hans: zh_CN [zulip.translationsjson] diff --git a/locale/de/LC_MESSAGES/django.po b/static/locale/de/LC_MESSAGES/django.po similarity index 100% rename from locale/de/LC_MESSAGES/django.po rename to static/locale/de/LC_MESSAGES/django.po diff --git a/locale/es/LC_MESSAGES/django.po b/static/locale/es/LC_MESSAGES/django.po similarity index 100% rename from locale/es/LC_MESSAGES/django.po rename to static/locale/es/LC_MESSAGES/django.po diff --git a/locale/fr/LC_MESSAGES/django.po b/static/locale/fr/LC_MESSAGES/django.po similarity index 100% rename from locale/fr/LC_MESSAGES/django.po rename to static/locale/fr/LC_MESSAGES/django.po diff --git a/locale/ja/LC_MESSAGES/django.po b/static/locale/ja/LC_MESSAGES/django.po similarity index 100% rename from locale/ja/LC_MESSAGES/django.po rename to static/locale/ja/LC_MESSAGES/django.po diff --git a/locale/ko/LC_MESSAGES/django.po b/static/locale/ko/LC_MESSAGES/django.po similarity index 100% rename from locale/ko/LC_MESSAGES/django.po rename to static/locale/ko/LC_MESSAGES/django.po diff --git a/locale/pt/LC_MESSAGES/django.po b/static/locale/pt/LC_MESSAGES/django.po similarity index 100% rename from locale/pt/LC_MESSAGES/django.po rename to static/locale/pt/LC_MESSAGES/django.po diff --git a/locale/ru/LC_MESSAGES/django.po b/static/locale/ru/LC_MESSAGES/django.po similarity index 100% rename from locale/ru/LC_MESSAGES/django.po rename to static/locale/ru/LC_MESSAGES/django.po diff --git a/locale/sr/LC_MESSAGES/django.po b/static/locale/sr/LC_MESSAGES/django.po similarity index 100% rename from locale/sr/LC_MESSAGES/django.po rename to static/locale/sr/LC_MESSAGES/django.po diff --git a/locale/zh_CN/LC_MESSAGES/django.po b/static/locale/zh_CN/LC_MESSAGES/django.po similarity index 100% rename from locale/zh_CN/LC_MESSAGES/django.po rename to static/locale/zh_CN/LC_MESSAGES/django.po diff --git a/tools/build-release-tarball b/tools/build-release-tarball index 33fa921000..8171906297 100755 --- a/tools/build-release-tarball +++ b/tools/build-release-tarball @@ -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" diff --git a/tools/update-prod-static b/tools/update-prod-static index 7ed4d716c4..36bba21fbb 100755 --- a/tools/update-prod-static +++ b/tools/update-prod-static @@ -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() diff --git a/zerver/management/commands/compilemessages.py b/zerver/management/commands/compilemessages.py index 33686236e7..ab6a29340a 100644 --- a/zerver/management/commands/compilemessages.py +++ b/zerver/management/commands/compilemessages.py @@ -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) diff --git a/zproject/settings.py b/zproject/settings.py index bda88e7d5c..e6a2a40937 100644 --- a/zproject/settings.py +++ b/zproject/settings.py @@ -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