Skip to content

Commit

Permalink
Remove Chameleon specific support in i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalresistor committed Sep 5, 2013
1 parent 5cbaf17 commit 1449c2f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
11 changes: 0 additions & 11 deletions pyramid/config/i18n.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import os
import sys

from translationstring import ChameleonTranslate

from pyramid.interfaces import (
IChameleonTranslate,
ILocaleNegotiator,
ITranslationDirectories,
)
Expand Down Expand Up @@ -108,14 +105,6 @@ def register():

tdirs.insert(0, directory)

if directories:
# We actually only need an IChameleonTranslate function
# utility to be registered zero or one times. We register the
# same function once for each added translation directory,
# which does too much work, but has the same effect.
ctranslate = ChameleonTranslate(translator)
self.registry.registerUtility(ctranslate, IChameleonTranslate)

self.action(None, register, introspectables=introspectables)

def translator(msg):
Expand Down
18 changes: 0 additions & 18 deletions pyramid/tests/test_config/test_i18n.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,10 @@ def test_add_translation_dirs_missing_dir(self):

def test_add_translation_dirs_no_specs(self):
from pyramid.interfaces import ITranslationDirectories
from pyramid.interfaces import IChameleonTranslate
config = self._makeOne()
config.add_translation_dirs()
self.assertEqual(config.registry.queryUtility(ITranslationDirectories),
None)
self.assertEqual(config.registry.queryUtility(IChameleonTranslate),
None)

def test_add_translation_dirs_asset_spec(self):
from pyramid.interfaces import ITranslationDirectories
Expand Down Expand Up @@ -83,21 +80,6 @@ def test_add_translation_dirs_multiple_specs_multiple_calls(self):
self.assertEqual(config.registry.getUtility(ITranslationDirectories),
[locale3, locale, locale2])

def test_add_translation_dirs_registers_chameleon_translate(self):
from pyramid.interfaces import IChameleonTranslate
from pyramid.threadlocal import manager
from pyramid.request import Request
config = self._makeOne(autocommit=True)
request = Request.blank('/')
request.registry = config.registry
manager.push({'request':request, 'registry':config.registry})
try:
config.add_translation_dirs('pyramid.tests.pkgs.localeapp:locale')
translate = config.registry.getUtility(IChameleonTranslate)
self.assertEqual(translate('Approve'), 'Approve')
finally:
manager.pop()

def test_add_translation_dirs_abspath(self):
from pyramid.interfaces import ITranslationDirectories
config = self._makeOne(autocommit=True)
Expand Down

0 comments on commit 1449c2f

Please sign in to comment.