Browse Source

HUE-761 [fb] Backend i18n

Enrico Berti 13 years ago
parent
commit
21b66b8

+ 18 - 16
apps/filebrowser/src/filebrowser/forms.py

@@ -23,6 +23,8 @@ from filebrowser.lib import rwx
 from hadoop.fs import normpath
 from hadoop.fs import normpath
 from django.contrib.auth.models import User, Group
 from django.contrib.auth.models import User, Group
 
 
+from django.utils.translation import ugettext_lazy as _
+
 import logging
 import logging
 logger = logging.getLogger(__name__)
 logger = logging.getLogger(__name__)
 
 
@@ -36,9 +38,9 @@ class PathField(CharField):
     return normpath(CharField.clean(self, value))
     return normpath(CharField.clean(self, value))
 
 
 class EditorForm(forms.Form):
 class EditorForm(forms.Form):
-  path = PathField(label="File to edit")
-  contents = CharField(widget=Textarea, label="Contents", required=False)
-  encoding = CharField(label='Encoding', required=False)
+  path = PathField(label=_("File to edit"))
+  contents = CharField(widget=Textarea, label=_("Contents"), required=False)
+  encoding = CharField(label=_('Encoding'), required=False)
 
 
   def clean_encoding(self):
   def clean_encoding(self):
     encoding = self.cleaned_data.get('encoding', '').strip()
     encoding = self.cleaned_data.get('encoding', '').strip()
@@ -48,40 +50,40 @@ class EditorForm(forms.Form):
 
 
 class RenameForm(forms.Form):
 class RenameForm(forms.Form):
   op = "rename"
   op = "rename"
-  src_path = CharField(label="File to rename", help_text="The file to rename.")
-  dest_path = CharField(label="New name", help_text="Rename the file to:")
+  src_path = CharField(label=_("File to rename"), help_text=_("The file to rename."))
+  dest_path = CharField(label=_("New name"), help_text=_("Rename the file to:"))
 
 
 class UploadForm(forms.Form):
 class UploadForm(forms.Form):
   op = "upload"
   op = "upload"
   # The "hdfs" prefix in "hdfs_file" triggers the HDFSfileUploadHandler
   # The "hdfs" prefix in "hdfs_file" triggers the HDFSfileUploadHandler
-  hdfs_file = FileField(forms.Form, label="File to Upload")
-  dest = PathField(label="Destination Path", help_text="Filename or directory to upload to.")
+  hdfs_file = FileField(forms.Form, label=_("File to Upload"))
+  dest = PathField(label=_("Destination Path"), help_text=_("Filename or directory to upload to."))
 
 
 class RemoveForm(forms.Form):
 class RemoveForm(forms.Form):
   op = "remove"
   op = "remove"
-  path = PathField(label="File to remove")
+  path = PathField(label=_("File to remove"))
 
 
 class RmDirForm(forms.Form):
 class RmDirForm(forms.Form):
   op = "rmdir"
   op = "rmdir"
-  path = PathField(label="Directory to remove")
+  path = PathField(label=_("Directory to remove"))
 
 
 class RmTreeForm(forms.Form):
 class RmTreeForm(forms.Form):
   op = "rmtree"
   op = "rmtree"
-  path = PathField(label="Directory to remove (recursively)")
+  path = PathField(label=_("Directory to remove (recursively)"))
 
 
 class MkDirForm(forms.Form):
 class MkDirForm(forms.Form):
   op = "mkdir"
   op = "mkdir"
-  path = PathField(label="Path in which to create the directory")
-  name = PathField(label="Directory Name")
+  path = PathField(label=_("Path in which to create the directory"))
+  name = PathField(label=_("Directory Name"))
 
 
 class ChownForm(forms.Form):
 class ChownForm(forms.Form):
   op = "chown"
   op = "chown"
-  path = PathField(label="Path to change user/group ownership")
+  path = PathField(label=_("Path to change user/group ownership"))
   # These could be "ChoiceFields", listing only users and groups
   # These could be "ChoiceFields", listing only users and groups
   # that the current user has permissions for.
   # that the current user has permissions for.
-  user = CharField(label="User", min_length=1)
+  user = CharField(label=_("User"), min_length=1)
   user_other = CharField(label="OtherUser", min_length=1, required=False)
   user_other = CharField(label="OtherUser", min_length=1, required=False)
-  group = CharField(label="Group", min_length=1)
+  group = CharField(label=_("Group"), min_length=1)
   group_other = CharField(label="OtherGroup", min_length=1, required=False)
   group_other = CharField(label="OtherGroup", min_length=1, required=False)
 
 
   def __init__(self, *args, **kwargs):
   def __init__(self, *args, **kwargs):
@@ -92,7 +94,7 @@ class ChownForm(forms.Form):
 
 
 class ChmodForm(forms.Form):
 class ChmodForm(forms.Form):
   op = "chmod"
   op = "chmod"
-  path = PathField(label="Path to change permissions")
+  path = PathField(label=_("Path to change permissions"))
 
 
   # By default, BooleanField only validates when
   # By default, BooleanField only validates when
   # it's checked.  Oy.
   # it's checked.  Oy.

+ 218 - 33
apps/filebrowser/src/filebrowser/locale/django.pot

@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 msgstr ""
 "Project-Id-Version: PROJECT VERSION\n"
 "Project-Id-Version: PROJECT VERSION\n"
 "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
 "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2012-07-02 23:32+0200\n"
+"POT-Creation-Date: 2012-07-11 03:53+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,24 +17,224 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Generated-By: Babel 0.9.6\n"
 "Generated-By: Babel 0.9.6\n"
 
 
-#: src/filebrowser/templates/chmod.mako:32
-msgid "Change Permissions:"
+#: src/filebrowser/forms.py:41
+msgid "File to edit"
+msgstr ""
+
+#: src/filebrowser/forms.py:42
+msgid "Contents"
+msgstr ""
+
+#: src/filebrowser/forms.py:43
+msgid "Encoding"
+msgstr ""
+
+#: src/filebrowser/forms.py:53
+msgid "File to rename"
+msgstr ""
+
+#: src/filebrowser/forms.py:53
+msgid "The file to rename."
+msgstr ""
+
+#: src/filebrowser/forms.py:54
+#: src/filebrowser/templates/listdir_components.mako:160
+msgid "New name"
+msgstr ""
+
+#: src/filebrowser/forms.py:54
+msgid "Rename the file to:"
+msgstr ""
+
+#: src/filebrowser/forms.py:59
+msgid "File to Upload"
+msgstr ""
+
+#: src/filebrowser/forms.py:60
+msgid "Destination Path"
 msgstr ""
 msgstr ""
 
 
-#: src/filebrowser/templates/chmod.mako:40
+#: src/filebrowser/forms.py:60
+msgid "Filename or directory to upload to."
+msgstr ""
+
+#: src/filebrowser/forms.py:64
+msgid "File to remove"
+msgstr ""
+
+#: src/filebrowser/forms.py:68
+msgid "Directory to remove"
+msgstr ""
+
+#: src/filebrowser/forms.py:72
+msgid "Directory to remove (recursively)"
+msgstr ""
+
+#: src/filebrowser/forms.py:76
+msgid "Path in which to create the directory"
+msgstr ""
+
+#: src/filebrowser/forms.py:77
+#: src/filebrowser/templates/listdir_components.mako:202
+msgid "Directory Name"
+msgstr ""
+
+#: src/filebrowser/forms.py:81
+msgid "Path to change user/group ownership"
+msgstr ""
+
+#: src/filebrowser/forms.py:84 src/filebrowser/templates/chmod.mako:40
 #: src/filebrowser/templates/chown.mako:71
 #: src/filebrowser/templates/chown.mako:71
 #: src/filebrowser/templates/display.mako:77
 #: src/filebrowser/templates/display.mako:77
 #: src/filebrowser/templates/listdir_components.mako:63
 #: src/filebrowser/templates/listdir_components.mako:63
 msgid "User"
 msgid "User"
 msgstr ""
 msgstr ""
 
 
-#: src/filebrowser/templates/chmod.mako:41
+#: src/filebrowser/forms.py:86 src/filebrowser/templates/chmod.mako:41
 #: src/filebrowser/templates/chown.mako:79
 #: src/filebrowser/templates/chown.mako:79
 #: src/filebrowser/templates/display.mako:79
 #: src/filebrowser/templates/display.mako:79
 #: src/filebrowser/templates/listdir_components.mako:64
 #: src/filebrowser/templates/listdir_components.mako:64
 msgid "Group"
 msgid "Group"
 msgstr ""
 msgstr ""
 
 
