This is a Python wrapper for the Transfluent API.
Installation
$ pip install transfluent
Usage
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'])
Resources
Changelog
Here you can see the full list of changes between each Transfluent for Python release.
0.3.0 (February 10, 2016)
Added Python 3 support.
0.2.1 (May 29, 2013)
Fixed a bug in how texts_translate handled target_languages parameter.
0.2.0 (May 29, 2013)
Implemented Python wrappers for Texts and TextsTranslate methods in Transfluent’s API
0.1.0 (April 22, 2013)
Initial public release.
Release files for transfluent 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| transfluent-0.3.0.tar.gz | 7.5 kB | Details |
Release files / transfluent-0.3.0.tar.gz
| Download URL | transfluent-0.3.0.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc916e1528fd0a9885416abb225581ea205fef70a25961bb899b9d31aa37a0e8
|
|
BLAKE2b-256 checksum How to use checksums |
a5457f9f23e191ffc46d6de780837ad3a570b64b11b9780073f44bc6070e92dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |