Răsfoiți Sursa

HUE-761 [fb] Backend i18n

Enrico Berti 13 ani în urmă
părinte
comite
21b66b8

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

@@ -23,6 +23,8 @@ from filebrowser.lib import rwx
 from hadoop.fs import normpath
 from django.contrib.auth.models import User, Group
 
+from django.utils.translation import ugettext_lazy as _
+
 import logging
 logger = logging.getLogger(__name__)
 
@@ -36,9 +38,9 @@ class PathField(CharField):
     return normpath(CharField.clean(self, value))
 
 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):
     encoding = self.cleaned_data.get('encoding', '').strip()
@@ -48,40 +50,40 @@ class EditorForm(forms.Form):
 
 class RenameForm(forms.Form):
   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):
   op = "upload"
   # 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):
   op = "remove"
-  path = PathField(label="File to remove")
+  path = PathField(label=_("File to remove"))
 
 class RmDirForm(forms.Form):
   op = "rmdir"
-  path = PathField(label="Directory to remove")
+  path = PathField(label=_("Directory to remove"))
 
 class RmTreeForm(forms.Form):
   op = "rmtree"
-  path = PathField(label="Directory to remove (recursively)")
+  path = PathField(label=_("Directory to remove (recursively)"))
 
 class MkDirForm(forms.Form):
   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):
   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
   # 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)
-  group = CharField(label="Group", min_length=1)
+  group = CharField(label=_("Group"), min_length=1)
   group_other = CharField(label="OtherGroup", min_length=1, required=False)
 
   def __init__(self, *args, **kwargs):
@@ -92,7 +94,7 @@ class ChownForm(forms.Form):
 
 class ChmodForm(forms.Form):
   op = "chmod"
-  path = PathField(label="Path to change permissions")
+  path = PathField(label=_("Path to change permissions"))
 
   # By default, BooleanField only validates when
   # it's checked.  Oy.

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

@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PROJECT VERSION\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"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,24 +17,224 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\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 ""
 
-#: 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/display.mako:77
 #: src/filebrowser/templates/listdir_components.mako:63
 msgid "User"
 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/display.mako:79
 #: src/filebrowser/templates/listdir_components.mako:64
 msgid "Group"
 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
 msgid "Other"
 msgstr ""
@@ -168,26 +368,6 @@ msgstr ""
 msgid "Mode"
 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
 msgid "Viewing Bytes:"
 msgstr ""
@@ -321,15 +501,12 @@ msgstr ""
 msgid "Renaming:"
 msgstr ""
 
-#: src/filebrowser/templates/listdir_components.mako:160
-msgid "New name"
-msgstr ""
-
 #: src/filebrowser/templates/listdir_components.mako:179
 msgid "Uploading to:"
 msgstr ""
 
 #: src/filebrowser/templates/listdir_components.mako:185
+#: src/filebrowser/templates/upload.mako:31
 msgid "Please enable JavaScript to use file uploader."
 msgstr ""
 
@@ -337,10 +514,6 @@ msgstr ""
 msgid "Create Directory"
 msgstr ""
 
-#: src/filebrowser/templates/listdir_components.mako:202
-msgid "Directory Name"
-msgstr ""
-
 #: src/filebrowser/templates/listdir_components.mako:207
 msgid "Sorry, directory name is required."
 msgstr ""
@@ -364,3 +537,15 @@ msgstr ""
 msgid "Move:"
 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 ""
 "Project-Id-Version: PROJECT VERSION\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"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: en_US <LL@li.org>\n"
@@ -17,24 +17,224 @@ msgstr ""
 "Content-Transfer-Encoding: 8bit\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 ""
 
-#: 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/display.mako:77
 #: src/filebrowser/templates/listdir_components.mako:63
 msgid "User"
 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/display.mako:79
 #: src/filebrowser/templates/listdir_components.mako:64
 msgid "Group"
 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
 msgid "Other"
 msgstr ""
@@ -168,26 +368,6 @@ msgstr ""
 msgid "Mode"
 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
 msgid "Viewing Bytes:"
 msgstr ""
@@ -321,15 +501,12 @@ msgstr ""
 msgid "Renaming:"
 msgstr ""
 
-#: src/filebrowser/templates/listdir_components.mako:160
-msgid "New name"
-msgstr ""
-
 #: src/filebrowser/templates/listdir_components.mako:179
 msgid "Uploading to:"
 msgstr ""
 
 #: src/filebrowser/templates/listdir_components.mako:185
+#: src/filebrowser/templates/upload.mako:31
 msgid "Please enable JavaScript to use file uploader."
 msgstr ""
 
@@ -337,10 +514,6 @@ msgstr ""
 msgid "Create Directory"
 msgstr ""
 
