浏览代码

HUE-765 [admin] Backend i18n

Romain: fix some missing lazy translation, conflicts and jobbrowser and make tests pass
Enrico Berti 13 年之前
父节点
当前提交
89018c38ac

+ 6 - 4
apps/jobbrowser/src/jobbrowser/models.py

@@ -27,6 +27,8 @@ import lxml.html
 import re
 import urllib2
 
+from django.utils.translation import ugettext as _
+
 import hadoop.api.jobtracker.ttypes as ttypes
 
 from django.utils.translation import ugettext as _
@@ -76,7 +78,7 @@ class Job(JobLinkage):
     """
     thriftjob = jt.get_job(jt.thriftjobid_from_string(jobid))
     if not thriftjob:
-      raise Exception(_("Could not find job with id %(id)s") % dict(id=jobid))
+      raise Exception(_("could not find job with id %(jobid)s") % {'jobid': jobid})
     return Job(jt, thriftjob)
 
   @staticmethod
@@ -399,7 +401,7 @@ class TaskAttempt(object):
         for t in all_trackers.trackers:
           LOGGER.debug("Available tracker: %s" % (t.trackerName,))
       raise ttypes.TaskTrackerNotFoundException(
-                          _("Cannot lookup TaskTracker '%(id)s'") % dict(id=self.taskTrackerId))
+                          _("Cannot lookup TaskTracker %(id)s") % {'id': self.taskTrackerId})
 
   def get_task_log(self):
     """
@@ -423,14 +425,14 @@ class TaskAttempt(object):
     try:
       data = urllib2.urlopen(url)
     except urllib2.URLError:
-      raise urllib2.URLError(_("Cannot retrieve logs from TaskTracker '%(id)s'") % dict(id=self.taskTrackerId))
+      raise urllib2.URLError(_("Cannot retrieve logs from TaskTracker %(id)s") % {'id': self.taskTrackerId})
 
     et = lxml.html.parse(data)
     log_sections = et.findall('body/pre')
     if len(log_sections) != 3:
       LOGGER.warn('Error parsing task attempt log for %s at "%s". Found %d (not 3) log sections' %
                   (self.attemptId, url, len(log_sections)))
-      err = _("Hue encountered an error while retrieving logs from '%(url)s'") % dict(url=url)
+      err = _("Hue encountered an error while retrieving logs from '%s'") % (url,)
       return (err, err, err)
     return [ section.text for section in log_sections ]
 

+ 476 - 0
apps/useradmin/src/useradmin/locale/django.pot

