This document holds information about Transifex translation system implementation into Superset's frontend application.
In order to consider of using Transifex service for translation purposes, following stuff is required:
- Transifex account, make sure you have created native token and secret credentials for your Transifex project: https://developers.transifex.com/docs/managing-a-transifex-native-project#generating-native-credentials
- Enable Superset's
i18n
feature with adding desired languages to LANGUAGES variable inside config.py configuration file. For example:LANGUAGES = { "en": {"flag": "us", "name": "English"}, "fr_CH": {"flag": "fr", "name": "French (Switzerland)"}, "de_CH": {"flag": "de", "name": "German (Switzerland)"}, "it_CH": {"flag": "it", "name": "Italian (Switzerland)"}, }
Feature can be enabled via config.py TRANSIFEX
variable:
TRANSIFEX = {
"enabled": True,
"key_prefix": "bi.superset",
"token": "1/2477acc125008cc20d1cb4558f2c17acae2e0f73",
"secret": "1/c5aa6411e2dc05001c21c91453c3f79c2b5d3a8f",
}
enabled
- If set toFalse
, Transifex feature along with translation field elements are not loaded.key_prefix
- The first part of translation key that is submitted to Transifex, for examplebi.superset.field_prefix.field_name
.token
andsecret
- Generated native credentials that are using for load of translations and submit of strings.
The core of implementation is Translatable field which is placed inside form as field whose value can be optionally sent to Transifex and translated for it's interface:
Every translatable field consist of:
Field
:input
andtextarea
are currently supported asfieldType
propertyTranslation key prefix
: second part of prefix that comes afterkey_prefix
described in Configuration. For example:bi.superset.102.field_name
. By default this value is passedslice.id
but can be manually changed to desirable value. Submitted field prefix is stored to charts'sparams
field as key: value pair with field name as key, and entered prefix as value so it is be transferable to future versions of the same chart.Preview
: Placeholder with rendered translation for inserted field value, by default, for currently selected locale. Preview can display translation for other languages if language is switched withTranslation preview
select box.
Following dynamic fields are enabled for translation:
- Chart
- Name
- Description