From e3428604d0f1f927473ee487d2fff57c5dd01cf5 Mon Sep 17 00:00:00 2001 From: Johannes Bornhold Date: Fri, 27 May 2016 12:15:09 +0200 Subject: [PATCH] i18n: Use new translation string factory. - Use the translation factory create in rhodecode.translation instead of creating multiple instances in each module. --- rhodecode/authentication/routes.py | 3 +-- rhodecode/authentication/schema.py | 4 +--- rhodecode/authentication/views.py | 4 +--- rhodecode/login/views.py | 6 +----- rhodecode/subscribers.py | 5 +++-- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/rhodecode/authentication/routes.py b/rhodecode/authentication/routes.py index b307be10..95afe354 100644 --- a/rhodecode/authentication/routes.py +++ b/rhodecode/authentication/routes.py @@ -21,12 +21,11 @@ import logging from pyramid.exceptions import ConfigurationError -from pyramid.i18n import TranslationStringFactory from rhodecode.lib.utils2 import safe_str from rhodecode.model.settings import SettingsModel +from rhodecode.translation import _ -_ = TranslationStringFactory('rhodecode-enterprise') log = logging.getLogger(__name__) diff --git a/rhodecode/authentication/schema.py b/rhodecode/authentication/schema.py index 896cc254..982350d2 100644 --- a/rhodecode/authentication/schema.py +++ b/rhodecode/authentication/schema.py @@ -20,9 +20,7 @@ import colander -from pyramid.i18n import TranslationStringFactory - -_ = TranslationStringFactory('rhodecode-enterprise') +from rhodecode.translation import _ class AuthnPluginSettingsSchemaBase(colander.MappingSchema): diff --git a/rhodecode/authentication/views.py b/rhodecode/authentication/views.py index ea4ddb84..f973b777 100644 --- a/rhodecode/authentication/views.py +++ b/rhodecode/authentication/views.py @@ -23,7 +23,6 @@ import formencode.htmlfill import logging from pyramid.httpexceptions import HTTPFound -from pyramid.i18n import TranslationStringFactory from pyramid.renderers import render from pyramid.response import Response @@ -34,11 +33,10 @@ from rhodecode.lib.auth import LoginRequired, HasPermissionAllDecorator from rhodecode.model.forms import AuthSettingsForm from rhodecode.model.meta import Session from rhodecode.model.settings import SettingsModel +from rhodecode.translation import _ log = logging.getLogger(__name__) -_ = TranslationStringFactory('rhodecode-enterprise') - class AuthnPluginViewBase(object): diff --git a/rhodecode/login/views.py b/rhodecode/login/views.py index 8e0d0e9b..28142ef5 100644 --- a/rhodecode/login/views.py +++ b/rhodecode/login/views.py @@ -22,15 +22,12 @@ import datetime import formencode import logging import urlparse -import uuid from pylons import url from pyramid.httpexceptions import HTTPFound -from pyramid.i18n import TranslationStringFactory from pyramid.view import view_config from recaptcha.client.captcha import submit -from rhodecode.authentication.base import loadplugin from rhodecode.events import UserRegistered from rhodecode.lib.auth import ( AuthUser, HasPermissionAnyDecorator, CSRFRequired) @@ -43,10 +40,9 @@ from rhodecode.model.login_session import LoginSession from rhodecode.model.meta import Session from rhodecode.model.settings import SettingsModel from rhodecode.model.user import UserModel +from rhodecode.translation import _ -_ = TranslationStringFactory('rhodecode-enterprise') - log = logging.getLogger(__name__) diff --git a/rhodecode/subscribers.py b/rhodecode/subscribers.py index 6ba40063..0b7a258a 100644 --- a/rhodecode/subscribers.py +++ b/rhodecode/subscribers.py @@ -20,10 +20,11 @@ import pylons -from pyramid.i18n import get_localizer, TranslationStringFactory + +from pyramid.i18n import get_localizer from pyramid.threadlocal import get_current_request -tsf = TranslationStringFactory('rc_root') +from rhodecode.translation import _ as tsf def add_renderer_globals(event):