+#: src/filebrowser/forms.py:97
+msgid "Path to change permissions"
+msgstr ""
+
+#: src/filebrowser/views.py:93 src/filebrowser/views.py:366
+#: src/filebrowser/views.py:394
+#, python-format
+msgid "File not found: %(path)s"
+msgstr ""
+
+#: src/filebrowser/views.py:95
+#, python-format
+msgid "'%(path)s' is not a file"
+msgstr ""
+
+#: src/filebrowser/views.py:130
+#, python-format
+msgid "Cannot access: %(path)s."
+msgstr ""
+
+#: src/filebrowser/views.py:132 src/filebrowser/views.py:674
+#, python-format
+msgid ""
+" Note: you are a Hue admin but not a HDFS superuser (which is "
+"\"%(superuser)s\")."
+msgstr ""
+
+#: src/filebrowser/views.py:150
+#, python-format
+msgid "Cannot edit a directory: %(path)s"
+msgstr ""
+
+#: src/filebrowser/views.py:154
+#, python-format
+msgid "File too big to edit: %(path)s"
+msgstr ""
+
+#: src/filebrowser/views.py:164
+#, python-format
+msgid "File is not encoded in %(encoding)s; cannot be edited: %(path)s"
+msgstr ""
+
+#: src/filebrowser/views.py:213
+#, python-format
+msgid "Saved %(path)s."
+msgstr ""
+
+#: src/filebrowser/views.py:308
+#, python-format
+msgid "Not a directory: %(path)s"
+msgstr ""
+
+#: src/filebrowser/views.py:415
+#, python-format
+msgid "Not a file: '%(path)s'"
+msgstr ""
+
+#: src/filebrowser/views.py:437
+msgid "First byte to display must be before last byte to display."
+msgstr ""
+
+#: src/filebrowser/views.py:447
+msgid "Mode must be one of 'binary' or 'text'."
+msgstr ""
+
+#: src/filebrowser/views.py:449
+msgid "Offset may not be less than zero."
+msgstr ""
+
+#: src/filebrowser/views.py:451
+msgid "Length may not be less than zero."
+msgstr ""
+
+#: src/filebrowser/views.py:453
+#, python-format
+msgid "Cannot request chunks greater than %(bytes)d bytes"
+msgstr ""
+
+#: src/filebrowser/views.py:564
+msgid "Failed to read Avro file"
+msgstr ""
+
+#: src/filebrowser/views.py:573
+msgid "We don't support offset and gzip Compression"
+msgstr ""
+
+#: src/filebrowser/views.py:580
+msgid "Failed to decompress file"
+msgstr ""
+
+#: src/filebrowser/views.py:595
+msgid "Failed to read file"
+msgstr ""
+
+#: src/filebrowser/views.py:623 src/filebrowser/views.py:625
+#: src/filebrowser/templates/display.mako:119
+#: src/filebrowser/templates/display.mako:199
+msgid "First Block"
+msgstr ""
+
+#: src/filebrowser/views.py:623 src/filebrowser/views.py:625
+#: src/filebrowser/templates/display.mako:120
+#: src/filebrowser/templates/display.mako:200
+msgid "Previous Block"
+msgstr ""
+
+#: src/filebrowser/views.py:628 src/filebrowser/views.py:631
+#: src/filebrowser/templates/display.mako:121
+#: src/filebrowser/templates/display.mako:201
+msgid "Next Block"
+msgstr ""
+
+#: src/filebrowser/views.py:628 src/filebrowser/views.py:631
+#: src/filebrowser/templates/display.mako:122
+#: src/filebrowser/templates/display.mako:202
+msgid "Last Block"
+msgstr ""
+
+#: src/filebrowser/views.py:672
+msgid "Cannot perform operation."
+msgstr ""
+
+#: src/filebrowser/views.py:818
+#, python-format
+msgid "Failed to chown uploaded file (\"%(file)s\") as superuser %(superuser)s"
+msgstr ""
+
+#: src/filebrowser/views.py:830
+#, python-format
+msgid ""
+"Failed to rename uploaded temporary file (\"%(file)s\") to \"%(name)s\": "
+"%(error)s"
+msgstr ""
+
+#: src/filebrowser/templates/chmod.mako:32
+msgid "Change Permissions:"
+msgstr ""
+
 #: src/filebrowser/templates/chmod.mako:42
 #: src/filebrowser/templates/chmod.mako:42
 msgid "Other"
 msgid "Other"
 msgstr ""
 msgstr ""
@@ -168,26 +368,6 @@ msgstr ""
 msgid "Mode"
 msgid "Mode"
 msgstr ""
 msgstr ""
 
 
-#: src/filebrowser/templates/display.mako:119
-#: src/filebrowser/templates/display.mako:199
-msgid "First Block"
-msgstr ""
-
-#: src/filebrowser/templates/display.mako:120
-#: src/filebrowser/templates/display.mako:200
-msgid "Previous Block"
-msgstr ""
-
-#: src/filebrowser/templates/display.mako:121
-#: src/filebrowser/templates/display.mako:201
-msgid "Next Block"
-msgstr ""
-
-#: src/filebrowser/templates/display.mako:122
-#: src/filebrowser/templates/display.mako:202
-msgid "Last Block"
-msgstr ""
-
 #: src/filebrowser/templates/display.mako:126
 #: src/filebrowser/templates/display.mako:126
 msgid "Viewing Bytes:"
 msgid "Viewing Bytes:"
 msgstr ""
 msgstr ""
@@ -321,15 +501,12 @@ msgstr ""
 msgid "Renaming:"
 msgid "Renaming:"
 msgstr ""
 msgstr ""
 
 
-#: src/filebrowser/templates/listdir_components.mako:160
-msgid "New name"
-msgstr ""
-
 #: src/filebrowser/templates/listdir_components.mako:179
 #: src/filebrowser/templates/listdir_components.mako:179
 msgid "Uploading to:"
 msgid "Uploading to:"
 msgstr ""
 msgstr ""
 
 
 #: src/filebrowser/templates/listdir_components.mako:185
 #: src/filebrowser/templates/listdir_components.mako:185
+#: src/filebrowser/templates/upload.mako:31
 msgid "Please enable JavaScript to use file uploader."
 msgid "Please enable JavaScript to use file uploader."
 msgstr ""
 msgstr ""
 
 
@@ -337,10 +514,6 @@ msgstr ""
 msgid "Create Directory"
 msgid "Create Directory"
 msgstr ""
 msgstr ""
 
 
-#: src/filebrowser/templates/listdir_components.mako:202
-msgid "Directory Name"
-msgstr ""
-
 #: src/filebrowser/templates/listdir_components.mako:207
 #: src/filebrowser/templates/listdir_components.mako:207
 msgid "Sorry, directory name is required."
 msgid "Sorry, directory name is required."
 msgstr ""
 msgstr ""
@@ -364,3 +537,15 @@ msgstr ""
 msgid "Move:"
 msgid "Move:"
 msgstr ""
 msgstr ""
 
 
