changeset 5295:fa8b8df51ad0

i18n: use plain strings on the english lookup side of translations Unicode strings are unnecessarily complex and do not in any of our cases add any value. It is thus better to consistently use plain strings.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 23 Jul 2015 00:52:29 +0200
parents cd655fbd79ce
children 82ea8d67fc62
files kallithea/lib/utils2.py kallithea/model/forms.py kallithea/model/user.py kallithea/model/validators.py kallithea/templates/admin/gists/index.html kallithea/templates/admin/gists/show.html kallithea/templates/admin/repo_groups/repo_group_edit.html kallithea/templates/admin/repo_groups/repo_group_show.html kallithea/templates/admin/repo_groups/repo_groups.html kallithea/templates/admin/repos/repos.html kallithea/templates/admin/user_groups/user_groups.html kallithea/templates/admin/users/users.html kallithea/templates/base/base.html kallithea/templates/index_base.html
diffstat 14 files changed, 57 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/utils2.py	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/lib/utils2.py	Thu Jul 23 00:52:29 2015 +0200
@@ -433,17 +433,17 @@
 
         if sub_value == 0 or show_short_version:
             if future:
-                return _(u'in %s') % fmt_funcs[part](value)
+                return _('in %s') % fmt_funcs[part](value)
             else:
-                return _(u'%s ago') % fmt_funcs[part](value)
+                return _('%s ago') % fmt_funcs[part](value)
         if future:
-            return _(u'in %s and %s') % (fmt_funcs[part](value),
+            return _('in %s and %s') % (fmt_funcs[part](value),
                 fmt_funcs[sub_part](sub_value))
         else:
-            return _(u'%s and %s ago') % (fmt_funcs[part](value),
+            return _('%s and %s ago') % (fmt_funcs[part](value),
                 fmt_funcs[sub_part](sub_value))
 
-    return _(u'just now')
+    return _('just now')
 
 
 def uri_filter(uri):
--- a/kallithea/model/forms.py	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/model/forms.py	Thu Jul 23 00:52:29 2015 +0200
@@ -54,8 +54,8 @@
         min=1,
         not_empty=True,
         messages={
-           'empty': _(u'Please enter a login'),
-           'tooShort': _(u'Enter a value %(min)i characters long or more')}
+           'empty': _('Please enter a login'),
+           'tooShort': _('Enter a value %(min)i characters long or more')}
     )
 
     password = v.UnicodeString(
@@ -63,8 +63,8 @@
         min=3,
         not_empty=True,
         messages={
-            'empty': _(u'Please enter a password'),
-            'tooShort': _(u'Enter %(min)i characters or more')}
+            'empty': _('Please enter a password'),
+            'tooShort': _('Enter %(min)i characters or more')}
     )
 
     remember = v.StringBoolean(if_missing=False)
--- a/kallithea/model/user.py	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/model/user.py	Thu Jul 23 00:52:29 2015 +0200
@@ -255,12 +255,12 @@
 
         if user.username == User.DEFAULT_USER:
             raise DefaultUserException(
-                _(u"You can't remove this user since it's"
+                _("You can't remove this user since it's"
                   " crucial for entire application"))
         if user.repositories:
             repos = [x.repo_name for x in user.repositories]
             raise UserOwnsReposException(
-                _(u'User "%s" still owns %s repositories and cannot be '
+                _('User "%s" still owns %s repositories and cannot be '
                   'removed. Switch owners or remove those repositories: %s')
                 % (user.username, len(repos), ', '.join(repos)))
         if user.repo_groups:
--- a/kallithea/model/validators.py	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/model/validators.py	Thu Jul 23 00:52:29 2015 +0200
@@ -93,11 +93,11 @@
 def ValidUsername(edit=False, old_data={}):
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'username_exists': _(u'Username "%(username)s" already exists'),
+            'username_exists': _('Username "%(username)s" already exists'),
             'system_invalid_username':
-                _(u'Username "%(username)s" is forbidden'),
+                _('Username "%(username)s" is forbidden'),
             'invalid_username':
-                _(u'Username may only contain alphanumeric characters '
+                _('Username may only contain alphanumeric characters '
                     'underscores, periods or dashes and must begin with '
                     'alphanumeric character or underscore')
         }
@@ -131,7 +131,7 @@
 def ValidRepoUser():
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'invalid_username': _(u'Username %(username)s is not valid')
+            'invalid_username': _('Username %(username)s is not valid')
         }
 
         def validate_python(self, value, state):
@@ -150,10 +150,10 @@
 def ValidUserGroup(edit=False, old_data={}):
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'invalid_group': _(u'Invalid user group name'),
-            'group_exist': _(u'User group "%(usergroup)s" already exists'),
+            'invalid_group': _('Invalid user group name'),
+            'group_exist': _('User group "%(usergroup)s" already exists'),
             'invalid_usergroup_name':
-                _(u'user group name may only contain alphanumeric '
+                _('user group name may only contain alphanumeric '
                   'characters underscores, periods or dashes and must begin '
                   'with alphanumeric character')
         }
@@ -191,10 +191,10 @@
 def ValidRepoGroup(edit=False, old_data={}):
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'group_parent_id': _(u'Cannot assign this group as parent'),
-            'group_exists': _(u'Group "%(group_name)s" already exists'),
+            'group_parent_id': _('Cannot assign this group as parent'),
+            'group_exists': _('Group "%(group_name)s" already exists'),
             'repo_exists':
-                _(u'Repository with name "%(group_name)s" already exists')
+                _('Repository with name "%(group_name)s" already exists')
         }
 
         def validate_python(self, value, state):
