diff --git a/frontend/src/components/subscription.js b/frontend/src/components/subscription.js index 91724ba9b9..b1e860de85 100644 --- a/frontend/src/components/subscription.js +++ b/frontend/src/components/subscription.js @@ -57,7 +57,7 @@ class Plans extends Component { assetQuota = (assetQuotaUnitCount) * currentPlan.asset_quota_unit; totalAmount = assetQuotaUnitCount * currentPlan.price_per_asset_quota_unit; } else { - toaster.danger(gettext('Internal Server Error.')); + toaster.danger(gettext('Internal Server Error')); return; } @@ -263,8 +263,8 @@ class Plans extends Component { return this.renderAddUser(); } else if (paymentType === 'buy_quota') { return this.renderBuyQuota(); - } else { - toaster.danger(gettext('Internal Server Error.')); + } else { + toaster.danger(gettext('Internal Server Error')); return; } } diff --git a/frontend/src/pages/institution-admin/user-list/user-item.js b/frontend/src/pages/institution-admin/user-list/user-item.js index 2150878ed6..066c34be5e 100644 --- a/frontend/src/pages/institution-admin/user-list/user-item.js +++ b/frontend/src/pages/institution-admin/user-list/user-item.js @@ -9,13 +9,13 @@ import moment from 'moment'; const OPERATIONS =[ { value: 'active', - text: gettext('active'), + text: gettext('Active'), is_active: true, isSelected: false, }, { value: 'inactive', - text: gettext('inactive'), + text: gettext('Inactive'), is_active: false, isSelected: false, }, diff --git a/seahub/api2/endpoints/admin/account.py b/seahub/api2/endpoints/admin/account.py index 37fcd9902a..a24626d40e 100644 --- a/seahub/api2/endpoints/admin/account.py +++ b/seahub/api2/endpoints/admin/account.py @@ -239,7 +239,7 @@ class Account(APIView): if space_quota_mb < 0: return api_error(status.HTTP_400_BAD_REQUEST, - _('Space quota is too low (minimum value is 0)')) + 'Space quota is too low (minimum value is 0)') if is_org_context(request): org_id = request.user.org.org_id @@ -247,7 +247,7 @@ class Account(APIView): get_file_size_unit('MB') if space_quota_mb > org_quota_mb: return api_error(status.HTTP_400_BAD_REQUEST, \ - _('Failed to set quota: maximum quota is %d MB' % org_quota_mb)) + 'Failed to set quota: maximum quota is %d MB' % org_quota_mb) # argument check for is_trial is_trial = request.data.get("is_trial", None) diff --git a/seahub/api2/endpoints/admin/users_batch.py b/seahub/api2/endpoints/admin/users_batch.py index 48f71f2038..49c639742f 100644 --- a/seahub/api2/endpoints/admin/users_batch.py +++ b/seahub/api2/endpoints/admin/users_batch.py @@ -174,7 +174,7 @@ class AdminUsersBatch(APIView): return api_error(status.HTTP_400_BAD_REQUEST, error_msg) if quota_total_mb < 0: - error_msg = _('Space quota is too low (minimum value is 0)') + error_msg = 'Space quota is too low (minimum value is 0)' return api_error(status.HTTP_400_BAD_REQUEST, error_msg) quota_total_byte = quota_total_mb * get_file_size_unit('MB') diff --git a/seahub/api2/endpoints/repo_auto_delete.py b/seahub/api2/endpoints/repo_auto_delete.py index 2eb1d34893..a30715ba85 100644 --- a/seahub/api2/endpoints/repo_auto_delete.py +++ b/seahub/api2/endpoints/repo_auto_delete.py @@ -83,6 +83,6 @@ class RepoAutoDeleteView(APIView): repo_auto_delete, _ = RepoAutoDelete.objects.update_or_create(repo_id=repo_id, defaults={'days':auto_delete_days}) except Exception as e: logger.error(e) - return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, 'Internal Server Error.') + return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, 'Internal Server Error') return Response({'auto_delete_days':repo_auto_delete.days}) \ No newline at end of file diff --git a/seahub/forms.py b/seahub/forms.py index bf4115b8f8..5f487ed6ed 100644 --- a/seahub/forms.py +++ b/seahub/forms.py @@ -153,7 +153,7 @@ class SetUserQuotaForm(forms.Form): """ space_quota = forms.IntegerField(min_value=0, error_messages={'required': _('Space quota can\'t be empty'), - 'min_value': _('Space quota is too low (minimum value is 0)')}) + 'min_value': 'Space quota is too low (minimum value is 0)'}) class RepoSettingForm(forms.Form): """ diff --git a/seahub/institutions/api_views.py b/seahub/institutions/api_views.py index ee985da323..f6d0aa7183 100644 --- a/seahub/institutions/api_views.py +++ b/seahub/institutions/api_views.py @@ -175,7 +175,7 @@ class InstAdminUser(APIView): return api_error(status.HTTP_400_BAD_REQUEST, error_msg) if quota_total_mb < 0: - error_msg = _("Space quota is too low (minimum value is 0).") + error_msg = "Space quota is too low (minimum value is 0)." return api_error(status.HTTP_400_BAD_REQUEST, error_msg) quota = quota_total_mb * get_file_size_unit('MB') @@ -183,7 +183,7 @@ class InstAdminUser(APIView): if available_quota is not None: # None means has unlimit quota if available_quota == 0 or available_quota < quota: - error_msg = _(f"Failed to set quota: maximum quota is {available_quota} MB") + error_msg = "Failed to set quota: maximum quota is %d MB" % available_quota return api_error(status.HTTP_400_BAD_REQUEST, error_msg) seafile_api.set_user_quota(email, quota) diff --git a/seahub/institutions/views.py b/seahub/institutions/views.py index 9bb6dd9dc1..758e1f3978 100644 --- a/seahub/institutions/views.py +++ b/seahub/institutions/views.py @@ -240,7 +240,7 @@ def user_set_quota(request, email): available_quota = get_institution_available_quota(request.user.institution) if available_quota < quota: result = {} - result['error'] = _('Failed to set quota: maximum quota is %d MB' % (available_quota / 10 ** 6)) + result['error'] = 'Failed to set quota: maximum quota is %d MB' % (available_quota / 10 ** 6) return HttpResponse(json.dumps(result), status=400, content_type=content_type) seafile_api.set_user_quota(email, quota) diff --git a/seahub/organizations/api/admin/users.py b/seahub/organizations/api/admin/users.py index 052700f355..584e85c404 100644 --- a/seahub/organizations/api/admin/users.py +++ b/seahub/organizations/api/admin/users.py @@ -468,7 +468,7 @@ class OrgAdminUser(APIView): # -1 means org has unlimited quota if org_quota > 0 and quota_total_mb > org_quota_mb: - error_msg = _(u'Failed to set quota: maximum quota is %d MB' % org_quota_mb) + error_msg = 'Failed to set quota: maximum quota is %d MB' % org_quota_mb return api_error(status.HTTP_400_BAD_REQUEST, error_msg) quota_total = int(quota_total_mb) * get_file_size_unit('MB') diff --git a/seahub/utils/http.py b/seahub/utils/http.py index 7acf4e6c6c..b0abed69db 100644 --- a/seahub/utils/http.py +++ b/seahub/utils/http.py @@ -4,7 +4,6 @@ import time import json from functools import wraps from django.core.cache import cache -from django.utils.translation import gettext as _ from django.http import HttpResponse, HttpResponseBadRequest, \ HttpResponseForbidden @@ -84,7 +83,7 @@ def rate_limit(number=REQUEST_RATE_LIMIT_NUMBER, cache.set(cache_key, data, timeout=period) if data['count'] > number: - return HttpResponse(_("Too many requests"), status=429) + return HttpResponse("Too many requests", status=429) return func(request, *args, **kwargs) return wrapped diff --git a/seahub/views/sysadmin.py b/seahub/views/sysadmin.py index 1edc533c1e..8ba0a965f5 100644 --- a/seahub/views/sysadmin.py +++ b/seahub/views/sysadmin.py @@ -298,8 +298,7 @@ def user_set_quota(request, email): org_id = org[0].org_id org_quota_mb = seafserv_threaded_rpc.get_org_quota(org_id) / get_file_size_unit('MB') if space_quota_mb > org_quota_mb: - result['error'] = _('Failed to set quota: maximum quota is %d MB' % \ - org_quota_mb) + result['error'] = 'Failed to set quota: maximum quota is %d MB' % org_quota_mb return HttpResponse(json.dumps(result), status=400, content_type=content_type) else: seafile_api.set_org_user_quota(org_id, email, space_quota)