+#: src/filebrowser/templates/upload.mako:28
+msgid "Upload Files"
+msgstr ""
+
+#: src/filebrowser/templates/upload_done.mako:22
+msgid "View uploaded file:"
+msgstr ""
+
+#: src/filebrowser/templates/upload_done.mako:23
+msgid "Go back to where you were:"
+msgstr ""
+

+ 218 - 33
apps/filebrowser/src/filebrowser/locale/en_US/LC_MESSAGES/django.po

@@ -7,7 +7,7 @@ msgid ""
 msgstr ""
 msgstr ""
 "Project-Id-Version: PROJECT VERSION\n"
 "Project-Id-Version: PROJECT VERSION\n"
 "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
 "Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
-"POT-Creation-Date: 2012-07-02 23:32+0200\n"
+"POT-Creation-Date: 2012-07-11 03:53+0200\n"
 "PO-Revision-Date: 2012-07-02 23:32+0200\n"
 "PO-Revision-Date: 2012-07-02 23:32+0200\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: en_US <LL@li.org>\n"
 "Language-Team: en_US <LL@li.org>\n"
@@ -17,24 +17,224 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Generated-By: Babel 0.9.6\n"
 "Generated-By: Babel 0.9.6\n"
 
 
-#: src/filebrowser/templates/chmod.mako:32
-msgid "Change Permissions:"
+#: src/filebrowser/forms.py:41
+msgid "File to edit"
+msgstr ""
+
+#: src/filebrowser/forms.py:42
+msgid "Contents"
+msgstr ""
+
+#: src/filebrowser/forms.py:43
+msgid "Encoding"
+msgstr ""
+
+#: src/filebrowser/forms.py:53
+msgid "File to rename"
+msgstr ""
+
+#: src/filebrowser/forms.py:53
+msgid "The file to rename."
+msgstr ""
+
+#: src/filebrowser/forms.py:54
+#: src/filebrowser/templates/listdir_components.mako:160
+msgid "New name"
+msgstr ""
+
+#: src/filebrowser/forms.py:54
+msgid "Rename the file to:"
+msgstr ""
+
+#: src/filebrowser/forms.py:59
+msgid "File to Upload"
+msgstr ""
+
+#: src/filebrowser/forms.py:60
+msgid "Destination Path"
 msgstr ""
 msgstr ""
 
 
-#: src/filebrowser/templates/chmod.mako:40
+#: src/filebrowser/forms.py:60
+msgid "Filename or directory to upload to."
+msgstr ""
+
+#: src/filebrowser/forms.py:64
+msgid "File to remove"
+msgstr ""
+
+#: src/filebrowser/forms.py:68
+msgid "Directory to remove"
+msgstr ""
+
+#: src/filebrowser/forms.py:72
+msgid "Directory to remove (recursively)"
+msgstr ""
+
+#: src/filebrowser/forms.py:76
+msgid "Path in which to create the directory"
+msgstr ""
+
+#: src/filebrowser/forms.py:77
+#: src/filebrowser/templates/listdir_components.mako:202
+msgid "Directory Name"
+msgstr ""
+
+#: src/filebrowser/forms.py:81
+msgid "Path to change user/group ownership"
+msgstr ""
+
+#: src/filebrowser/forms.py:84 src/filebrowser/templates/chmod.mako:40
 #: src/filebrowser/templates/chown.mako:71
 #: src/filebrowser/templates/chown.mako:71
 #: src/filebrowser/templates/display.mako:77
 #: src/filebrowser/templates/display.mako:77
 #: src/filebrowser/templates/listdir_components.mako:63
 #: src/filebrowser/templates/listdir_components.mako:63
 msgid "User"
 msgid "User"
 msgstr ""
 msgstr ""
 
 
-#: src/filebrowser/templates/chmod.mako:41
+#: src/filebrowser/forms.py:86 src/filebrowser/templates/chmod.mako:41
 #: src/filebrowser/templates/chown.mako:79
 #: src/filebrowser/templates/chown.mako:79
 #: src/filebrowser/templates/display.mako:79
 #: src/filebrowser/templates/display.mako:79
 #: src/filebrowser/templates/listdir_components.mako:64
 #: src/filebrowser/templates/listdir_components.mako:64
 msgid "Group"
 msgid "Group"
 msgstr ""
 msgstr ""
 
 
