# HG changeset patch # User Marcin Kuzminski # Date 2017-07-13 08:58:58 # Node ID 5935998893d209e89c4bf8bc7ad490b40b012cfd # Parent edd50f390049328db5eb742254cfc550d929c4ff pyramid: stop relying on pylons translation object in helpers. We'll now use the registered translation function from request. diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -48,7 +48,7 @@ from pygments.formatters.html import Htm from pygments import highlight as code_highlight from pygments.lexers import ( get_lexer_by_name, get_lexer_for_filename, get_lexer_for_mimetype) -from pylons.i18n.translation import _, ungettext + from pyramid.threadlocal import get_current_request from webhelpers.html import literal, HTML, escape @@ -1517,24 +1517,6 @@ class RepoPage(Page): list.__init__(self, reversed(self.items)) -def changed_tooltip(nodes): - """ - Generates a html string for changed nodes in commit page. - It limits the output to 30 entries - - :param nodes: LazyNodesGenerator - """ - if nodes: - pref = ':
' - suf = '' - if len(nodes) > 30: - suf = '
' + _(' and %s more') % (len(nodes) - 30) - return literal(pref + '
'.join([safe_unicode(x.path) - for x in nodes[:30]]) + suf) - else: - return ': ' + _('No Files') - - def breadcrumb_repo_link(repo): """ Makes a breadcrumbs path link to repo @@ -1836,7 +1818,9 @@ def get_permission_name(key): return dict(Permission.PERMS).get(key) -def journal_filter_help(): +def journal_filter_help(request): + _ = request.translate + return _( 'Example filter terms:\n' + ' repository:vcs\n' + @@ -1857,7 +1841,8 @@ def journal_filter_help(): ) -def search_filter_help(searcher): +def search_filter_help(searcher, request): + _ = request.translate terms = '' return _( @@ -1876,6 +1861,7 @@ def search_filter_help(searcher): def not_mapped_error(repo_name): + from rhodecode.translation import _ flash(_('%s repository is not mapped to db perhaps' ' it was created or renamed from the filesystem' ' please run the application again' diff --git a/rhodecode/templates/admin/admin_audit_logs.mako b/rhodecode/templates/admin/admin_audit_logs.mako --- a/rhodecode/templates/admin/admin_audit_logs.mako +++ b/rhodecode/templates/admin/admin_audit_logs.mako @@ -14,7 +14,7 @@ ${_('Audit logs')} - ${_ungettext('%s entry', '%s entries', c.audit_logs.item_count) % (c.audit_logs.item_count)} ${h.end_form()} -

${_('Example Queries')}

+

${_('Example Queries')}

<%def name="menu_bar_nav()"> diff --git a/rhodecode/templates/admin/users/user_edit_audit.mako b/rhodecode/templates/admin/users/user_edit_audit.mako --- a/rhodecode/templates/admin/users/user_edit_audit.mako +++ b/rhodecode/templates/admin/users/user_edit_audit.mako @@ -14,7 +14,7 @@ ${h.end_form()} -

${_('Example Queries')}

+

${_('Example Queries')}

<%include file="/admin/admin_log_base.mako" /> diff --git a/rhodecode/templates/journal/journal.mako b/rhodecode/templates/journal/journal.mako --- a/rhodecode/templates/journal/journal.mako +++ b/rhodecode/templates/journal/journal.mako @@ -14,7 +14,7 @@ ${_('Journal')} - ${ungettext('%s entry', '%s entries', c.journal_pager.item_count) % (c.journal_pager.item_count)} ${h.end_form()} -

${_('Example Queries')}

+

${_('Example Queries')}

<%def name="menu_bar_nav()"> ${self.menu_items(active='journal')} diff --git a/rhodecode/templates/search/search.mako b/rhodecode/templates/search/search.mako --- a/rhodecode/templates/search/search.mako +++ b/rhodecode/templates/search/search.mako @@ -74,7 +74,7 @@ % endfor

${_('Example Queries')}

- +
${c.runtime}