Skip to content
Browse files

test that folder default page is current language translation of set

default page
  • Loading branch information...
1 parent a178ce2 commit 4d22e82abb8717520ea8c980f2683d5d471ddff8 @tdesvenain tdesvenain committed
View
3 CHANGES.txt
@@ -4,7 +4,8 @@ Changelog
4.1.2 (unreleased)
------------------
-- Display the translation of the folder default page in the current language.
+- Display the translation of the folder default page in the current language
+ when the folder is not translated.
[thomasdesvenain]
View
9 Products/LinguaPlone/skins/LinguaPlone/changeLanguage.cpy
@@ -2,6 +2,7 @@
##title=
from Products.CMFPlone.utils import transaction_note
+from Products.CMFPlone import PloneMessageFactory as _
REQUEST = context.REQUEST
context.setLanguage(language)
@@ -9,10 +10,10 @@ if not language:
language = context.translate(msgid='label_neutral',
default='Neutral',
domain='linguaplone')
-message = context.translate(msgid='message_content_changed_language_to',
- default='Changed content language to ${language}.',
- mapping={'language': language},
- domain='linguaplone')
+message = _('message_content_changed_language_to',
+ default='Changed content language to ${language}.',
+ mapping={'language': language},
+ domain='linguaplone')
transaction_note(message)
context.plone_utils.addPortalMessage(message)
return state.set()
View
6 Products/LinguaPlone/tests/base.py
@@ -3,6 +3,8 @@
# Make sure the dummy types are registered
from Products.LinguaPlone.tests import dummy
+from Products.LinguaPlone.interfaces import ILinguaPloneProductLayer
+from zope.interface.declarations import alsoProvides
dummy # pyflakes
from Products.Five import zcml
@@ -39,6 +41,10 @@ def setup_product():
class LinguaPloneTestCase(PloneTestCase.PloneTestCase):
+ def _setup(self):
+ super(LinguaPloneTestCase, self)._setup()
+ alsoProvides(self.portal.REQUEST, ILinguaPloneProductLayer)
+
def addLanguage(self, language):
self.portal.portal_languages.addSupportedLanguage(language)
View
6 Products/LinguaPlone/tests/test_defaultpage.py
@@ -27,7 +27,7 @@ def testGermanAsDefault(self):
self.setLanguage('de')
self.folder.setDefaultPage(self.english.getId())
result = self.folder.getDefaultPage()
- self.failUnlessEqual(result, self.english.getId())
+ self.failUnlessEqual(result, self.german.getId())
def testInvalidAsDefault(self):
self.folder.setDefaultPage('pt')
@@ -72,7 +72,7 @@ def testGermanAsDefault(self):
self.setLanguage('de')
self.portal.setDefaultPage(self.english.getId())
result = self.portal.getDefaultPage()
- self.failUnlessEqual(result, self.english.getId())
+ self.failUnlessEqual(result, self.german.getId())
def testInvalidAsDefault(self):
self.folder.setDefaultPage('pt')
@@ -102,7 +102,7 @@ def testGermanAsDefault(self):
self.setLanguage('de')
self.folder.setDefaultPage(self.english.getId())
result = self.folder.getDefaultPage()
- self.failUnlessEqual(result, self.english.getId())
+ self.failUnlessEqual(result, self.german.getId())
def testInvalidAsDefault(self):
self.folder.setDefaultPage('pt')

0 comments on commit 4d22e82

Please sign in to comment.
Something went wrong with that request. Please try again.