+#: src/filebrowser/forms.py:97
+msgid "Path to change permissions"
+msgstr ""
+
+#: src/filebrowser/views.py:93 src/filebrowser/views.py:366
+#: src/filebrowser/views.py:394
+#, python-format
+msgid "File not found: %(path)s"
+msgstr ""
+
+#: src/filebrowser/views.py:95
+#, python-format
+msgid "'%(path)s' is not a file"
+msgstr ""
+
+#: src/filebrowser/views.py:130
+#, python-format
+msgid "Cannot access: %(path)s."
+msgstr ""
+
+#: src/filebrowser/views.py:132 src/filebrowser/views.py:674
+#, python-format
+msgid ""
+" Note: you are a Hue admin but not a HDFS superuser (which is "
+"\"%(superuser)s\")."
+msgstr ""
+
+#: src/filebrowser/views.py:150
+#, python-format
+msgid "Cannot edit a directory: %(path)s"
+msgstr ""
+
+#: src/filebrowser/views.py:154
+#, python-format
+msgid "File too big to edit: %(path)s"
+msgstr ""
+
+#: src/filebrowser/views.py:164
+#, python-format
+msgid "File is not encoded in %(encoding)s; cannot be edited: %(path)s"
+msgstr ""
+
+#: src/filebrowser/views.py:213
+#, python-format
+msgid "Saved %(path)s."
+msgstr ""
+
+#: src/filebrowser/views.py:308
+#, python-format
+msgid "Not a directory: %(path)s"
+msgstr ""
+
+#: src/filebrowser/views.py:415
+#, python-format
+msgid "Not a file: '%(path)s'"
+msgstr ""
+
+#: src/filebrowser/views.py:437
+msgid "First byte to display must be before last byte to display."
+msgstr ""
+
+#: src/filebrowser/views.py:447
+msgid "Mode must be one of 'binary' or 'text'."
+msgstr ""
+
+#: src/filebrowser/views.py:449
+msgid "Offset may not be less than zero."
+msgstr ""
+
+#: src/filebrowser/views.py:451
+msgid "Length may not be less than zero."
+msgstr ""
+
+#: src/filebrowser/views.py:453
+#, python-format
+msgid "Cannot request chunks greater than %(bytes)d bytes"
+msgstr ""
+
+#: src/filebrowser/views.py:564
+msgid "Failed to read Avro file"
+msgstr ""
+
+#: src/filebrowser/views.py:573
+msgid "We don't support offset and gzip Compression"
+msgstr ""
+
+#: src/filebrowser/views.py:580
+msgid "Failed to decompress file"
+msgstr ""
+
+#: src/filebrowser/views.py:595
+msgid "Failed to read file"
+msgstr ""
+
+#: src/filebrowser/views.py:623 src/filebrowser/views.py:625
+#: src/filebrowser/templates/display.mako:119
+#: src/filebrowser/templates/display.mako:199
+msgid "First Block"
+msgstr ""
+
+#: src/filebrowser/views.py:623 src/filebrowser/views.py:625
+#: src/filebrowser/templates/display.mako:120
+#: src/filebrowser/templates/display.mako:200
+msgid "Previous Block"
+msgstr ""
+
+#: src/filebrowser/views.py:628 src/filebrowser/views.py:631
+#: src/filebrowser/templates/display.mako:121
+#: src/filebrowser/templates/display.mako:201
+msgid "Next Block"
+msgstr ""
+
+#: src/filebrowser/views.py:628 src/filebrowser/views.py:631
+#: src/filebrowser/templates/display.mako:122
+#: src/filebrowser/templates/display.mako:202
+msgid "Last Block"
+msgstr ""
+
+#: src/filebrowser/views.py:672
+msgid "Cannot perform operation."
+msgstr ""
+
+#: src/filebrowser/views.py:818
+#, python-format
+msgid "Failed to chown uploaded file (\"%(file)s\") as superuser %(superuser)s"
+msgstr ""
+
+#: src/filebrowser/views.py:830
+#, python-format
+msgid ""
+"Failed to rename uploaded temporary file (\"%(file)s\") to \"%(name)s\": "
+"%(error)s"
+msgstr ""
+
+#: src/filebrowser/templates/chmod.mako:32
+msgid "Change Permissions:"
+msgstr ""
+
 #: src/filebrowser/templates/chmod.mako:42
 #: src/filebrowser/templates/chmod.mako:42
 msgid "Other"
 msgid "Other"
 msgstr ""
 msgstr ""
@@ -168,26 +368,6 @@ msgstr ""
 msgid "Mode"
 msgid "Mode"
 msgstr ""
 msgstr ""
 
 
-#: src/filebrowser/templates/display.mako:119
-#: src/filebrowser/templates/display.mako:199
-msgid "First Block"
-msgstr ""
-
-#: src/filebrowser/templates/display.mako:120
-#: src/filebrowser/templates/display.mako:200
-msgid "Previous Block"
-msgstr ""
-
-#: src/filebrowser/templates/display.mako:121
-#: src/filebrowser/templates/display.mako:201
-msgid "Next Block"
-msgstr ""
-
-#: src/filebrowser/templates/display.mako:122
-#: src/filebrowser/templates/display.mako:202
-msgid "Last Block"
-msgstr ""
-
 #: src/filebrowser/templates/display.mako:126
 #: src/filebrowser/templates/display.mako:126
 msgid "Viewing Bytes:"
 msgid "Viewing Bytes:"
 msgstr ""
 msgstr ""
@@ -321,15 +501,12 @@ msgstr ""
 msgid "Renaming:"
 msgid "Renaming:"
 msgstr ""
 msgstr ""
 
 
-#: src/filebrowser/templates/listdir_components.mako:160
-msgid "New name"
-msgstr ""
-
 #: src/filebrowser/templates/listdir_components.mako:179
 #: src/filebrowser/templates/listdir_components.mako:179
 msgid "Uploading to:"
 msgid "Uploading to:"
 msgstr ""
 msgstr ""
 
 
 #: src/filebrowser/templates/listdir_components.mako:185
 #: src/filebrowser/templates/listdir_components.mako:185
+#: src/filebrowser/templates/upload.mako:31
 msgid "Please enable JavaScript to use file uploader."
 msgid "Please enable JavaScript to use file uploader."
 msgstr ""
 msgstr ""
 
 
@@ -337,10 +514,6 @@ msgstr ""
 msgid "Create Directory"
 msgid "Create Directory"
 msgstr ""
 msgstr ""
 
 
-#: src/filebrowser/templates/listdir_components.mako:202
-msgid "Directory Name"
-msgstr ""
-
 #: src/filebrowser/templates/listdir_components.mako:207
 #: src/filebrowser/templates/listdir_components.mako:207
 msgid "Sorry, directory name is required."
 msgid "Sorry, directory name is required."
 msgstr ""
 msgstr ""
@@ -364,3 +537,15 @@ msgstr ""
 msgid "Move:"
 msgid "Move:"
 msgstr ""
 msgstr ""
 
 
+#: src/filebrowser/templates/upload.mako:28
+msgid "Upload Files"
+msgstr ""
+
+#: src/filebrowser/templates/upload_done.mako:22
+msgid "View uploaded file:"
+msgstr ""
+
+#: src/filebrowser/templates/upload_done.mako:23
+msgid "Go back to where you were:"
+msgstr ""
+

+ 34 - 32
apps/filebrowser/src/filebrowser/views.py

@@ -47,6 +47,8 @@ from filebrowser.forms import RenameForm, UploadForm, MkDirForm, RmDirForm, RmTr
 from hadoop.fs.hadoopfs import Hdfs
 from hadoop.fs.hadoopfs import Hdfs
 from hadoop.fs.exceptions import WebHdfsException
 from hadoop.fs.exceptions import WebHdfsException
 
 
+from django.utils.translation import ugettext as _
+
 
 
 DEFAULT_CHUNK_SIZE_BYTES = 1024 * 4 # 4KB
 DEFAULT_CHUNK_SIZE_BYTES = 1024 * 4 # 4KB
 MAX_CHUNK_SIZE_BYTES = 1024 * 1024 # 1MB
 MAX_CHUNK_SIZE_BYTES = 1024 * 1024 # 1MB
@@ -88,9 +90,9 @@ def download(request, path):
     This is inspired by django.views.static.serve.
     This is inspired by django.views.static.serve.
     """
     """
     if not request.fs.exists(path):
     if not request.fs.exists(path):
-        raise Http404("File not found: %s" % escape(path))
+        raise Http404(_("File not found: %(path)s") % {'path': escape(path)})
     if not request.fs.isfile(path):
     if not request.fs.isfile(path):
-        raise PopupException("'%s' is not a file" % (path,))
+        raise PopupException(_("'%(path)s' is not a file") % {'path': path})
 
 
     mimetype = mimetypes.guess_type(path)[0] or 'application/octet-stream'
     mimetype = mimetypes.guess_type(path)[0] or 'application/octet-stream'
     stats = request.fs.stats(path)
     stats = request.fs.stats(path)
@@ -125,9 +127,9 @@ def view(request, path):
         else:
         else:
             return display(request, path)
             return display(request, path)
     except (IOError, WebHdfsException), e:
     except (IOError, WebHdfsException), e:
-        msg = "Cannot access: %s." % escape(path)
+        msg = _("Cannot access: %(path)s.") % {'path': escape(path)}
         if request.user.is_superuser and not request.user == request.fs.superuser:
         if request.user.is_superuser and not request.user == request.fs.superuser:
-            msg += ' Note: you are a Hue admin but not a HDFS superuser (which is "%s").' % (request.fs.superuser,)
+            msg += _(' Note: you are a Hue admin but not a HDFS superuser (which is "%(superuser)s").') % {'superuser': request.fs.superuser}
         raise PopupException(msg , detail=e)
         raise PopupException(msg , detail=e)
 
 
 
 
@@ -145,11 +147,11 @@ def edit(request, path, form=None):
 
 
     # Can't edit a directory
     # Can't edit a directory
     if stats and stats['mode'] & stat_module.S_IFDIR:
     if stats and stats['mode'] & stat_module.S_IFDIR:
-        raise PopupException("Cannot edit a directory: %s" % (path,))
+        raise PopupException(_("Cannot edit a directory: %(path)s") % {'path': path})
 
 
     # Maximum size of edit
     # Maximum size of edit
     if stats and stats['size'] > MAX_FILEEDITOR_SIZE:
     if stats and stats['size'] > MAX_FILEEDITOR_SIZE:
-        raise PopupException("File too big to edit: %s" % (path,))
+        raise PopupException(_("File too big to edit: %(path)s") % {'path': path})
 
 
     if not form:
     if not form:
         encoding = request.REQUEST.get('encoding') or i18n.get_site_encoding()
         encoding = request.REQUEST.get('encoding') or i18n.get_site_encoding()
@@ -159,7 +161,7 @@ def edit(request, path, form=None):
                 try:
                 try:
                     current_contents = unicode(f.read(), encoding)
                     current_contents = unicode(f.read(), encoding)
                 except UnicodeDecodeError:
                 except UnicodeDecodeError:
-                    raise PopupException("File is not encoded in %s; cannot be edited: %s" % (encoding, path))
+                    raise PopupException(_("File is not encoded in %(encoding)s; cannot be edited: %(path)s") % {'encoding': encoding, 'path': path})
             finally:
             finally:
                 f.close()
                 f.close()
         else:
         else:
