Transfluent API的Python封装
项目描述
这是Transfluent API的Python封装。
安装
$ pip install transfluent
用法
import transfluent
# Initialize the Transfluent client and retrieve your authentication
# token by using your email and password.
client = transfluent.Transfluent()
client.authenticate(email='example@example.org', password='my-password')
# Alternatively, you may initialize the Transfluent client directly
# with your authentication token.
client = transfluent.Transfluent(token='my-token')
# Order translations for a resource file.
response = client.file_save(
identifier='my-project/messages',
language=1,
file=open('translations/messages.pot'),
type='po-file'
)
print "The file contains {0} words.".format(response['word_count'])
response = client.file_translate(
identifier='my-project/messages',
language=1,
target_languages=[11],
)
print "{0} words were ordered.".format(response['word_count'])
# Check if the translation for the resource file is complete.
is_translated = client.is_file_complete(
identifier='my-project/messages',
language=11
)
if is_translated:
# Retrieve the translated resource file.
content = client.file_read(
identifier='my-project/messages',
language=11
)
with open('translations/en/LC_MESSAGES/messages.po', 'w') as out:
out.write(content)
else:
# Check the precise translation progress for the resource file.
status = client.file_status(
identifier='my-project/messages',
language=11
)
print "Translation is {0} complete.".format(status['progress'])
资源
变更日志
在这里您可以查看每个Transfluent for Python发布之间的全部更改列表。
0.3.0(2016年2月10日)
添加了对Python 3的支持。
0.2.1(2013年5月29日)
修复了如何处理target_languages参数的bug。
0.2.0(2013年5月29日)
实现了Transfluent API中Texts和TextsTranslate方法的Python封装
0.1.0(2013年4月22日)
首次公开发布。
项目详情
关闭
transfluent-0.3.0.tar.gz的散列
算法 | 哈希摘要 | |
---|---|---|
SHA256 | dc916e1528fd0a9885416abb225581ea205fef70a25961bb899b9d31aa37a0e8 |
|
MD5 | 7f2d0d3f70def649474eab428cbee1e1 |
|
BLAKE2b-256 | a5457f9f23e191ffc46d6de780837ad3a570b64b11b9780073f44bc6070e92dd |