About Transifex

Transifex enables powerful localization across your user base, no matter what the language is. Transifex and Braze’s Connected Content feature empower you to automate translation so your teams are freed up to focus on delivering brilliant customer experiences.

Pre-Requisites

Requirement Origin Access Description
Transifex Account Transifex https://www.transifex.com/signin/ You must first have a Transifex account to access their SDK integration information.

Set up basic authentication for your account in the Connected Content tab in Manage App Group.

Basic Authentication Credential Management

Click New Credential. You can then name your credential and put in your username and password for that account.

Basic Authentication Credential Creation

You can then use this basic authentication credential for calls to Transifex.

SDK Integration

This integration will allow you to type in a source string instead of copying and pasting the translation for every language into the message composer.

The code for our Transifex integration was built using Transifex’s translation strings API.

The following CURL will allow you to see if your Transifex account has context values associated with translations:

1
curl -i -L --user username:password -X GET https://www.transifex.com/api/2/project/<project_name>/resource/<resource_name>/translation/en/strings

Input the project and resource name into CURL. You can find these values in the URL of your Transifex account.

Transifex_account

An example response with a blank context field is pictured below:

terminal_response

Transifex Integration Code Example

Here is example code which utilizes the Transifex Strings API and the user’s “language” attribute.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{% assign key = "<Insert Key Here>" %}
{% assign context = "<Insert Context Here>" %}
{% assign source_string = key | append: ':' | append: context %}
{% assign project = "<Insert Project Name Here>" %}
{% assign resource = "<Insert Resource Name Here" %}
{% assign source_hash = source_string | md5 %}

{% if {{${language}}} == "en" or {{${language}}} == "it" or {{${language}}} == "de" or {{${language}}} == "another_language_you_support"  %}
{% connected_content https://www.transifex.com/api/2/project/{{project}}/resource/{{resource}}/translation/{{${language}}}/string/{{source_hash}}/ :basic_auth <Insert Basic Auth Credential Name Here> :save strings %}
{% endif %}

{% if {{strings}} != null and {{strings.translation}} != "" and {{${language}}} != null %}
  {{strings.translation}}
{% else %}
  {% abort_message('null or blank') %}
{% endif %}

You can also leverage the user’s {{${most_recent_locale}}} if you want to include a variation based upon a user’s specific version of a language such as zh_CN or pt_BR.

WAS THIS PAGE HELPFUL?
New Stuff!