@@ -208,7 +210,7 @@ def save_file(request):
                          form.cleaned_data['contents'],
                          form.cleaned_data['contents'],
                          form.cleaned_data['encoding'])
                          form.cleaned_data['encoding'])
 
 
-    request.flash.put('Saved %s.' % os.path.basename(path))
+    request.flash.put(_('Saved %(path)s.') % {'path': os.path.basename(path)})
     """ Changing path to reflect the request path of the JFrame that will actually be returned."""
     """ Changing path to reflect the request path of the JFrame that will actually be returned."""
     request.path = urlresolvers.reverse("filebrowser.views.edit", kwargs=dict(path=path))
     request.path = urlresolvers.reverse("filebrowser.views.edit", kwargs=dict(path=path))
     return edit(request, path, form)
     return edit(request, path, form)
@@ -303,7 +305,7 @@ def listdir(request, path, chooser):
     Intended to be called via view().
     Intended to be called via view().
     """
     """
     if not request.fs.isdir(path):
     if not request.fs.isdir(path):
-        raise PopupException("Not a directory: %s" % (path,))
+        raise PopupException(_("Not a directory: %(path)s") % {'path': path})
 
 
     file_filter = request.REQUEST.get('file_filter', 'any')
     file_filter = request.REQUEST.get('file_filter', 'any')
 
 
@@ -361,7 +363,7 @@ def chooser(request, path):
     elif request.fs.isfile(path):
     elif request.fs.isfile(path):
         return display(request, path)
         return display(request, path)
     else:
     else:
-        raise Http404("File not found: %s" % escape(path))
+        raise Http404(_("File not found: %(path)s") % {'path': escape(path)})
 
 
 
 
 def _massage_stats(request, stats):
 def _massage_stats(request, stats):
@@ -389,7 +391,7 @@ def stat(request, path):
     an HTML view).
     an HTML view).
     """
     """
     if not request.fs.exists(path):
     if not request.fs.exists(path):
-        raise Http404("File not found: %s" % escape(path))
+        raise Http404(_("File not found: %(path)s") % {'path': escape(path)})
     stats = request.fs.stats(path)
     stats = request.fs.stats(path)
     return render_json(_massage_stats(request, stats))
     return render_json(_massage_stats(request, stats))
 
 
@@ -410,7 +412,7 @@ def display(request, path):
     There exists a python-magic package to interface with libmagic.
     There exists a python-magic package to interface with libmagic.
     """
     """
     if not request.fs.isfile(path):
     if not request.fs.isfile(path):
-        raise PopupException("Not a file: '%s'" % (path,))
+        raise PopupException(_("Not a file: '%(path)s'") % {'path': path})
 
 
     stats = request.fs.stats(path)
     stats = request.fs.stats(path)
     encoding = request.GET.get('encoding') or i18n.get_site_encoding()
     encoding = request.GET.get('encoding') or i18n.get_site_encoding()
@@ -432,7 +434,7 @@ def display(request, path):
         offset = begin
         offset = begin
         length = end - begin
         length = end - begin
         if begin >= end:
         if begin >= end:
-            raise PopupException("First byte to display must be before last byte to display.")
+            raise PopupException(_("First byte to display must be before last byte to display."))
     else:
     else:
         length = int(request.GET.get("length", DEFAULT_CHUNK_SIZE_BYTES))
         length = int(request.GET.get("length", DEFAULT_CHUNK_SIZE_BYTES))
         # Display first block by default.
         # Display first block by default.
@@ -442,13 +444,13 @@ def display(request, path):
     compression = request.GET.get("compression")
     compression = request.GET.get("compression")
 
 
     if mode and mode not in ["binary", "text"]:
     if mode and mode not in ["binary", "text"]:
-        raise PopupException("Mode must be one of 'binary' or 'text'.")
+        raise PopupException(_("Mode must be one of 'binary' or 'text'."))
     if offset < 0:
     if offset < 0:
-        raise PopupException("Offset may not be less than zero.")
+        raise PopupException(_("Offset may not be less than zero."))
     if length < 0:
     if length < 0:
-        raise PopupException("Length may not be less than zero.")
+        raise PopupException(_("Length may not be less than zero."))
     if length > MAX_CHUNK_SIZE_BYTES:
     if length > MAX_CHUNK_SIZE_BYTES:
-        raise PopupException("Cannot request chunks greater than %d bytes" % MAX_CHUNK_SIZE_BYTES)
+        raise PopupException(_("Cannot request chunks greater than %(bytes)d bytes") % {'bytes': MAX_CHUNK_SIZE_BYTES})
 
 
     # Do not decompress in binary mode.
     # Do not decompress in binary mode.
     if mode == 'binary':
     if mode == 'binary':
@@ -559,7 +561,7 @@ def _read_avro(fs, path, offset, length):
             contents = "".join(contents_list)
             contents = "".join(contents_list)
         except:
         except:
             logging.warn("Could not read avro file at %s" % path, exc_info=True)
             logging.warn("Could not read avro file at %s" % path, exc_info=True)
-            raise PopupException("Failed to read Avro file")
+            raise PopupException(_("Failed to read Avro file"))
     finally:
     finally:
         fhandle.close()
         fhandle.close()
     return contents
     return contents
@@ -568,14 +570,14 @@ def _read_avro(fs, path, offset, length):
 def _read_gzip(fs, path, offset, length):
 def _read_gzip(fs, path, offset, length):
     contents = ''
     contents = ''
     if offset and offset != 0:
     if offset and offset != 0:
