1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-04-27 11:01:14 +00:00

[i18n] Offline js i18n

This commit is contained in:
zhengxie 2015-04-14 17:17:05 +08:00 committed by Daniel Pan
parent fe84a428c1
commit 3f66a3932b
7 changed files with 422 additions and 10 deletions

View File

@ -5,13 +5,22 @@ develop: setup-git
setup-git:
cd .git/hooks && ln -sf ../../hooks/* ./
dist: uglify collectstatic compressstatic
dist: locale uglify statici18n collectstatic compressstatic
locale:
@echo "--> Compile locales"
django-admin.py compilemessages
@echo ""
uglify:
@echo "--> Uglify JS files to static/scripts/dist"
rm -rf static/scripts/dist 2> /dev/null
r.js -o static/scripts/build.js
statici18n:
@echo "--> Generate JS locale files in static/scripts/i18n"
python manage.py compilejsi18n
collectstatic:
@echo "--> Collect django static files to media/assets"
rm -rf media/assets 2> /dev/null
@ -28,3 +37,5 @@ clean:
rm -rf media/assets 2> /dev/null
rm -rf static/scripts/dist 2> /dev/null
@echo ""
.PHONY: develop setup-git dist locale uglify statici18n collectstatic compressstatic clean

View File

@ -15,6 +15,8 @@ def make(default=True):
_inplace_change('locale/en/LC_MESSAGES/django.po', '%%s', '%s')
_inplace_change('locale/en/LC_MESSAGES/django.po', '%%(', '%(')
local('django-admin.py makemessages -l en -d djangojs -i "thirdpart" -i "node_modules" -i "media" -i "static/scripts/dist" -i "static/scripts/lib" -i "tests" ')
@task
def push():
"""Push source file to Transifex.

View File

@ -0,0 +1,400 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-04-14 17:14+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: static/scripts/common.js:155 static/scripts/common.js.c:245
#: static/scripts/app/views/dir.js:782 static/scripts/app/views/dir.js.c:839
#: static/scripts/app/views/dirent.js:392
#: static/scripts/app/views/dirent.js:418
#: static/scripts/app/views/myhome-sub-repos.js:101
#: static/scripts/app/views/myhome-sub-repos.js:142
#: static/scripts/app/views/repo.js:81 static/scripts/app/views/share.js:298
#: static/scripts/app/views/sub-lib.js:79
msgid "Failed. Please check the network."
msgstr ""
#: static/scripts/app/models/repo.js:30
msgid "Name is required"
msgstr ""
#: static/scripts/app/models/repo.js:33 static/scripts/app/views/share.js:150
msgid "Please enter password"
msgstr ""
#: static/scripts/app/models/repo.js:34 static/scripts/app/views/share.js:158
msgid "Please enter the password again"
msgstr ""
#: static/scripts/app/models/repo.js:36 static/scripts/app/views/share.js:154
msgid "Password is too short"
msgstr ""
#: static/scripts/app/models/repo.js:38 static/scripts/app/views/share.js:162
msgid "Passwords don't match"
msgstr ""
#: static/scripts/app/views/dir.js:43
msgid "Close (Esc)"
msgstr ""
#: static/scripts/app/views/dir.js:44
#: static/scripts/app/views/group-repo.js:50
msgid "Loading..."
msgstr ""
#: static/scripts/app/views/dir.js:47
msgid "Previous (Left arrow key)"
msgstr ""
#: static/scripts/app/views/dir.js:48
msgid "Next (Right arrow key)"
msgstr ""
#: static/scripts/app/views/dir.js:49
msgid "%curr% of %total%"
msgstr ""
#: static/scripts/app/views/dir.js:55
msgid "Open in New Tab"
msgstr ""
#: static/scripts/app/views/dir.js:58
msgid "<a href=\"%url%\" target=\"_blank\">The image</a> could not be loaded."
msgstr ""
#: static/scripts/app/views/dir.js:133
#: static/scripts/app/views/group-side-nav.js:42
msgid "Please check the network."
msgstr ""
#: static/scripts/app/views/dir.js:146
msgid "Password is required."
msgstr ""
#: static/scripts/app/views/dir.js:301 static/scripts/app/views/dir.js.c:357
#: static/scripts/app/views/dirent.js:221
#: static/scripts/app/views/share.js:441
msgid "It is required."
msgstr ""
#: static/scripts/app/views/dir.js:315 static/scripts/app/views/dir.js.c:381
#: static/scripts/app/views/dirent.js:240
#: static/scripts/app/views/fileupload.js:297
#: static/scripts/app/views/fileupload.js:310
#: static/scripts/app/views/fileupload.js:322
#: static/scripts/app/views/fileupload.js:334
#: static/scripts/app/views/myhome-sub-repos.js:131
msgid "Just now"
msgstr ""
#: static/scripts/app/views/dir.js:363
msgid "Only an extension there, please input a name."
msgstr ""
#: static/scripts/app/views/dir.js:504 static/scripts/app/views/dir.js.c:633
msgid "Processing..."
msgstr ""
#: static/scripts/app/views/dir.js:540
msgid "Successfully deleted %(name)s."
msgstr ""
#: static/scripts/app/views/dir.js:542
msgid "Successfully deleted %(name)s and 1 other item."
msgstr ""
#: static/scripts/app/views/dir.js:544
msgid "Successfully deleted %(name)s and %(amount)s other items."
msgstr ""
#: static/scripts/app/views/dir.js:551
msgid "Internal error. Failed to delete %(name)s."
msgstr ""
#: static/scripts/app/views/dir.js:553
msgid "Internal error. Failed to delete %(name)s and 1 other item."
msgstr ""
#: static/scripts/app/views/dir.js:555
msgid "Internal error. Failed to delete %(name)s and %(amount)s other items."
msgstr ""
#: static/scripts/app/views/dir.js:568
msgid "Delete Items"
msgstr ""
#: static/scripts/app/views/dir.js:569
msgid "Are you sure you want to delete these selected items?"
msgstr ""
#: static/scripts/app/views/dir.js:628 static/scripts/app/views/dirent.js:317
msgid "Invalid destination path"
msgstr ""
#: static/scripts/app/views/dir.js:676
msgid "Successfully moved %(name)s."
msgstr ""
#: static/scripts/app/views/dir.js:678
msgid "Successfully moved %(name)s and 1 other item."
msgstr ""
#: static/scripts/app/views/dir.js:680
msgid "Successfully moved %(name)s and %(amount)s other items."
msgstr ""
#: static/scripts/app/views/dir.js:684
msgid "Successfully copied %(name)s."
msgstr ""
#: static/scripts/app/views/dir.js:686
msgid "Successfully copied %(name)s and 1 other item."
msgstr ""
#: static/scripts/app/views/dir.js:688
msgid "Successfully copied %(name)s and %(amount)s other items."
msgstr ""
#: static/scripts/app/views/dir.js:700
msgid "Internal error. Failed to move %(name)s and %(amount)s other item(s)."
msgstr ""
#: static/scripts/app/views/dir.js:702
msgid "Internal error. Failed to move %(name)s."
msgstr ""
#: static/scripts/app/views/dir.js:706
msgid "Internal error. Failed to copy %(name)s and %(amount)s other item(s)."
msgstr ""
#: static/scripts/app/views/dir.js:708
msgid "Internal error. Failed to copy %(name)s."
msgstr ""
#: static/scripts/app/views/dir.js:748
msgid "Moving file %(index)s of %(total)s"
msgstr ""
#: static/scripts/app/views/dir.js:748
msgid "Copying file %(index)s of %(total)s"
msgstr ""
#: static/scripts/app/views/dir.js:770
msgid "Failed to move %(name)s"
msgstr ""
#: static/scripts/app/views/dir.js:770
msgid "Failed to copy %(name)s"
msgstr ""
#: static/scripts/app/views/dir.js:830 static/scripts/app/views/dirent.js:381
#: static/scripts/app/views/dirent.js:409
msgid "Canceled."
msgstr ""
#: static/scripts/app/views/dirent.js:191
msgid "Successfully deleted %(name)s"
msgstr ""
#: static/scripts/app/views/dirent.js:202
msgid "Rename Directory"
msgstr ""
#: static/scripts/app/views/dirent.js:202
msgid "Rename File"
msgstr ""
#: static/scripts/app/views/dirent.js:225
msgid "You have not renamed it."
msgstr ""
#: static/scripts/app/views/dirent.js:277
msgid "Move {placeholder} to:"
msgstr ""
#: static/scripts/app/views/dirent.js:277
msgid "Copy {placeholder} to:"
msgstr ""
#: static/scripts/app/views/dirent.js:351
msgid "Moving %(name)s"
msgstr ""
#: static/scripts/app/views/dirent.js:351
msgid "Copying %(name)s"
msgstr ""
#: static/scripts/app/views/dirent.js:367
msgid "Saving..."
msgstr ""
#: static/scripts/app/views/dirent.js:381
msgid "Failed."
msgstr ""
#: static/scripts/app/views/fileupload.js:10
msgid "File is too big"
msgstr ""
#: static/scripts/app/views/fileupload.js:11
msgid "File is too small"
msgstr ""
#: static/scripts/app/views/fileupload.js:12
msgid "Filetype not allowed"
msgstr ""
#: static/scripts/app/views/fileupload.js:13
msgid "Max number of files exceeded"
msgstr ""
#: static/scripts/app/views/fileupload.js:14
msgid "Uploaded bytes exceed file size"
msgstr ""
#: static/scripts/app/views/fileupload.js:15
msgid "Empty file upload result"
msgstr ""
#: static/scripts/app/views/fileupload.js:17
#: static/scripts/app/views/group-repo.js:58
msgid "Error"
msgstr ""
#: static/scripts/app/views/fileupload.js:18
msgid "uploaded"
msgstr ""
#: static/scripts/app/views/fileupload.js:19
msgid "canceled"
msgstr ""
#: static/scripts/app/views/fileupload.js:20
msgid "Start"
msgstr ""
#: static/scripts/app/views/fileupload.js:21
msgid "Cancel"
msgstr ""
#: static/scripts/app/views/fileupload.js:22
msgid "Delete"
msgstr ""
#: static/scripts/app/views/fileupload.js:46
msgid "File Uploading..."
msgstr ""
#: static/scripts/app/views/fileupload.js:47
msgid "File Upload complete"
msgstr ""
#: static/scripts/app/views/fileupload.js:48
msgid "File Upload canceled"
msgstr ""
#: static/scripts/app/views/fileupload.js:49
msgid "File Upload failed"
msgstr ""
#: static/scripts/app/views/fileupload.js:153
msgid "Failed to get upload url"
msgstr ""
#: static/scripts/app/views/fileupload.js:186
msgid "Failed to get update url"
msgstr ""
#: static/scripts/app/views/fileupload.js:197
msgid "Replace file {filename}?"
msgstr ""
#: static/scripts/app/views/group-repo.js:55
#: static/scripts/app/views/organization-repo.js:26
#: static/scripts/app/views/shared-repo.js:26
msgid "Success"
msgstr ""
#: static/scripts/app/views/group-repo.js:64
msgid "Unshare Library"
msgstr ""
#: static/scripts/app/views/group-repo.js:65
msgid "Are you sure you want to unshare {placeholder} ?"
msgstr ""
#: static/scripts/app/views/myhome-sub-repos.js:93
msgid "You don't have any library at present."
msgstr ""
#: static/scripts/app/views/myhome-sub-repos.js:112
msgid "Please choose a directory"
msgstr ""
#: static/scripts/app/views/repo.js:48 static/scripts/app/views/sub-lib.js:46
msgid "Really want to delete {lib_name}?"
msgstr "确定要删除 {lib_name} ?"
#: static/scripts/app/views/repo.js:71 static/scripts/app/views/sub-lib.js:69
msgid "Delete succeeded."
msgstr ""
#: static/scripts/app/views/share.js:52
msgid "Share {placeholder}"
msgstr ""
#: static/scripts/app/views/share.js:175
msgid "Please enter days."
msgstr ""
#: static/scripts/app/views/share.js:179
msgid "Please enter valid days"
msgstr ""
#: static/scripts/app/views/share.js:265
msgid "Please input at least an email."
msgstr ""
#: static/scripts/app/views/share.js:282
msgid "Successfully sent to {placeholder}"
msgstr ""
#: static/scripts/app/views/share.js:286
msgid "Failed to send to {placeholder}"
msgstr ""
#: static/scripts/app/views/share.js:416 static/scripts/app/views/share.js:481
msgid "Select contacts or input"
msgstr ""
#: static/scripts/app/views/share.js:453 static/scripts/app/views/share.js:535
msgid "Successfully shared to {placeholder}"
msgstr ""
#: static/scripts/app/views/share.js:457 static/scripts/app/views/share.js:539
msgid "Failed to share to {placeholder}"
msgstr ""
#: static/scripts/app/views/share.js:500
msgid "Select groups"
msgstr ""
#: static/scripts/app/views/share.js:517
msgid "Please select a contact or a group."
msgstr ""

View File

@ -5,3 +5,4 @@ Pillow>=2.6.1,<3.0.0
Django>=1.5.8,<1.6
Djblets==0.6.14
django-compressor==1.4
django-statici18n==1.1.2

View File

@ -84,6 +84,10 @@ STATICFILES_DIRS = (
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.CachedStaticFilesStorage'
# StaticI18N config
STATICI18N_ROOT = '%s/static/scripts' % PROJECT_ROOT
STATICI18N_OUTPUT_DIR = 'i18n'
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
@ -170,6 +174,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'djblets.util.context_processors.siteRoot',
'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
@ -185,6 +190,7 @@ INSTALLED_APPS = (
'registration',
'captcha',
'compressor',
'statici18n',
'seahub.api2',
'seahub.avatar',

View File

@ -165,7 +165,7 @@ var app = {
}
};
</script>
<script type="text/javascript" src="{% url 'seahub.views.i18n.cached_javascript_catalog' %}"></script>
<script src="{{ STATIC_URL }}scripts/i18n/{{ LANGUAGE_CODE }}/djangojs.js"></script>
{% block extra_script %}{% endblock %}

View File

@ -313,11 +313,3 @@ if TRAFFIC_STATS_ENABLED:
urlpatterns += patterns('',
url(r'^sys/trafficadmin/$', sys_traffic_admin, name='sys_trafficadmin'),
)
js_info_dict = {
'packages': ('seahub.settings',),
}
urlpatterns += patterns('',
(r'^jsi18n/$', 'seahub.views.i18n.cached_javascript_catalog', js_info_dict),
)