mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 03:53:50 +00:00 
			
		
		
		
	Move locale to static/locale
This commit is contained in:
		| @@ -2,10 +2,10 @@ | |||||||
| host = https://www.transifex.com | host = https://www.transifex.com | ||||||
|  |  | ||||||
| [zulip.djangopo] | [zulip.djangopo] | ||||||
| source_file = locale/en/LC_MESSAGES/django.po | source_file = static/locale/en/LC_MESSAGES/django.po | ||||||
| source_lang = en | source_lang = en | ||||||
| type = PO | 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 | lang_map = zh-Hans: zh_CN | ||||||
|  |  | ||||||
| [zulip.translationsjson] | [zulip.translationsjson] | ||||||
|   | |||||||
| @@ -86,7 +86,7 @@ find prod-static/serve/third/gemoji/images/emoji/ -regex '.*\.[0-9a-f]+\.png' -d | |||||||
|  |  | ||||||
| cd "$TMPDIR" | 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" | rm -rf "$prefix" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -60,8 +60,8 @@ subprocess.check_call(['mv', os.path.join(settings.STATIC_ROOT, 'source-map'), | |||||||
|                       stdout=fp, stderr=fp) |                       stdout=fp, stderr=fp) | ||||||
|  |  | ||||||
| # Move language_options.json to the production release | # Move language_options.json to the production release | ||||||
| subprocess.check_call(['mv', 'static/locale/language_options.json', | subprocess.check_call(['mv', 'static/locale', | ||||||
|                        os.path.join(settings.STATIC_ROOT, 'locale/language_options.json')], |                        os.path.join(settings.STATIC_ROOT, 'locale')], | ||||||
|                       stdout=fp, stderr=fp) |                       stdout=fp, stderr=fp) | ||||||
|  |  | ||||||
| fp.close() | fp.close() | ||||||
|   | |||||||
| @@ -16,10 +16,8 @@ class Command(compilemessages.Command): | |||||||
|         self.extract_language_options() |         self.extract_language_options() | ||||||
|  |  | ||||||
|     def extract_language_options(self): |     def extract_language_options(self): | ||||||
|         DEPLOY_ROOT = settings.DEPLOY_ROOT |         locale_path = "{}/locale".format(settings.STATIC_ROOT) | ||||||
|  |         output_path = "{}/language_options.json".format(locale_path) | ||||||
|         output_path = "{}/static/locale/language_options.json".format(DEPLOY_ROOT) |  | ||||||
|         locale_path = "{}/locale".format(DEPLOY_ROOT) |  | ||||||
|  |  | ||||||
|         po_template = '{}/{}/LC_MESSAGES/django.po' |         po_template = '{}/{}/LC_MESSAGES/django.po' | ||||||
|         data = {'languages': []}  # type: Dict[str, List[Dict[str, str]]] |         data = {'languages': []}  # type: Dict[str, List[Dict[str, str]]] | ||||||
| @@ -38,6 +36,9 @@ class Command(compilemessages.Command): | |||||||
|                 name = 'Simplified Chinese' |                 name = 'Simplified Chinese' | ||||||
|             else: |             else: | ||||||
|                 filename = po_template.format(locale_path, locale) |                 filename = po_template.format(locale_path, locale) | ||||||
|  |                 if not os.path.exists(filename): | ||||||
|  |                     continue | ||||||
|  |  | ||||||
|                 with open(filename, 'r') as reader: |                 with open(filename, 'r') as reader: | ||||||
|                     result = lang_name_re.search(reader.read()) |                     result = lang_name_re.search(reader.read()) | ||||||
|                     if result: |                     if result: | ||||||
| @@ -56,4 +57,4 @@ class Command(compilemessages.Command): | |||||||
|                 data['languages'].append(info) |                 data['languages'].append(info) | ||||||
|  |  | ||||||
|         with open(output_path, 'w') as writer: |         with open(output_path, 'w') as writer: | ||||||
|             ujson.dump(data, writer) |             ujson.dump(data, writer, indent=2) | ||||||
|   | |||||||
| @@ -220,7 +220,6 @@ USE_L10N = True | |||||||
| USE_TZ = True | USE_TZ = True | ||||||
|  |  | ||||||
| DEPLOY_ROOT = os.path.join(os.path.realpath(os.path.dirname(__file__)), '..') | 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 | # this directory will be used to store logs for development environment | ||||||
| DEVELOPMENT_LOG_DIRECTORY = os.path.join(DEPLOY_ROOT, 'var', 'log') | DEVELOPMENT_LOG_DIRECTORY = os.path.join(DEPLOY_ROOT, 'var', 'log') | ||||||
| # Make redirects work properly behind a reverse proxy | # Make redirects work properly behind a reverse proxy | ||||||
| @@ -560,6 +559,8 @@ else: | |||||||
|     else: |     else: | ||||||
|         STATIC_ROOT = os.path.abspath('prod-static/serve') |         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. | # We want all temporary uploaded files to be stored on disk. | ||||||
| FILE_UPLOAD_MAX_MEMORY_SIZE = 0 | FILE_UPLOAD_MAX_MEMORY_SIZE = 0 | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user