transifex-webhook/app/transifex_demo.py

16 lines
550 B
Python
Raw Normal View History

2022-12-14 08:33:48 +01:00
"""Transifex basic implementation using python native sdk """
import os
from transifex.native import init, tx
from transifex.native.parsing import SourceString
token = os.getenv('token')
secret = os.getenv('secret')
print("token value",token)
init(token=token, languages=['el', 'fr', 'en'], secret=secret)
# Add some strings to push
strings = [SourceString('My Addresses')]
response_content = tx.push_source_strings(strings)
tx.fetch_translations()
el_translation = tx.translate('My Addresses', 'fr')
print("here is the translation",el_translation)