Skip to main content

A Python wrapper for Transfluent API

Project description

Build Status

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.1.0 (April 22, 2013)

  • Initial public release.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

transfluent-0.1.0.tar.gz (5.8 kB view details)

Uploaded Source

File details

Details for the file transfluent-0.1.0.tar.gz.

File metadata

  • Download URL: transfluent-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for transfluent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bf229e1de45ddfa5f64c353ed5c39f060790531808af18a034d7cea0df21a368
MD5 672a94032e47dd32827d5cce2d8d6715
BLAKE2b-256 0aa870181c80c839cefa58dd272049f91138116186049d6b5bd0ef93125b03a0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page