-#: src/filebrowser/templates/listdir_components.mako:202
-msgid "Directory Name"
-msgstr ""
-
 #: src/filebrowser/templates/listdir_components.mako:207
 msgid "Sorry, directory name is required."
 msgstr ""
@@ -364,3 +537,15 @@ msgstr ""
 msgid "Move:"
 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.exceptions import WebHdfsException
 
+from django.utils.translation import ugettext as _
+
 
 DEFAULT_CHUNK_SIZE_BYTES = 1024 * 4 # 4KB
 MAX_CHUNK_SIZE_BYTES = 1024 * 1024 # 1MB
@@ -88,9 +90,9 @@ def download(request, path):
     This is inspired by django.views.static.serve.
     """
     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):
-        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'
     stats = request.fs.stats(path)
@@ -125,9 +127,9 @@ def view(request, path):
         else:
             return display(request, path)
     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:
-            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)
 
 
@@ -145,11 +147,11 @@ def edit(request, path, form=None):
 
     # Can't edit a directory
     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
     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:
         encoding = request.REQUEST.get('encoding') or i18n.get_site_encoding()
@@ -159,7 +161,7 @@ def edit(request, path, form=None):
                 try:
                     current_contents = unicode(f.read(), encoding)
                 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:
                 f.close()
         else:
@@ -208,7 +210,7 @@ def save_file(request):
                          form.cleaned_data['contents'],
                          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."""
     request.path = urlresolvers.reverse("filebrowser.views.edit", kwargs=dict(path=path))
     return edit(request, path, form)
@@ -303,7 +305,7 @@ def listdir(request, path, chooser):
     Intended to be called via view().
     """
     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')
 
@@ -361,7 +363,7 @@ def chooser(request, path):
     elif request.fs.isfile(path):
         return display(request, path)
     else:
-        raise Http404("File not found: %s" % escape(path))
+        raise Http404(_("File not found: %(path)s") % {'path': escape(path)})
 
 
 def _massage_stats(request, stats):
@@ -389,7 +391,7 @@ def stat(request, path):
     an HTML view).
     """
     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)
     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.
     """
     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)
     encoding = request.GET.get('encoding') or i18n.get_site_encoding()
@@ -432,7 +434,7 @@ def display(request, path):
         offset = begin
         length = end - begin
         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:
         length = int(request.GET.get("length", DEFAULT_CHUNK_SIZE_BYTES))
         # Display first block by default.
@@ -442,13 +444,13 @@ def display(request, path):
     compression = request.GET.get("compression")
 
     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:
-        raise PopupException("Offset may not be less than zero.")
+        raise PopupException(_("Offset may not be less than zero."))
     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:
-        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.
     if mode == 'binary':
@@ -559,7 +561,7 @@ def _read_avro(fs, path, offset, length):
             contents = "".join(contents_list)
         except:
             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:
         fhandle.close()
     return contents
@@ -568,14 +570,14 @@ def _read_avro(fs, path, offset, length):
 def _read_gzip(fs, path, offset, length):
     contents = ''
     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:
         fhandle = fs.open(path)
         try:
             contents = GzipFile('', 'r', 0, StringIO(fhandle.read())).read(length)
         except:
             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:
         fhandle.close()
     return contents
@@ -590,7 +592,7 @@ def _read_simple(fs, path, offset, length):
             contents = fhandle.read(length)
         except:
             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:
         fhandle.close()
     return contents
@@ -618,15 +620,15 @@ def _calculate_navigation(offset, length, size):
     language is too limiting.
     """
     if offset == 0:
-        first, prev = (-1, None, "First Block"), (-1, None, "Previous Block")
+        first, prev = (-1, None, _("First Block")), (-1, None, _("Previous Block"))
     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:
-        next, last = (-1, None, "Next Block"), (-1, None, "Last Block")
+        next, last = (-1, None, _("Next Block")), (-1, None, _("Last Block"))
     else:
         # 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
 
@@ -667,10 +669,10 @@ def generic_op(form_class, request, op, parameter_names, piggyback=None, templat
             try:
                 op(*args)
             except (IOError, WebHdfsException), e:
-                msg = "Cannot perform operation."
+                msg = _("Cannot perform operation.")
                 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)
             if next:
                 logging.debug("Next: %s" % next)
@@ -813,8 +815,8 @@ def _upload(request):
                     request.fs.chmod(tmp_file, 0644)
                     request.fs.chown(tmp_file, username, username)
                 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)
                     raise PopupException(msg, detail=str(ex))
             finally:
@@ -825,8 +827,8 @@ def _upload(request):
                 request.fs.rename(uploaded_file.get_temp_path(), dest)
             except IOError, ex:
                 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)
             return render('upload_done.mako', request, {