@@ -0,0 +1,476 @@
+# Translations template for PROJECT.
+# Copyright (C) 2012 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2012-07-10 12:05+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"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.6\n"
+
+#: src/useradmin/models.py:124
+#, python-format
+msgid "You do not have permissions to %(description)s."
+msgstr ""
+
+#: src/useradmin/models.py:230
+msgid "launch this application"
+msgstr ""
+
+#: src/useradmin/views.py:58
+msgid "You must be a superuser to delete users."
+msgstr ""
+
+#: src/useradmin/views.py:65
+msgid "You cannot remove yourself."
+msgstr ""
+
+#: src/useradmin/views.py:76
+msgid "User not found."
+msgstr ""
+
+#: src/useradmin/views.py:80
+msgid "Delete user?"
+msgstr ""
+
+#: src/useradmin/views.py:84
+msgid "You must be a superuser to delete groups."
+msgstr ""
+
+#: src/useradmin/views.py:96
+msgid "The default user group may not be deleted."
+msgstr ""
+
+#: src/useradmin/views.py:104
+msgid "Group not found."
+msgstr ""
+
+#: src/useradmin/views.py:108
+msgid "Delete group?"
+msgstr ""
+
+#: src/useradmin/views.py:116 src/useradmin/views.py:289
+#: src/useradmin/templates/list_users.mako:44
+msgid "Username"
+msgstr ""
+
+#: src/useradmin/views.py:119 src/useradmin/views.py:292
+msgid "Required. 30 characters or fewer. No whitespaces or colons."
+msgstr ""
+
+#: src/useradmin/views.py:120 src/useradmin/views.py:293
+#: src/useradmin/views.py:349
+msgid "Whitespaces and ':' not allowed"
+msgstr ""
+
+#: src/useradmin/views.py:121
+msgid "Password"
+msgstr ""
+
+#: src/useradmin/views.py:122
+msgid "Password confirmation"
+msgstr ""
+
+#: src/useradmin/views.py:131
+msgid "Passwords do not match."
+msgstr ""
+
+#: src/useradmin/views.py:137
+msgid "You must specify a password when creating a new user."
+msgstr ""
+
+#: src/useradmin/views.py:179
+msgid "You must be a superuser to add or edit another user."
+msgstr ""
+
+#: src/useradmin/views.py:203
+msgid "You cannot make yourself inactive."
+msgstr ""
+
+#: src/useradmin/views.py:215
+msgid "You cannot make yourself a superuser."
+msgstr ""
+
+#: src/useradmin/views.py:239
+msgid "You must be a superuser to add or edit a group."
+msgstr ""
+
+#: src/useradmin/views.py:271
+msgid "You must be a superuser to change permissions."
+msgstr ""
+
+#: src/useradmin/views.py:294 src/useradmin/views.py:350
+msgid "Distinguished name"
+msgstr ""
+
+#: src/useradmin/views.py:295
+#: src/useradmin/management/commands/import_ldap_group.py:35
+#: src/useradmin/management/commands/import_ldap_user.py:33
+msgid "Whether or not the user should be imported by distinguished name"
+msgstr ""
+
+#: src/useradmin/views.py:307
+#, python-format
+msgid "Too long: 30 characters or fewer and not %(username)s"
+msgstr ""
+
+#: src/useradmin/views.py:324
+msgid "You must be a superuser to add another user."
+msgstr ""
+
+#: src/useradmin/views.py:335
+#, python-format
+msgid "Could not get LDAP details for user %(username)s"
+msgstr ""
+
+#: src/useradmin/views.py:347
+msgid ""
+"Required. 30 characters or fewer. May only contain letters, numbers, "
+"hypens or underscores."
+msgstr ""
+
+#: src/useradmin/views.py:351
+msgid "Whether or not the group should be imported by distinguished name"
+msgstr ""
+
+#: src/useradmin/views.py:355
+msgid "Import new members"
+msgstr ""
+
+#: src/useradmin/views.py:356
+msgid "Import unimported or new users from the group"
+msgstr ""
+
+#: src/useradmin/views.py:367
+#, python-format
+msgid "Too long: 30 characters or fewer and not %(name)s"
+msgstr ""
+
+#: src/useradmin/views.py:385
+msgid "You must be a superuser to add another group."
+msgstr ""
+
+#: src/useradmin/views.py:397
+#, python-format
+msgid "Could not get LDAP details for group %(groupname)s"
+msgstr ""
+
+#: src/useradmin/views.py:413
+msgid "You must be a superuser to sync the LDAP users/groups."
+msgstr ""
+
+#: src/useradmin/views.py:419
+msgid "POST request required in order to sync the LDAP users/groups."
+msgstr ""
+
+#: src/useradmin/views.py:430
+msgid "No active superuser configured"
+msgstr ""
+
+#: src/useradmin/views.py:432
+msgid "You cannot remove the last active superuser from the configuration."
+msgstr ""
+
+#: src/useradmin/views.py:607
+msgid "Group name may only contain letters, numbers, hypens or underscores."
+msgstr ""
+
+#: src/useradmin/management/commands/import_ldap_group.py:39
+msgid "Import users from the group"
+msgstr ""
+
+#: src/useradmin/management/commands/import_ldap_group.py:48
+msgid "A group name must be provided"
+msgstr ""
+
+#: src/useradmin/management/commands/import_ldap_user.py:43
+msgid "A username must be provided"
+msgstr ""
+
+#: src/useradmin/management/commands/useradmin_sync_with_unix.py:31
+msgid "Minimum UID to import (Inclusive)."
+msgstr ""
+
+#: src/useradmin/management/commands/useradmin_sync_with_unix.py:32
+msgid "Maximum UID to import (Exclusive)."
+msgstr ""
+
+#: src/useradmin/management/commands/useradmin_sync_with_unix.py:33
+msgid "Minimum GID to import (Inclusive)."
+msgstr ""
+
+#: src/useradmin/management/commands/useradmin_sync_with_unix.py:34
+msgid "Maximum GID to import (Exclusive)."
+msgstr ""
+
+#: src/useradmin/management/commands/useradmin_sync_with_unix.py:35
+msgid "Whether or not to check that the user's shell is not /bin/false"
+msgstr ""
+
+#: src/useradmin/templates/confirm.mako:22
+msgid "Confirm"
+msgstr ""
+
+#: src/useradmin/templates/confirm.mako:25
+#: src/useradmin/templates/list_groups.mako:77
+#: src/useradmin/templates/list_users.mako:106
+msgid "Yes"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:26
+#: src/useradmin/templates/list_groups.mako:24
+#: src/useradmin/templates/list_groups.mako:28
+msgid "Hue Groups"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:47
+#, python-format
+msgid "Hue Groups - Edit group: %(name)s"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:50
+msgid "Hue Groups - Add/sync LDAP group"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:52
+msgid "Hue Groups - Create group"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:65
+msgid "Update group"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:68
+msgid "Add/Sync group"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:70
+#: src/useradmin/templates/list_groups.mako:32
+msgid "Add group"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:73
+#: src/useradmin/templates/edit_permissions.mako:53
+#: src/useradmin/templates/edit_user.mako:70
+#: src/useradmin/templates/list_users.mako:93
+msgid "Cancel"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:81
+#: src/useradmin/templates/edit_group.mako:86
+#: src/useradmin/templates/edit_permissions.mako:62
+#: src/useradmin/templates/edit_user.mako:77
+msgid "Select all"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:82
+#: src/useradmin/templates/edit_group.mako:87
+#: src/useradmin/templates/edit_permissions.mako:63
+#: src/useradmin/templates/edit_user.mako:78
+msgid "Search"
+msgstr ""
+
+#: src/useradmin/templates/edit_permissions.mako:23
+#: src/useradmin/templates/list_permissions.mako:25
+#: src/useradmin/templates/list_permissions.mako:29
+msgid "Hue Permissions"
+msgstr ""
+
+#: src/useradmin/templates/edit_permissions.mako:43
+#, python-format
+msgid "Hue Permissions - Edit app: %(app)s"
+msgstr ""
+
+#: src/useradmin/templates/edit_permissions.mako:52
+msgid "Update permission"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:24
+#: src/useradmin/templates/list_users.mako:24
+#: src/useradmin/templates/list_users.mako:28
+msgid "Hue Users"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:44
+#, python-format
+msgid "Hue Users - Edit user: %(username)s"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:47
+msgid "Hue Users - Add/sync LDAP user"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:49
+msgid "Hue Users - Create user"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:62
+msgid "Update user"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:65
+msgid "Add/Sync user"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:67
+#: src/useradmin/templates/list_users.mako:32
+msgid "Add user"
+msgstr ""
+
+#: src/useradmin/templates/layout.mako:32
+msgid "Users"
+msgstr ""
+
+#: src/useradmin/templates/layout.mako:33
+#: src/useradmin/templates/list_permissions.mako:40
+#: src/useradmin/templates/list_users.mako:48
+msgid "Groups"
+msgstr ""
+
+#: src/useradmin/templates/layout.mako:34
+#: src/useradmin/templates/list_groups.mako:45
+msgid "Permissions"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:33
+msgid "Add/Sync LDAP group"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:37
+#: src/useradmin/templates/list_permissions.mako:32
+#: src/useradmin/templates/list_users.mako:38
+msgid "Filter: "
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:37
+msgid "Search for group name, members, etc..."
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:43
+msgid "Group Name"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:44
+msgid "Members"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:59
+#, python-format
+msgid "Edit %(groupname)s"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:59
+#: src/useradmin/templates/list_permissions.mako:54
+#: src/useradmin/templates/list_users.mako:64
+msgid "Edit"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:60
+#, python-format
+msgid "Delete %(groupname)s"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:60
+#, python-format
+msgid "Are you sure you want to delete %(group_name)s?"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:60
+#: src/useradmin/templates/list_users.mako:65
+msgid "Delete"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:74
+#: src/useradmin/templates/list_users.mako:103
+msgid "Confirm action"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:78
+#: src/useradmin/templates/list_users.mako:107
+msgid "No"
+msgstr ""
+
+#: src/useradmin/templates/list_permissions.mako:32
+msgid "Search for application name, description, etc..."
+msgstr ""
+
+#: src/useradmin/templates/list_permissions.mako:38
+msgid "Application"
+msgstr ""
+
+#: src/useradmin/templates/list_permissions.mako:39
+msgid "Permission"
+msgstr ""
+
+#: src/useradmin/templates/list_permissions.mako:54
+msgid "Edit permission"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:33
+msgid "Add/sync LDAP user"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:34
+msgid "Sync LDAP users/groups"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:38
+msgid "Search for username, name, e-mail, etc..."
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:45
+msgid "First Name"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:46
+msgid "Last Name"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:47
+msgid "E-mail"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:49
+msgid "Last Login"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:64
+#: src/useradmin/templates/list_users.mako:68
+#, python-format
+msgid "Edit %(username)s"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:65
+#, python-format
+msgid "Delete %(username)s"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:82
+msgid "Sync LDAP users and groups"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:86
+msgid ""
+"This will not import any users or groups that don't already exist in Hue."
+" Only users and groups imported from LDAP can be synced."
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:88
+msgid ""
+"All user information and group memberships will be updated based on the "
+"LDAP server's current state."
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:94
+msgid "Sync"
+msgstr ""
+

+ 476 - 0
apps/useradmin/src/useradmin/locale/en_US/LC_MESSAGES/django.po

@@ -0,0 +1,476 @@
+# English (United States) translations for PROJECT.
+# Copyright (C) 2012 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2012-07-10 12:05+0200\n"
+"PO-Revision-Date: 2012-07-10 12:10+0200\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: en_US <LL@li.org>\n"
+"Plural-Forms: nplurals=2; plural=(n != 1)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 0.9.6\n"
+
+#: src/useradmin/models.py:124
+#, python-format
+msgid "You do not have permissions to %(description)s."
+msgstr ""
+
+#: src/useradmin/models.py:230
+msgid "launch this application"
+msgstr ""
+
+#: src/useradmin/views.py:58
+msgid "You must be a superuser to delete users."
+msgstr ""
+
+#: src/useradmin/views.py:65
+msgid "You cannot remove yourself."
+msgstr ""
+
+#: src/useradmin/views.py:76
+msgid "User not found."
+msgstr ""
+
+#: src/useradmin/views.py:80
+msgid "Delete user?"
+msgstr ""
+
+#: src/useradmin/views.py:84
+msgid "You must be a superuser to delete groups."
+msgstr ""
+
+#: src/useradmin/views.py:96
+msgid "The default user group may not be deleted."
+msgstr ""
+
+#: src/useradmin/views.py:104
+msgid "Group not found."
+msgstr ""
+
+#: src/useradmin/views.py:108
+msgid "Delete group?"
+msgstr ""
+
+#: src/useradmin/views.py:116 src/useradmin/views.py:289
+#: src/useradmin/templates/list_users.mako:44
+msgid "Username"
+msgstr ""
+
+#: src/useradmin/views.py:119 src/useradmin/views.py:292
+msgid "Required. 30 characters or fewer. No whitespaces or colons."
+msgstr ""
+
+#: src/useradmin/views.py:120 src/useradmin/views.py:293
+#: src/useradmin/views.py:349
+msgid "Whitespaces and ':' not allowed"
+msgstr ""
+
+#: src/useradmin/views.py:121
+msgid "Password"
+msgstr ""
+
+#: src/useradmin/views.py:122
+msgid "Password confirmation"
+msgstr ""
+
+#: src/useradmin/views.py:131
+msgid "Passwords do not match."
+msgstr ""
+
+#: src/useradmin/views.py:137
+msgid "You must specify a password when creating a new user."
+msgstr ""
+
+#: src/useradmin/views.py:179
+msgid "You must be a superuser to add or edit another user."
+msgstr ""
+
+#: src/useradmin/views.py:203
+msgid "You cannot make yourself inactive."
+msgstr ""
+
+#: src/useradmin/views.py:215
+msgid "You cannot make yourself a superuser."
+msgstr ""
+
+#: src/useradmin/views.py:239
+msgid "You must be a superuser to add or edit a group."
+msgstr ""
+
+#: src/useradmin/views.py:271
+msgid "You must be a superuser to change permissions."
+msgstr ""
+
+#: src/useradmin/views.py:294 src/useradmin/views.py:350
+msgid "Distinguished name"
+msgstr ""
+
+#: src/useradmin/views.py:295
+#: src/useradmin/management/commands/import_ldap_group.py:35
+#: src/useradmin/management/commands/import_ldap_user.py:33
+msgid "Whether or not the user should be imported by distinguished name"
+msgstr ""
+
+#: src/useradmin/views.py:307
+#, python-format
+msgid "Too long: 30 characters or fewer and not %(username)s"
+msgstr ""
+
+#: src/useradmin/views.py:324
+msgid "You must be a superuser to add another user."
+msgstr ""
+
+#: src/useradmin/views.py:335
+#, python-format
+msgid "Could not get LDAP details for user %(username)s"
+msgstr ""
+
+#: src/useradmin/views.py:347
+msgid ""
+"Required. 30 characters or fewer. May only contain letters, numbers, "
+"hypens or underscores."
+msgstr ""
+
+#: src/useradmin/views.py:351
+msgid "Whether or not the group should be imported by distinguished name"
+msgstr ""
+
+#: src/useradmin/views.py:355
+msgid "Import new members"
+msgstr ""
+
+#: src/useradmin/views.py:356
+msgid "Import unimported or new users from the group"
+msgstr ""
+
+#: src/useradmin/views.py:367
+#, python-format
+msgid "Too long: 30 characters or fewer and not %(name)s"
+msgstr ""
+
+#: src/useradmin/views.py:385
+msgid "You must be a superuser to add another group."
+msgstr ""
+
+#: src/useradmin/views.py:397
+#, python-format
+msgid "Could not get LDAP details for group %(groupname)s"
+msgstr ""
+
+#: src/useradmin/views.py:413
+msgid "You must be a superuser to sync the LDAP users/groups."
+msgstr ""
+
+#: src/useradmin/views.py:419
+msgid "POST request required in order to sync the LDAP users/groups."
+msgstr ""
+
+#: src/useradmin/views.py:430
+msgid "No active superuser configured"
+msgstr ""
+
+#: src/useradmin/views.py:432
+msgid "You cannot remove the last active superuser from the configuration."
+msgstr ""
+
+#: src/useradmin/views.py:607
+msgid "Group name may only contain letters, numbers, hypens or underscores."
+msgstr ""
+
+#: src/useradmin/management/commands/import_ldap_group.py:39
+msgid "Import users from the group"
+msgstr ""
+
+#: src/useradmin/management/commands/import_ldap_group.py:48
+msgid "A group name must be provided"
+msgstr ""
+
+#: src/useradmin/management/commands/import_ldap_user.py:43
+msgid "A username must be provided"
+msgstr ""
+
+#: src/useradmin/management/commands/useradmin_sync_with_unix.py:31
+msgid "Minimum UID to import (Inclusive)."
+msgstr ""
+
+#: src/useradmin/management/commands/useradmin_sync_with_unix.py:32
+msgid "Maximum UID to import (Exclusive)."
+msgstr ""
+
+#: src/useradmin/management/commands/useradmin_sync_with_unix.py:33
+msgid "Minimum GID to import (Inclusive)."
+msgstr ""
+
+#: src/useradmin/management/commands/useradmin_sync_with_unix.py:34
+msgid "Maximum GID to import (Exclusive)."
+msgstr ""
+
+#: src/useradmin/management/commands/useradmin_sync_with_unix.py:35
+msgid "Whether or not to check that the user's shell is not /bin/false"
+msgstr ""
+
+#: src/useradmin/templates/confirm.mako:22
+msgid "Confirm"
+msgstr ""
+
+#: src/useradmin/templates/confirm.mako:25
+#: src/useradmin/templates/list_groups.mako:77
+#: src/useradmin/templates/list_users.mako:106
+msgid "Yes"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:26
+#: src/useradmin/templates/list_groups.mako:24
+#: src/useradmin/templates/list_groups.mako:28
+msgid "Hue Groups"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:47
+#, python-format
+msgid "Hue Groups - Edit group: %(name)s"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:50
+msgid "Hue Groups - Add/sync LDAP group"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:52
+msgid "Hue Groups - Create group"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:65
+msgid "Update group"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:68
+msgid "Add/Sync group"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:70
+#: src/useradmin/templates/list_groups.mako:32
+msgid "Add group"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:73
+#: src/useradmin/templates/edit_permissions.mako:53
+#: src/useradmin/templates/edit_user.mako:70
+#: src/useradmin/templates/list_users.mako:93
+msgid "Cancel"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:81
+#: src/useradmin/templates/edit_group.mako:86
+#: src/useradmin/templates/edit_permissions.mako:62
+#: src/useradmin/templates/edit_user.mako:77
+msgid "Select all"
+msgstr ""
+
+#: src/useradmin/templates/edit_group.mako:82
+#: src/useradmin/templates/edit_group.mako:87
+#: src/useradmin/templates/edit_permissions.mako:63
+#: src/useradmin/templates/edit_user.mako:78
+msgid "Search"
+msgstr ""
+
+#: src/useradmin/templates/edit_permissions.mako:23
+#: src/useradmin/templates/list_permissions.mako:25
+#: src/useradmin/templates/list_permissions.mako:29
+msgid "Hue Permissions"
+msgstr ""
+
+#: src/useradmin/templates/edit_permissions.mako:43
+#, python-format
+msgid "Hue Permissions - Edit app: %(app)s"
+msgstr ""
+
+#: src/useradmin/templates/edit_permissions.mako:52
+msgid "Update permission"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:24
+#: src/useradmin/templates/list_users.mako:24
+#: src/useradmin/templates/list_users.mako:28
+msgid "Hue Users"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:44
+#, python-format
+msgid "Hue Users - Edit user: %(username)s"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:47
+msgid "Hue Users - Add/sync LDAP user"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:49
+msgid "Hue Users - Create user"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:62
+msgid "Update user"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:65
+msgid "Add/Sync user"
+msgstr ""
+
+#: src/useradmin/templates/edit_user.mako:67
+#: src/useradmin/templates/list_users.mako:32
+msgid "Add user"
+msgstr ""
+
+#: src/useradmin/templates/layout.mako:32
+msgid "Users"
+msgstr ""
+
+#: src/useradmin/templates/layout.mako:33
+#: src/useradmin/templates/list_permissions.mako:40
+#: src/useradmin/templates/list_users.mako:48
+msgid "Groups"
+msgstr ""
+
+#: src/useradmin/templates/layout.mako:34
+#: src/useradmin/templates/list_groups.mako:45
+msgid "Permissions"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:33
+msgid "Add/Sync LDAP group"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:37
+#: src/useradmin/templates/list_permissions.mako:32
+#: src/useradmin/templates/list_users.mako:38
+msgid "Filter: "
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:37
+msgid "Search for group name, members, etc..."
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:43
+msgid "Group Name"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:44
+msgid "Members"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:59
+#, python-format
+msgid "Edit %(groupname)s"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:59
+#: src/useradmin/templates/list_permissions.mako:54
+#: src/useradmin/templates/list_users.mako:64
+msgid "Edit"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:60
+#, python-format
+msgid "Delete %(groupname)s"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:60
+#, python-format
+msgid "Are you sure you want to delete %(group_name)s?"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:60
+#: src/useradmin/templates/list_users.mako:65
+msgid "Delete"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:74
+#: src/useradmin/templates/list_users.mako:103
+msgid "Confirm action"
+msgstr ""
+
+#: src/useradmin/templates/list_groups.mako:78
+#: src/useradmin/templates/list_users.mako:107
+msgid "No"
+msgstr ""
+
+#: src/useradmin/templates/list_permissions.mako:32
+msgid "Search for application name, description, etc..."
+msgstr ""
+
+#: src/useradmin/templates/list_permissions.mako:38
+msgid "Application"
+msgstr ""
+
+#: src/useradmin/templates/list_permissions.mako:39
+msgid "Permission"
+msgstr ""
+
+#: src/useradmin/templates/list_permissions.mako:54
+msgid "Edit permission"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:33
+msgid "Add/sync LDAP user"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:34
+msgid "Sync LDAP users/groups"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:38
+msgid "Search for username, name, e-mail, etc..."
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:45
+msgid "First Name"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:46
+msgid "Last Name"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:47
+msgid "E-mail"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:49
+msgid "Last Login"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:64
+#: src/useradmin/templates/list_users.mako:68
+#, python-format
+msgid "Edit %(username)s"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:65
+#, python-format
+msgid "Delete %(username)s"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:82
+msgid "Sync LDAP users and groups"
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:86
+msgid ""
+"This will not import any users or groups that don't already exist in Hue."
+" Only users and groups imported from LDAP can be synced."
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:88
+msgid ""
+"All user information and group memberships will be updated based on the "
+"LDAP server's current state."
+msgstr ""
+
+#: src/useradmin/templates/list_users.mako:94
+msgid "Sync"
+msgstr ""
+

+ 6 - 4
apps/useradmin/src/useradmin/management/commands/import_ldap_group.py

@@ -20,6 +20,8 @@ from useradmin.views import import_ldap_group
 
 from django.core.management.base import BaseCommand, CommandError
 
+from django.utils.translation import ugettext_lazy as _
+
 class Command(BaseCommand):
   """
   Handler for importing LDAP groups into the Hue database.
@@ -30,11 +32,11 @@ class Command(BaseCommand):
   """
 
   option_list = BaseCommand.option_list + (
-      make_option("--dn", help="Whether or not the user should be imported by "
-                               "distinguished name",
+      make_option("--dn", help=_("Whether or not the user should be imported by "
+                               "distinguished name"),
                           action="store_true",
                           default=False),
-      make_option("--import-members", help="Import users from the group",
+      make_option("--import-members", help=_("Import users from the group"),
                                       action="store_true",
                                       default=False),
    )
@@ -43,7 +45,7 @@ class Command(BaseCommand):
 
   def handle(self, group=None, **options):
     if group is None:
-      raise CommandError("A group name must be provided")
+      raise CommandError(_("A group name must be provided"))
 
     import_members = options['import_members']
     import_by_dn = options['dn']

+ 5 - 3
apps/useradmin/src/useradmin/management/commands/import_ldap_user.py

@@ -20,6 +20,8 @@ from useradmin.views import import_ldap_user
 
 from django.core.management.base import BaseCommand, CommandError
 
+from django.utils.translation import ugettext_lazy as _
+
 class Command(BaseCommand):
   """
   Handler for importing LDAP users into the Hue database.
@@ -28,8 +30,8 @@ class Command(BaseCommand):
   """
 
   option_list = BaseCommand.option_list + (
-      make_option("--dn", help="Whether or not the user should be imported by "
-                               "distinguished name",
+      make_option("--dn", help=_("Whether or not the user should be imported by "
+                               "distinguished name"),
                           action="store_true",
                           default=False),
   )
@@ -38,7 +40,7 @@ class Command(BaseCommand):
 
   def handle(self, user=None, **options):
     if user is None:
-      raise CommandError("A username must be provided")
+      raise CommandError(_("A username must be provided"))
 
     import_by_dn = options['dn']
     import_ldap_user(user, import_by_dn)

+ 7 - 5
apps/useradmin/src/useradmin/management/commands/useradmin_sync_with_unix.py

@@ -20,17 +20,19 @@ from useradmin.views import sync_unix_users_and_groups
 
 from django.core.management.base import BaseCommand
 
+from django.utils.translation import ugettext_lazy as _
+
 class Command(BaseCommand):
   """
   Handler for syncing the Hue database with Unix users and groups
   """
 
   option_list = BaseCommand.option_list + (
-      make_option("--min-uid", help="Minimum UID to import (Inclusive).", default=500),
-      make_option("--max-uid", help="Maximum UID to import (Exclusive).", default=65334),
-      make_option("--min-gid", help="Minimum GID to import (Inclusive).", default=500),
-      make_option("--max-gid", help="Maximum GID to import (Exclusive).", default=65334),
-      make_option("--check-shell", help="Whether or not to check that the user's shell is not /bin/false", default=True)
+      make_option("--min-uid", help=_("Minimum UID to import (Inclusive)."), default=500),
+      make_option("--max-uid", help=_("Maximum UID to import (Exclusive)."), default=65334),
+      make_option("--min-gid", help=_("Minimum GID to import (Inclusive)."), default=500),
+      make_option("--max-gid", help=_("Maximum GID to import (Exclusive)."), default=65334),
+      make_option("--check-shell", help=_("Whether or not to check that the user's shell is not /bin/false"), default=True)
   )
 
   def handle(self, *args, **options):

+ 3 - 1
apps/useradmin/src/useradmin/models.py

@@ -59,6 +59,8 @@ from enum import Enum
 
 import useradmin.conf
 
+from django.utils.translation import ugettext_lazy as _
+
 LOG = logging.getLogger(__name__)
 
 class UserProfile(models.Model):
@@ -119,7 +121,7 @@ class UserProfile(models.Model):
     if self.has_hue_permission(perm):
       return
     else:
-      raise PopupException("You do not have permissions to %s." % perm.description)
+      raise PopupException(_("You do not have permissions to %(description)s.") % dict(description=perm.description))
 
 def get_profile(user):
   """

+ 49 - 48
apps/useradmin/src/useradmin/views.py

@@ -24,7 +24,6 @@ import logging
 import threading
 import subprocess
 
-import django
 import django.contrib.auth.forms
 from django import forms
 from django.contrib.auth.models import User, Group
@@ -37,6 +36,8 @@ from useradmin.models import GroupPermission, HuePermission, UserProfile, LdapGr
 from useradmin.models import get_profile, get_default_user_group
 import ldap_access
 
+from django.utils.translation import ugettext_lazy as _
+
 LOG = logging.getLogger(__name__)
 
 __users_lock = threading.Lock()
@@ -53,14 +54,14 @@ def list_permissions(request):
 
 def delete_user(request, username):
   if not request.user.is_superuser:
-    raise PopupException("You must be a superuser to delete users.")
+    raise PopupException(_("You must be a superuser to delete users."))
   if request.method == 'POST':
     try:
       global __users_lock
       __users_lock.acquire()
       try:
         if username == request.user.username:
-          raise PopupException("You cannot remove yourself.")
+          raise PopupException(_("You cannot remove yourself."))
         user = User.objects.get(username=username)
         user_profile = UserProfile.objects.get(user=user)
         user_profile.delete()
@@ -71,15 +72,15 @@ def delete_user(request, username):
       # Send a flash message saying "deleted"?
       return list_users(request)
     except User.DoesNotExist:
-      raise PopupException("User not found.")
+      raise PopupException(_("User not found."))
   else:
     return render("confirm.mako",
       request,
-      dict(path=request.path, title="Delete user?"))
+      dict(path=request.path, title=_("Delete user?")))
 
 def delete_group(request, name):
   if not request.user.is_superuser:
-    raise PopupException("You must be a superuser to delete groups.")
+    raise PopupException(_("You must be a superuser to delete groups."))
   if request.method == 'POST':
     try:
       global groups_lock
@@ -91,7 +92,7 @@ def delete_group(request, name):
         default_group = get_default_user_group()
         group = Group.objects.get(name=name)
         if default_group is not None and default_group.name == name:
-          raise PopupException("The default user group may not be deleted.")
+          raise PopupException(_("The default user group may not be deleted."))
         group.delete()
       finally:
         __groups_lock.release()
@@ -99,11 +100,11 @@ def delete_group(request, name):
       # Send a flash message saying "deleted"?
       return list_groups(request)
     except Group.DoesNotExist:
-      raise PopupException("Group not found.")
+      raise PopupException(_("Group not found."))
   else:
     return render("confirm.mako",
       request,
-      dict(path=request.path, title="Delete group?"))
+      dict(path=request.path, title=_("Delete group?")))
 
 class UserChangeForm(django.contrib.auth.forms.UserChangeForm):
   """
@@ -111,13 +112,13 @@ class UserChangeForm(django.contrib.auth.forms.UserChangeForm):
   and UserCreationForm.
   """
   username = forms.RegexField(
-      label="Username",
+      label=_("Username"),
       max_length=30,
       regex='^%s$' % (get_username_re_rule(),),
-      help_text = "Required. 30 characters or fewer. No whitespaces or colons.",
-      error_messages = {'invalid': "Whitespaces and ':' not allowed" })
-  password1 = forms.CharField(label="Password", widget=forms.PasswordInput, required=False)
-  password2 = forms.CharField(label="Password confirmation", widget=forms.PasswordInput, required=False)
+      help_text = _("Required. 30 characters or fewer. No whitespaces or colons."),
+      error_messages = {'invalid': _("Whitespaces and ':' not allowed") })
+  password1 = forms.CharField(label=_("Password"), widget=forms.PasswordInput, required=False)
+  password2 = forms.CharField(label=_("Password confirmation"), widget=forms.PasswordInput, required=False)
 
   class Meta(django.contrib.auth.forms.UserChangeForm.Meta):
     fields = ["username", "first_name", "last_name", "email"]
@@ -126,13 +127,13 @@ class UserChangeForm(django.contrib.auth.forms.UserChangeForm):
     password1 = self.cleaned_data.get("password1", "")
     password2 = self.cleaned_data["password2"]
     if password1 != password2:
-      raise forms.ValidationError("Passwords do not match.")
+      raise forms.ValidationError(_("Passwords do not match."))
     return password2
 
   def clean_password1(self):
     password = self.cleaned_data.get("password1", "")
     if self.instance.id is None and password == "":
-      raise forms.ValidationError("You must specify a password when creating a new user.")
+      raise forms.ValidationError(_("You must specify a password when creating a new user."))
     return self.cleaned_data.get("password1", "")
 
   def save(self, commit=True):
@@ -174,7 +175,7 @@ def edit_user(request, username=None):
   @param username:      Default to None, when creating a new user
   """
   if request.user.username != username and not request.user.is_superuser:
-    raise PopupException("You must be a superuser to add or edit another user.")
+    raise PopupException(_("You must be a superuser to add or edit another user."))
   if username is not None:
     instance = User.objects.get(username=username)
   else:
@@ -198,7 +199,7 @@ def edit_user(request, username=None):
         # (3) The last active superuser cannot demote/inactivate himself.
         #
         if request.user.username == username and not form.instance.is_active:
-          raise PopupException("You cannot make yourself inactive.")
+          raise PopupException(_("You cannot make yourself inactive."))
 
         global __users_lock
         __users_lock.acquire()
@@ -210,7 +211,7 @@ def edit_user(request, username=None):
               _check_remove_last_super(orig)
           else:
             if form.instance.is_superuser and not request.user.is_superuser:
-              raise PopupException("You cannot make yourself a superuser.")
+              raise PopupException(_("You cannot make yourself a superuser."))
 
           # All ok
           form.save()
@@ -234,7 +235,7 @@ def edit_group(request, name=None):
   Only superusers may create a group
   """
   if not request.user.is_superuser:
-    raise PopupException("You must be a superuser to add or edit a group.")
+    raise PopupException(_("You must be a superuser to add or edit a group."))
 
   if name is not None:
     instance = Group.objects.get(name=name)
@@ -266,7 +267,7 @@ def edit_permission(request, app=None, priv=None):
   Only superusers may modify permissions
   """
   if not request.user.is_superuser:
-    raise PopupException("You must be a superuser to change permissions.")
+    raise PopupException(_("You must be a superuser to change permissions."))
 
   instance = HuePermission.objects.get(app=app, action=priv)
 
@@ -284,14 +285,14 @@ def edit_permission(request, app=None, priv=None):
 
 class AddLdapUserForm(forms.Form):
   username = forms.RegexField(
-      label="Username",
+      label=_("Username"),
       max_length=64,
       regex='^%s$' % (get_username_re_rule(),),
-      help_text="Required. 30 characters or fewer. No whitespaces or colons.",
-      error_messages={'invalid': "Whitespaces and ':' not allowed" })
-  dn = forms.BooleanField(label="Distinguished name",
-                          help_text="Whether or not the user should be imported by "
-                                    "distinguished name",
+      help_text=_("Required. 30 characters or fewer. No whitespaces or colons."),
+      error_messages={'invalid': _("Whitespaces and ':' not allowed")})
+  dn = forms.BooleanField(label=_("Distinguished name"),
+                          help_text=_("Whether or not the user should be imported by "
+                                    "distinguished name"),
                           initial=False,
                           required=False)
 
@@ -302,7 +303,7 @@ class AddLdapUserForm(forms.Form):
 
     if not dn:
       if username is not None and len(username) > 30:
-        msg = 'Too long: 30 characters or fewer and not %s' % (len(username),)
+        msg = _('Too long: 30 characters or fewer and not %(username)s') % dict(username=len(username),)
         errors = self._errors.setdefault('username', ErrorList())
         errors.append(msg)
         raise forms.ValidationError(msg)
@@ -319,7 +320,7 @@ def add_ldap_user(request):
   If the LDAP request failed, the error message is generic right now.
   """
   if not request.user.is_superuser:
-    raise PopupException("You must be a superuser to add another user.")
+    raise PopupException(_("You must be a superuser to add another user."))
 
   if request.method == 'POST':
     form = AddLdapUserForm(request.POST)
@@ -330,7 +331,7 @@ def add_ldap_user(request):
 
       if user is None:
         errors = form._errors.setdefault('username', ErrorList())
-        errors.append('Could not get LDAP details for user %s' % (username,))
+        errors.append(_('Could not get LDAP details for user %(username)s') % dict(username=(username,)))
       else:
         return redirect(reverse(list_users))
   else:
@@ -342,16 +343,16 @@ class AddLdapGroupForm(forms.Form):
       label="Name",
       max_length=64,
       regex='^%s$' % (get_groupname_re_rule(),),
-      help_text="Required. 30 characters or fewer. May only contain letters, "
-                "numbers, hypens or underscores.",
-      error_messages={'invalid': "Whitespaces and ':' not allowed" })
-  dn = forms.BooleanField(label="Distinguished name",
-                          help_text="Whether or not the group should be imported by "
-                                    "distinguished name",
+      help_text=_("Required. 30 characters or fewer. May only contain letters, "
+                "numbers, hypens or underscores."),
+      error_messages={'invalid': _("Whitespaces and ':' not allowed") })
+  dn = forms.BooleanField(label=_("Distinguished name"),
+                          help_text=_("Whether or not the group should be imported by "
+                                    "distinguished name"),
                           initial=False,
                           required=False)
-  import_members = forms.BooleanField(label='Import new members',
-                                      help_text='Import unimported or new users from the group',
+  import_members = forms.BooleanField(label=_('Import new members'),
+                                      help_text=_('Import unimported or new users from the group'),
                                       initial=False,
                                       required=False)
 
@@ -362,7 +363,7 @@ class AddLdapGroupForm(forms.Form):
 
     if not dn:
       if name is not None and len(name) > 30:
-        msg = 'Too long: 30 characters or fewer and not %s' % (len(name),)
+        msg = _('Too long: 30 characters or fewer and not %(name)s') % dict(name=(len(name),))
         errors = self._errors.setdefault('name', ErrorList())
         errors.append(msg)
         raise forms.ValidationError(msg)
@@ -380,7 +381,7 @@ def add_ldap_group(request):
   all unimported users.
   """
   if not request.user.is_superuser:
-    raise PopupException("You must be a superuser to add another group.")
+    raise PopupException(_("You must be a superuser to add another group."))
 
   if request.method == 'POST':
     form = AddLdapGroupForm(request.POST)
@@ -392,7 +393,7 @@ def add_ldap_group(request):
 
       if group is None:
         errors = form._errors.setdefault('name', ErrorList())
-        errors.append('Could not get LDAP details for group %s' % (groupname,))
+        errors.append(_('Could not get LDAP details for group %(groupname)s') % dict(groupname=(groupname,)))
       else:
         return redirect(reverse(list_groups))
   else:
@@ -408,13 +409,13 @@ def sync_ldap_users_groups(request):
   server's current state.
   """
   if not request.user.is_superuser:
-    raise PopupException("You must be a superuser to sync the LDAP users/groups.")
+    raise PopupException(_("You must be a superuser to sync the LDAP users/groups."))
 
   if request.method == 'POST':
     sync_ldap_users_and_groups()
     return redirect(reverse(list_users))
   else:
-    raise PopupException("POST request required in order to sync the LDAP users/groups.")
+    raise PopupException(_("POST request required in order to sync the LDAP users/groups."))
 
 def _check_remove_last_super(user_obj):
   """Raise an error if we're removing the last superuser"""
@@ -425,10 +426,10 @@ def _check_remove_last_super(user_obj):
   all_active_su = User.objects.filter(is_superuser__exact = True,
                                       is_active__exact = True)
   num_active_su = all_active_su.count()
-  assert num_active_su >= 1, "No active superuser configured"
+  assert num_active_su >= 1, _("No active superuser configured")
   if num_active_su == 1:
-    raise PopupException("You cannot remove the last active "
-                         "superuser from the configuration.")
+    raise PopupException(_("You cannot remove the last active "
+                         "superuser from the configuration."))
 
 def sync_unix_users_and_groups(min_uid, max_uid, min_gid, max_gid, check_shell):
   """
@@ -602,8 +603,8 @@ class GroupEditForm(forms.ModelForm):
     # Note that the superclass doesn't have a clean_name method.
     data = self.cleaned_data["name"]
     if not self.GROUPNAME.match(data):
-      raise forms.ValidationError("Group name may only contain letters, " +
-                                  "numbers, hypens or underscores.")
+      raise forms.ValidationError(_("Group name may only contain letters, " +
+                                  "numbers, hypens or underscores."))
     return data
 
   def __init__(self, *args, **kwargs):