示例#1
0
 def test_translation(self):
     # print microsoft_translate(u'English', 'en', 'es')
     # print type(microsoft_translate(u'Español', 'es', 'en'))
     # assert microsoft_translate(u'English', 'en', 'es') == u'Inglés'
     # assert microsoft_translate(u'Español', 'es', 'en') == u'Spanish'
     assert microsoft_translate(u'English', 'en', 'es') == 'Inglés'
     assert microsoft_translate(u'Español', 'es', 'en') == 'Spanish'
示例#2
0
#
#
# # get all users in reverse alphabetical order
# print models.User.query.order_by('nickname desc').all()

# from app.models import Post
# from app import db
# for post in Post.query.all():
#    db.session.delete(post)
# db.session.commit()

# from flask.ext.mail import Message
# from app import app, mail
# from config import ADMINS
# msg = Message('test subject', sender=ADMINS[0], recipients=ADMINS)
# msg.body = 'text body'
# msg.html = '<b>HTML</b> body'
#
#
# def send_async_email(msg):
#     with app.app_context():
#         print msg
#         mail.send(msg)
#
# thr = Thread(target=send_async_email(msg), args=app.app_context())
#

from app import translate

print translate.microsoft_translate('Hi, how are you?', 'en', 'he')
示例#3
0
 def test_translation(self):
     assert microsoft_translate(u'English', 'en', 'es') == u'Ingls'
     assert microsoft_translate(u'Español', 'es', 'en') == u'Spanish'
示例#4
0
 def test_translation(self):
     assert microsoft_translate(u'English', 'en', 'es') == u'\ufeff"Ingl\xe9s"'
     assert microsoft_translate(u'Español', 'es', 'en') == u'\ufeff"Spanish"'
示例#5
0
 def test_translation(self):
     assert microsoft_translate(u'English', 'en', 'es') == u'Inglés'
     assert microsoft_translate(u'Español', 'es', 'en') == u'Spanish'
示例#6
0
	def test_translation(self):

		assert microsoft_translate(u'English', 'en', 'es') == u'Inglés'
示例#7
0
def translate():
    return jsonify({
        'text':
        microsoft_translate(request.form['text'], request.form['sourceLang'],
                            request.form['destLang'])
    })
示例#8
0
 def test_translation(self):
     assert unicode(microsoft_translate('English', 'en', 'ru'),
                    "unicode-escape") == 'Английский'
     assert microsoft_translate('Español', 'es', 'en') == 'Spanish'
示例#9
0
 def test_translation(self):
     assert microsoft_translate(u'English', 'en', 'zh') == u'英语'
     assert microsoft_translate(u'中文', 'zh', 'en') == u'Chinese'
示例#10
0
#
#
# # get all users in reverse alphabetical order
# print models.User.query.order_by('nickname desc').all()

# from app.models import Post
# from app import db
# for post in Post.query.all():
#    db.session.delete(post)
# db.session.commit()


# from flask.ext.mail import Message
# from app import app, mail
# from config import ADMINS
# msg = Message('test subject', sender=ADMINS[0], recipients=ADMINS)
# msg.body = 'text body'
# msg.html = '<b>HTML</b> body'
#
#
# def send_async_email(msg):
#     with app.app_context():
#         print msg
#         mail.send(msg)
#
# thr = Thread(target=send_async_email(msg), args=app.app_context())
#

from app import translate
print translate.microsoft_translate('Hi, how are you?', 'en', 'he')
示例#11
0
文件: tests.py 项目: staeff/megaflask
 def test_translation(self):
     # This fails but does not give an error
     assert microsoft_translate(u'English', 'en', 'es') == u'Inglés'
     assert microsoft_translate(u'Español', 'es', 'en') == u'Spanish'
     assert microsoft_translate(u'Deutsch', 'de', 'en') == u'German'
     assert microsoft_translate(u'English', 'en', 'de') == u'Englisch'
示例#12
0
def translate():
    return jsonify({
        'text': microsoft_translate(
            request.form['text'],
            request.form['sourceLang'],
            request.form['destLang']) })
示例#13
0
 def test_translation(self):
     assert microsoft_translate(u'English', 'en',
                                'es') == u'\ufeff"Ingl\xe9s"'
     assert microsoft_translate(u'Español', 'es',
                                'en') == u'\ufeff"Spanish"'
示例#14
0
 def test_translation(self):
     assert microsoft_translate(u'English', 'en', 'fr') == u'Anglais'
     assert microsoft_translate(u'Français', 'fr', 'en') == u'French'
示例#15
0
文件: tests.py 项目: ghjan/blog
 def test_translation(self):
     assert microsoft_translate(u'English', 'en', 'zh') == u'英语'
     assert microsoft_translate(u'中文', 'zh', 'en') == u'Chinese'
示例#16
0
 def test_translation(self):
     assert microsoft_translate(u'Hi, how are you today?', 'en', 'es') == u'Hola, \xbfc\xf3mo est\xe1s hoy?'
     assert microsoft_translate(u'Español', 'es', 'en') == u'Spanish'
     assert microsoft_translate(u'Español', 'es', 'en') == u'Spanish'