-        raise PopupException("We don't support offset and gzip Compression")
+        raise PopupException(_("We don't support offset and gzip Compression"))
     try:
     try:
         fhandle = fs.open(path)
         fhandle = fs.open(path)
         try:
         try:
             contents = GzipFile('', 'r', 0, StringIO(fhandle.read())).read(length)
             contents = GzipFile('', 'r', 0, StringIO(fhandle.read())).read(length)
         except:
         except:
             logging.warn("Could not decompress file at %s" % path, exc_info=True)
             logging.warn("Could not decompress file at %s" % path, exc_info=True)
-            raise PopupException("Failed to decompress file")
+            raise PopupException(_("Failed to decompress file"))
     finally:
     finally:
         fhandle.close()
         fhandle.close()
     return contents
     return contents
@@ -590,7 +592,7 @@ def _read_simple(fs, path, offset, length):
             contents = fhandle.read(length)
             contents = fhandle.read(length)
         except:
         except:
             logging.warn("Could not read file at %s" % path, exc_info=True)
             logging.warn("Could not read file at %s" % path, exc_info=True)
-            raise PopupException("Failed to read file")
+            raise PopupException(_("Failed to read file"))
     finally:
     finally:
         fhandle.close()
         fhandle.close()
     return contents
     return contents
@@ -618,15 +620,15 @@ def _calculate_navigation(offset, length, size):
     language is too limiting.
     language is too limiting.
     """
     """
     if offset == 0:
     if offset == 0:
-        first, prev = (-1, None, "First Block"), (-1, None, "Previous Block")
+        first, prev = (-1, None, _("First Block")), (-1, None, _("Previous Block"))
     else:
     else:
-        first, prev = (0, length, "First Block"), (max(0, offset - length), length, "Previous Block")
+        first, prev = (0, length, _("First Block")), (max(0, offset - length), length, _("Previous Block"))
 
 
     if offset + length >= size:
     if offset + length >= size:
-        next, last = (-1, None, "Next Block"), (-1, None, "Last Block")
+        next, last = (-1, None, _("Next Block")), (-1, None, _("Last Block"))
     else:
     else:
         # 1-off Reasoning: if length is the same as size, you want to start at 0.
         # 1-off Reasoning: if length is the same as size, you want to start at 0.
-        next, last = (offset + length, length, "Next Block"), (max(0, size - length), length, "Last Block")
+        next, last = (offset + length, length, _("Next Block")), (max(0, size - length), length, _("Last Block"))
 
 
     return first, prev, next, last
     return first, prev, next, last
 
 
@@ -667,10 +669,10 @@ def generic_op(form_class, request, op, parameter_names, piggyback=None, templat
             try:
             try:
                 op(*args)
                 op(*args)
             except (IOError, WebHdfsException), e:
             except (IOError, WebHdfsException), e:
-                msg = "Cannot perform operation."
+                msg = _("Cannot perform operation.")
                 if request.user.is_superuser and not request.user == request.fs.superuser:
                 if request.user.is_superuser and not request.user == request.fs.superuser:
-                    msg += ' Note: you are a Hue admin but not a HDFS superuser (which is "%s").' \
-                           % (request.fs.superuser,)
+                    msg += _(' Note: you are a Hue admin but not a HDFS superuser (which is "%(superuser)s").') \
+                           % {'superuser': request.fs.superuser}
                 raise PopupException(msg, detail=e)
                 raise PopupException(msg, detail=e)
             if next:
             if next:
                 logging.debug("Next: %s" % next)
                 logging.debug("Next: %s" % next)
@@ -813,8 +815,8 @@ def _upload(request):
                     request.fs.chmod(tmp_file, 0644)
                     request.fs.chmod(tmp_file, 0644)
                     request.fs.chown(tmp_file, username, username)
                     request.fs.chown(tmp_file, username, username)
                 except IOError, ex:
                 except IOError, ex:
-                    msg = 'Failed to chown uploaded file ("%s") as superuser %s' %\
-                          (tmp_file, request.fs.superuser)
+                    msg = _('Failed to chown uploaded file ("%(file)s") as superuser %(superuser)s') %\
+                          {'file': tmp_file, 'superuser': request.fs.superuser}
                     logger.exception(msg)
                     logger.exception(msg)
                     raise PopupException(msg, detail=str(ex))
                     raise PopupException(msg, detail=str(ex))
             finally:
             finally:
@@ -825,8 +827,8 @@ def _upload(request):
                 request.fs.rename(uploaded_file.get_temp_path(), dest)
                 request.fs.rename(uploaded_file.get_temp_path(), dest)
             except IOError, ex:
             except IOError, ex:
                 raise PopupException(
                 raise PopupException(
-                    'Failed to rename uploaded temporary file ("%s") to "%s": %s' %
-                    (tmp_file, dest, ex))
+                    _('Failed to rename uploaded temporary file ("%(file)s") to "%(name)s": %(error)s') %
+                    {'file': tmp_file, 'name': dest, 'error': ex})
 
 
             dest_stats = request.fs.stats(dest)
             dest_stats = request.fs.stats(dest)
             return render('upload_done.mako', request, {
             return render('upload_done.mako', request, {