Skip to content

Commit 728132d

Browse files
committed
Add i18n
1 parent f4e3866 commit 728132d

File tree

4 files changed

+91
-6
lines changed

4 files changed

+91
-6
lines changed

makemessages.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
cd validatedfile
3+
django-admin.py makemessages -l en
4+
django-admin.py makemessages -l es
5+

validatedfile/__init__.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ def clean(self, *args, **kwargs):
2525
file.seek(0)
2626

2727
if not content_type_headers in self.content_types or not content_type_magic in self.content_types:
28-
raise forms.ValidationError(_('Filetype %s not supported.') % (content_type_magic))
28+
raise forms.ValidationError(_('Files of type %(type)s are not supported.') % {'type': content_type_magic})
2929

3030
if self.max_upload_size:
3131
if file._size > self.max_upload_size:
32-
raise forms.ValidationError(_('Please keep filesize under %s. Current filesize %s') %
33-
(filesizeformat(self.max_upload_size), filesizeformat(file._size)))
32+
raise forms.ValidationError(_('Files of size greater than %(max_size)s are not allowed. Your file is %(current_size)s') %
33+
{'max_size': filesizeformat(self.max_upload_size),
34+
'current_size': filesizeformat(file._size)})
3435

3536
return data
3637

@@ -69,7 +70,7 @@ def update_quota(self, items, attr_name):
6970
def __call__(self, file):
7071
file_size = file.size
7172
if self.quota.exceeds(file_size):
72-
raise forms.ValidationError(_('Please keep the total uploaded files under %s. With this file, the total would be %s' %
73-
(filesizeformat(self.quota.max_usage),
74-
filesizeformat(self.quota.current_usage + file_size))))
73+
raise forms.ValidationError(_('Please keep the total uploaded files under %(total_size)s. With this file, the total would be %(exceed_size)s.' %
74+
{'total_size': filesizeformat(self.quota.max_usage),
75+
'exceed_size': filesizeformat(self.quota.current_usage + file_size)}))
7576

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# SOME DESCRIPTIVE TITLE.
2+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3+
# This file is distributed under the same license as the PACKAGE package.
4+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5+
#
6+
#, fuzzy
7+
msgid ""
8+
msgstr ""
9+
"Project-Id-Version: PACKAGE VERSION\n"
10+
"Report-Msgid-Bugs-To: \n"
11+
"POT-Creation-Date: 2012-05-14 06:40-0500\n"
12+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14+
"Language-Team: LANGUAGE <[email protected]>\n"
15+
"Language: \n"
16+
"MIME-Version: 1.0\n"
17+
"Content-Type: text/plain; charset=UTF-8\n"
18+
"Content-Transfer-Encoding: 8bit\n"
19+
20+
#: __init__.py:28
21+
#, python-format
22+
msgid "Files of type %(type)s are not supported."
23+
msgstr ""
24+
25+
#: __init__.py:32
26+
#, python-format
27+
msgid ""
28+
"Files of size greater than %(max_size)s are not allowed. Your file is "
29+
"%(current_size)s"
30+
msgstr ""
31+
32+
#: __init__.py:73
33+
#, python-format
34+
msgid ""
35+
"Please keep the total uploaded files under %(total_size)s. With this file, "
36+
"the total would be %(exceed_size)s."
37+
msgstr ""
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# SOME DESCRIPTIVE TITLE.
2+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3+
# This file is distributed under the same license as the PACKAGE package.
4+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5+
#
6+
#, fuzzy
7+
msgid ""
8+
msgstr ""
9+
"Project-Id-Version: PACKAGE VERSION\n"
10+
"Report-Msgid-Bugs-To: \n"
11+
"POT-Creation-Date: 2012-05-14 06:40-0500\n"
12+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14+
"Language-Team: LANGUAGE <[email protected]>\n"
15+
"Language: \n"
16+
"MIME-Version: 1.0\n"
17+
"Content-Type: text/plain; charset=UTF-8\n"
18+
"Content-Transfer-Encoding: 8bit\n"
19+
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
20+
21+
#: __init__.py:28
22+
#, python-format
23+
msgid "Files of type %(type)s are not supported."
24+
msgstr "No se admiten archivos de tipo %(type)s."
25+
26+
#: __init__.py:32
27+
#, python-format
28+
msgid ""
29+
"Files of size greater than %(max_size)s are not allowed. Your file is "
30+
"%(current_size)s"
31+
msgstr ""
32+
"No se admiten archivos más grandes que %(max_size)s. El archivo subido ocupa "
33+
"%(current_size)s"
34+
35+
#: __init__.py:73
36+
#, python-format
37+
msgid ""
38+
"Please keep the total uploaded files under %(total_size)s. With this file, "
39+
"the total would be %(exceed_size)s."
40+
msgstr ""
41+
"Por favor, no puedes subir ficheros por un total mayor que %(total_size)s. "
42+
"Con este fichero se llegaría a %(exceed_size)s."

0 commit comments

Comments
 (0)