Transifex

  • Documentation
  • Django SDK
  • Error Handling

Error Handling

Note

Transifex Native is currently in BETA. To learn more about the solution as well as to have a hands on experience please get in touch with us.

The Transifex Native SDK solution protects the application from errors caused during rendering. All options are safe-guarding an uninterrupted experience, securing your application from errors introduced by globalization process or unspecified rendering errors, like:

  • Missing variables (variables that exist in the translation but their value is not provided)
  • Malformed ICU messages (those would break the rendering of the ICU message)

Error handling is always applied, by checking the string to be rendered. If an error is found and the rendering of that translation string fails, an error policy is invoked, which defines what to render instead.

By default, the SourceStringErrorPolicy is implemented, which tries to render the source string. If this also fails, a default text is rendered instead.

The default text is configured by setting the TRANSIFEX_ERROR_POLICY setting. An example of setting a different default text would be configuring the setting as such:

TRANSIFEX_ERROR_POLICY = (
    'transifex.native.rendering.SourceStringErrorPolicy',
    {'default_text': 'some_custom_text'},
)

Custom Error Policies

You can implement your own error policies. These are some hints to follow during implementation:

  • The interface can mimic the one described in AbstractErrorPolicy, and it is suggested to subclass this for your implementation.
  • The structure and configuration options of error policies mimic the way missing translation policies are implemented.