@@ -252,7 +252,7 @@
     class _validator(formencode.validators.FancyValidator):
         messages = {
             'invalid_password':
-                _(u'Invalid characters (non-ascii) in password')
+                _('Invalid characters (non-ascii) in password')
         }
 
         def validate_python(self, value, state):
@@ -267,7 +267,7 @@
 def ValidOldPassword(username):
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'invalid_password': _(u'Invalid old password')
+            'invalid_password': _('Invalid old password')
         }
 
         def validate_python(self, value, state):
@@ -283,7 +283,7 @@
 def ValidPasswordsMatch(passwd='new_password', passwd_confirmation='password_confirmation'):
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'password_mismatch': _(u'Passwords do not match'),
+            'password_mismatch': _('Passwords do not match'),
         }
 
         def validate_python(self, value, state):
@@ -300,9 +300,9 @@
 def ValidAuth():
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'invalid_password': _(u'invalid password'),
-            'invalid_username': _(u'invalid user name'),
-            'disabled_account': _(u'Your account is disabled')
+            'invalid_password': _('invalid password'),
+            'invalid_username': _('invalid user name'),
+            'disabled_account': _('Your account is disabled')
         }
 
         def validate_python(self, value, state):
@@ -332,7 +332,7 @@
 def ValidAuthToken():
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'invalid_token': _(u'Token mismatch')
+            'invalid_token': _('Token mismatch')
         }
 
         def validate_python(self, value, state):
@@ -346,12 +346,12 @@
     class _validator(formencode.validators.FancyValidator):
         messages = {
             'invalid_repo_name':
-                _(u'Repository name %(repo)s is disallowed'),
+                _('Repository name %(repo)s is disallowed'),
             'repository_exists':
-                _(u'Repository named %(repo)s already exists'),
-            'repository_in_group_exists': _(u'Repository "%(repo)s" already '
+                _('Repository named %(repo)s already exists'),
+            'repository_in_group_exists': _('Repository "%(repo)s" already '
                                             'exists in group "%(group)s"'),
-            'same_group_exists': _(u'Repository group with name "%(repo)s" '
+            'same_group_exists': _('Repository group with name "%(repo)s" '
                                    'already exists')
         }
 
@@ -466,8 +466,8 @@
 
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'clone_uri': _(u'Invalid repository URL'),
-            'invalid_clone_uri': _(u'Invalid repository URL. It must be a '
+            'clone_uri': _('Invalid repository URL'),
+            'invalid_clone_uri': _('Invalid repository URL. It must be a '
                                     'valid http, https, ssh, svn+http or svn+https URL'),
         }
 
@@ -490,7 +490,7 @@
 def ValidForkType(old_data={}):
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'invalid_fork_type': _(u'Fork has to be the same type as parent')
+            'invalid_fork_type': _('Fork has to be the same type as parent')
         }
 
         def validate_python(self, value, state):
@@ -505,9 +505,9 @@
 def CanWriteGroup(old_data=None):
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'permission_denied': _(u"You don't have permissions "
+            'permission_denied': _("You don't have permissions "
                                    "to create repository in this group"),
-            'permission_denied_root': _(u"no permission to create repository "
+            'permission_denied_root': _("no permission to create repository "
                                         "in root location")
         }
 
@@ -557,7 +557,7 @@
 def CanCreateGroup(can_create_in_root=False):
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'permission_denied': _(u"You don't have permissions "
+            'permission_denied': _("You don't have permissions "
                                    "to create a group in this location")
         }
 
@@ -598,7 +598,7 @@
     class _validator(formencode.validators.FancyValidator):
         messages = {
             'perm_new_member_name':
-                _(u'This username or user group name is not valid')
+                _('This username or user group name is not valid')
         }
 
         def to_python(self, value, state):
@@ -691,7 +691,7 @@
 def ValidPath():
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'invalid_path': _(u'This is not a valid path')
+            'invalid_path': _('This is not a valid path')
         }
 
         def validate_python(self, value, state):
@@ -706,7 +706,7 @@
 def UniqSystemEmail(old_data={}):
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'email_taken': _(u'This e-mail address is already taken')
+            'email_taken': _('This e-mail address is already taken')
         }
 
         def _to_python(self, value, state):
@@ -726,7 +726,7 @@
 def ValidSystemEmail():
     class _validator(formencode.validators.FancyValidator):
         messages = {
-            'non_existing_email': _(u'e-mail "%(email)s" does not exist.')
+            'non_existing_email': _('e-mail "%(email)s" does not exist.')
         }
 
         def _to_python(self, value, state):
@@ -763,7 +763,7 @@
     class _validator(formencode.validators.UnicodeString):
         messages = {
             'invalid_cn':
-                  _(u'The LDAP Login attribute of the CN must be specified - '
+                  _('The LDAP Login attribute of the CN must be specified - '
                     'this is the name of the attribute that is equivalent '
                     'to "username"')
         }
@@ -776,7 +776,7 @@
     class _validator(formencode.validators.FancyValidator):
         messages = {
             'rev_already_reviewed':
-                  _(u'Revisions %(revs)s are already part of pull request '
+                  _('Revisions %(revs)s are already part of pull request '
                     'or have set status')
         }
 
--- a/kallithea/templates/admin/gists/index.html	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/templates/admin/gists/index.html	Thu Jul 23 00:52:29 2015 +0200
@@ -34,7 +34,7 @@
         %if c.authuser.username != 'default':
         <ul class="links">
           <li>
-             <a href="${h.url('new_gist')}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_(u'Create New Gist')}</a>
+             <a href="${h.url('new_gist')}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_('Create New Gist')}</a>
           </li>
         </ul>
         %endif
--- a/kallithea/templates/admin/gists/show.html	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/templates/admin/gists/show.html	Thu Jul 23 00:52:29 2015 +0200
@@ -22,7 +22,7 @@
         %if c.authuser.username != 'default':
         <ul class="links">
           <li>
-              <a href="${h.url('new_gist')}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_(u'Create New Gist')}</a>
+              <a href="${h.url('new_gist')}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_('Create New Gist')}</a>
           </li>
         </ul>
         %endif
--- a/kallithea/templates/admin/repo_groups/repo_group_edit.html	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/templates/admin/repo_groups/repo_group_edit.html	Thu Jul 23 00:52:29 2015 +0200
@@ -18,7 +18,7 @@
 <%def name="breadcrumbs_side_links()">
     <ul class="links">
       <li>
-          <a href="${h.url('new_repos_group', parent_group=c.repo_group.group_id)}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_(u'Add Child Group')}</a>
+          <a href="${h.url('new_repos_group', parent_group=c.repo_group.group_id)}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_('Add Child Group')}</a>
       </li>
     </ul>
 </%def>
--- a/kallithea/templates/admin/repo_groups/repo_group_show.html	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/templates/admin/repo_groups/repo_group_show.html	Thu Jul 23 00:52:29 2015 +0200
@@ -6,7 +6,7 @@
 
 <%def name="breadcrumbs()">
     <span class="groups_breadcrumbs">
-    ${h.link_to(_(u'Home'),h.url('/'))}
+    ${h.link_to(_('Home'),h.url('/'))}
     %if c.group.parent_group:
         &raquo; ${h.link_to(c.group.parent_group.name,h.url('repos_group_home',group_name=c.group.parent_group.group_name))}
     %endif
--- a/kallithea/templates/admin/repo_groups/repo_groups.html	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/templates/admin/repo_groups/repo_groups.html	Thu Jul 23 00:52:29 2015 +0200
@@ -23,7 +23,7 @@
         <ul class="links">
             %if h.HasPermissionAny('hg.admin')():
              <li>
-               <a href="${h.url('new_repos_group')}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_(u'Add Repository Group')}</a>
+               <a href="${h.url('new_repos_group')}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_('Add Repository Group')}</a>
              </li>
             %endif
         </ul>
--- a/kallithea/templates/admin/repos/repos.html	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/templates/admin/repos/repos.html	Thu Jul 23 00:52:29 2015 +0200
@@ -19,7 +19,7 @@
         <ul class="links">
          %if h.HasPermissionAny('hg.admin','hg.create.repository')():
           <li>
-            <a href="${h.url('new_repo')}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_(u'Add Repository')}</a>
+            <a href="${h.url('new_repo')}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_('Add Repository')}</a>
           </li>
          %endif
         </ul>
--- a/kallithea/templates/admin/user_groups/user_groups.html	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/templates/admin/user_groups/user_groups.html	Thu Jul 23 00:52:29 2015 +0200
@@ -22,7 +22,7 @@
         <ul class="links">
         %if h.HasPermissionAny('hg.admin', 'hg.usergroup.create.true')():
           <li>
-            <a href="${h.url('new_users_group')}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_(u'Add User Group')}</a>
+            <a href="${h.url('new_users_group')}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_('Add User Group')}</a>
           </li>
         %endif
         </ul>
--- a/kallithea/templates/admin/users/users.html	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/templates/admin/users/users.html	Thu Jul 23 00:52:29 2015 +0200
@@ -21,7 +21,7 @@
         ${self.breadcrumbs()}
         <ul class="links">
           <li>
-            <a href="${h.url('new_user')}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_(u'Add User')}</a>
+            <a href="${h.url('new_user')}" class="btn btn-small btn-success"><i class="icon-plus"></i> ${_('Add User')}</a>
           </li>
         </ul>
     </div>
--- a/kallithea/templates/base/base.html	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/templates/base/base.html	Thu Jul 23 00:52:29 2015 +0200
@@ -128,7 +128,7 @@
       </h2>
       <!--
       <div id="breadcrumbs">
-        ${h.link_to(_(u'Repositories'),h.url('home'))}
+        ${h.link_to(_('Repositories'),h.url('home'))}
         &raquo;
         ${h.repo_link(c.db_repo.groups_and_repo)}
       </div>
@@ -347,10 +347,10 @@
             <div class="links_right">
             <ol class="links">
               <li><a href="${h.url('notifications')}">${_('Notifications')}: ${c.unread_notifications}</a></li>
-              <li>${h.link_to(_(u'My Account'),h.url('my_account'))}</li>
+              <li>${h.link_to(_('My Account'),h.url('my_account'))}</li>
               %if not c.authuser.is_external_auth:
                 ## Cannot log out if using external (container) authentication.
-                <li class="logout">${h.link_to(_(u'Log Out'), h.url('logout_home'))}</li>
+                <li class="logout">${h.link_to(_('Log Out'), h.url('logout_home'))}</li>
               %endif
             </ol>
             </div>
--- a/kallithea/templates/index_base.html	Thu Jul 23 00:52:29 2015 +0200
+++ b/kallithea/templates/index_base.html	Thu Jul 23 00:52:29 2015 +0200
@@ -19,12 +19,12 @@
                   %if c.group:
                         <a href="${h.url('new_repo',parent_group=c.group.group_id)}" class="btn btn-small"><i class="icon-plus"></i> ${_('Add Repository')}</a>
                         %if h.HasPermissionAny('hg.admin')() or h.HasRepoGroupPermissionAny('group.admin')(c.group.group_name):
-                            <a href="${h.url('new_repos_group', parent_group=c.group.group_id)}" class="btn btn-small"><i class="icon-plus"></i> ${_(u'Add Repository Group')}</a>
+                            <a href="${h.url('new_repos_group', parent_group=c.group.group_id)}" class="btn btn-small"><i class="icon-plus"></i> ${_('Add Repository Group')}</a>
                         %endif
                   %else:
                     <a href="${h.url('new_repo')}" class="btn btn-small"><i class="icon-plus"></i> ${_('Add Repository')}</a>
                     %if h.HasPermissionAny('hg.admin')():
-                        <a href="${h.url('new_repos_group')}" class="btn btn-small"><i class="icon-plus"></i> ${_(u'Add Repository Group')}</a>
+                        <a href="${h.url('new_repos_group')}" class="btn btn-small"><i class="icon-plus"></i> ${_('Add Repository Group')}</a>
                     %endif
                   %endif
                 %endif