1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-10-21 10:51:17 +00:00

remove .mo from git; rewrite i18n.sh script

This commit is contained in:
lins05
2012-11-06 10:58:21 +08:00
parent 657d2e4c96
commit 2359296c03
17 changed files with 125 additions and 14 deletions

1
.gitignore vendored
View File

@@ -16,3 +16,4 @@ secret_key.py
run-seahub.sh
setenv.sh
.DS_Store
*.mo

115
i18n.sh Executable file
View File

@@ -0,0 +1,115 @@
#!/bin/bash
function usage () {
echo "usage: $0 <options>"
echo
echo " update <app> update po of this app"
echo " update seahub update po of seahub"
echo " update-all update po of all apps"
echo " compile <app> compile po file of this app"
echo " compile seahub compile po file of seahub"
echo " compile-all compile po files of all apps"
echo
}
apps="avatar base contacts group notifications organizations profile share"
function is_valid_app() {
for app in ${apps}; do
if [[ $1 == $app ]]; then
return 0;
fi
done
return 1
}
# On some systems django-admin.py is only django-admin
if which django-admin.py 2>/dev/null 1>&2; then
django_admin=django-admin.py
elif which django-admin 2>/dev/null 1>&2; then
django_admin=django-admin
else
echo "ERROR: django-admin script not found"
exit 1
fi
# check args
if [[ $# == 0 ]]; then
usage;
exit 1;
fi
if [[ $1 == "-h" || $1 == "--help" || $1 == "help" ]]; then
usage;
exit 0;
fi
if [[ $1 != "update" && $1 != "update-all" && $1 != "compile" && $1 != "compile-all" ]]; then
usage;
exit 1;
fi
if [[ $1 == "update" || $1 == "compile" ]]; then
if [[ $# != 2 ]]; then
usage;
exit 1;
fi
if ! is_valid_app $2; then
echo "\"$2\" is not a valid app name";
exit 1
fi
fi
case $1 in
update)
printf "\033[1;32m[i18n]\033[m >>>>> update po of $2 <<<<<\n"
if [[ $2 == "seahub" ]]; then
${django_admin} makemessages -l zh_CN -e py,html \
-i "thirdpart*" -i "api*" -i "avatar*" -i "base*" \
-i "contacts*" -i "group*" -i "notifications*" -i "organizations*" \
-i "profile*" -i "share*" -i "media*"
else
pushd $2 2>/dev/null 1>&2
${django_admin} makemessages -l zh_CN -e py,html
popd 2>/dev/null 1>&2
fi
;;
update-all)
printf "\033[1;32m[i18n]\033[m >>>>> update po of seahub <<<<<\n"
${django_admin} makemessages -l zh_CN -e py,html \
-i "thirdpart*" -i "api*" -i "avatar*" -i "base*" \
-i "contacts*" -i "group*" -i "notifications*" -i "organizations*" \
-i "profile*" -i "share*" -i "media*"
for app in ${apps}; do
printf "\033[1;32m[i18n]\033[m >>>>> update po of ${app} <<<<<\n"
pushd ${app} 2>/dev/null 1>&2
${django_admin} makemessages -l zh_CN -e py,html
popd 2>/dev/null 1>&2
done
;;
compile)
printf "\033[1;32m[i18n]\033[m >>>>> compile po of $2 <<<<<\n"
if [[ $2 == "seahub" ]]; then
${django_admin} compilemessages
else
pushd $2
${django_admin} compilemessages
popd
fi
;;
compile-all)
printf "\033[1;32m[i18n]\033[m >>>>> compile po of seahub <<<<<\n"
${django_admin} compilemessages
apps="avatar base contacts group notifications organizations profile share"
for app in ${apps}; do
printf "\033[1;32m[i18n]\033[m >>>>> compile po of ${app} <<<<<\n"
pushd ${app} 2>/dev/null 1>&2
${django_admin} compilemessages
popd
done
;;
esac
echo Done
echo

View File

@@ -1,11 +0,0 @@
#!/bin/sh
# Ignore all apps
# .py and .html i18n
django-admin.py makemessages -l zh_CN -e py,html -i "thirdpart*" -i "api*" -i "avatar*" -i "base*" -i "contacts*" -i "group*" -i "notifications*" -i "organizations*" -i "profile*" -i "share*" -i "media*"
# js i18n
# django-admin.py makemessages -d djangojs -l zh_CN -i "thirdpart*" -i "api*" -i "avatar*" -i "base*" -i "contacts*" -i "group*" -i "notifications*" -i "organizations*" -i "profile*" -i "share*" -i "media*"
django-admin.py compilemessages

Binary file not shown.

View File

@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-11-05 17:47+0800\n"
"POT-Creation-Date: 2012-11-06 10:43+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"
@@ -1206,14 +1206,18 @@ msgid "Really want to restore this library?"
msgstr "确定要还原这个资料库?"
#: templates/seafile_access_check.html:6
msgid "Preparing, please wait..."
msgstr "处理中,请稍候..."
#: templates/seafile_access_check.html:7
msgid "Make sure Seafile client is running."
msgstr "请确认本地Seafile程序已启动。"
#: templates/seafile_access_check.html:7
#: templates/seafile_access_check.html:8
msgid "Your Seafile client is out of date, please upgrade to latest version."
msgstr "你的 Seafile 客户端版本太旧,请升级到最新版本。"
#: templates/seafile_access_check.html:7
#: templates/seafile_access_check.html:8
msgid "Click to download."
msgstr "点此下载"

View File

@@ -3,6 +3,7 @@
{% block main_panel %}
<div class="text-panel">
<p id="msg-wait">{% trans 'Preparing, please wait...' %}</p>
<p id="msg-client" class="error hide">{% trans "Make sure Seafile client is running." %}</p>
<p id="msg-version" class="error hide">{% trans "Your Seafile client is out of date, please upgrade to latest version." %}<a href="http://www.seafile.com/download">{% trans "Click to download." %}</a></p>
</div>
@@ -29,6 +30,7 @@ $(function() {
});
setTimeout(function() {
$('#msg-wait').addClass('hide');
if (version_mismatch) {
$('#msg-version').removeClass('hide');
} else if (!req_success) {