本文整理匯總了Python中fjord.feedback.tests.ResponseFactory.generate_translation_jobs方法的典型用法代碼示例。如果您正苦於以下問題:Python ResponseFactory.generate_translation_jobs方法的具體用法?Python ResponseFactory.generate_translation_jobs怎麽用?Python ResponseFactory.generate_translation_jobs使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類fjord.feedback.tests.ResponseFactory
的用法示例。
在下文中一共展示了ResponseFactory.generate_translation_jobs方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_spanish_with_dennis_and_existing_translations
# 需要導入模塊: from fjord.feedback.tests import ResponseFactory [as 別名]
# 或者: from fjord.feedback.tests.ResponseFactory import generate_translation_jobs [as 別名]
def test_spanish_with_dennis_and_existing_translations(self):
"""Response should pick up existing translation"""
existing_resp = ResponseFactory(
locale=u'es',
product=u'firefox',
description=u'hola',
translated_description=u'DUDE!'
)
resp = ResponseFactory(
locale=u'es',
product=u'firefox',
description=u'hola',
translated_description=u''
)
# Set the product up for translation *after* creating the response
# so that it doesn't get auto-translated because Response is set up
# for auto-translation.
prod = Product.objects.get(db_name='firefox')
prod.translation_system = u'dennis'
prod.save()
# No jobs should be translated
eq_(len(resp.generate_translation_jobs()), 0)
eq_(resp.translated_description, existing_resp.translated_description)
示例2: test_spanish_no_translation
# 需要導入模塊: from fjord.feedback.tests import ResponseFactory [as 別名]
# 或者: from fjord.feedback.tests.ResponseFactory import generate_translation_jobs [as 別名]
def test_spanish_no_translation(self):
"""Spanish should not get translated"""
resp = ResponseFactory(
locale=u'es',
product=u'firefox',
description=u'hola',
translated_description=u''
)
# No jobs should be translated
eq_(len(resp.generate_translation_jobs()), 0)
# Nothing should be translated
eq_(resp.translated_description, u'')
示例3: test_english_gb_no_translation
# 需要導入模塊: from fjord.feedback.tests import ResponseFactory [as 別名]
# 或者: from fjord.feedback.tests.ResponseFactory import generate_translation_jobs [as 別名]
def test_english_gb_no_translation(self):
"""en-GB descriptions should get copied over"""
resp = ResponseFactory(
locale=u'en-GB',
description=u'hello',
translated_description=u''
)
# No new jobs should be generated
eq_(len(resp.generate_translation_jobs()), 0)
# Re-fetch from the db and make sure the description was copied over
resp = Response.objects.get(id=resp.id)
eq_(resp.description, resp.translated_description)
示例4: test_english_no_translation
# 需要導入模塊: from fjord.feedback.tests import ResponseFactory [as 別名]
# 或者: from fjord.feedback.tests.ResponseFactory import generate_translation_jobs [as 別名]
def test_english_no_translation(self):
"""English descriptions should get copied over"""
resp = ResponseFactory(
locale=u'en-US',
description=u'hello',
translated_description=u''
)
# No new jobs should be generated
assert len(resp.generate_translation_jobs()) == 0
# Re-fetch from the db and make sure the description was copied over
resp = Response.objects.get(id=resp.id)
assert resp.description == resp.translated_description
示例5: test_english_with_dennis
# 需要導入模塊: from fjord.feedback.tests import ResponseFactory [as 別名]
# 或者: from fjord.feedback.tests.ResponseFactory import generate_translation_jobs [as 別名]
def test_english_with_dennis(self):
"""English descriptions should get copied over"""
resp = ResponseFactory(
locale=u'en-US',
product=u'firefox',
description=u'hello',
translated_description=u''
)
# Set the product up for translation *after* creating the response
# so that it doesn't get auto-translated because Response is set up
# for auto-translation.
prod = Product.objects.get(db_name='firefox')
prod.translation_system = u'dennis'
prod.save()
# No new jobs should be generated
eq_(len(resp.generate_translation_jobs()), 0)
# Re-fetch from the db and make sure the description was copied over
resp = Response.objects.get(id=resp.id)
eq_(resp.description, resp.translated_description)
示例6: test_spanish_with_dennis
# 需要導入模塊: from fjord.feedback.tests import ResponseFactory [as 別名]
# 或者: from fjord.feedback.tests.ResponseFactory import generate_translation_jobs [as 別名]
def test_spanish_with_dennis(self):
"""Spanish should get translated"""
resp = ResponseFactory(
locale=u'es',
product=u'firefox',
description=u'hola',
translated_description=u''
)
# Set the product up for translation *after* creating the response
# so that it doesn't get auto-translated because Response is set up
# for auto-translation.
prod = Product.objects.get(db_name='firefox')
prod.translation_system = u'dennis'
prod.save()
# One job should be generated
jobs = resp.generate_translation_jobs()
eq_(len(jobs), 1)
job = jobs[0]
eq_(job[1:], (u'dennis', u'es', u'description',
u'en', 'translated_description'))
eq_(resp.translated_description, u'')