Transifex

  • Documentation
  • Javascript SDK
  • Missing Translations

Missing Translations

Note

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

If a translation on a specific locale is missing, by default Transifex Native will return the string in the source language. However, you can change that behaviour by providing a different missing policy or implement a custom one.

Source String

This is the default policy, where the source string will appear when a translation is missing.

import { tx, SourceStringPolicy } from '@transifex/native';

tx.init({
  missingPolicy: new SourceStringPolicy(),
});

Pseudo Translation

This is a nice way to do translation QA during development, as pseudo-translated strings stand out and are easy to identify.

import { tx, PseudoTranslationPolicy } from '@transifex/native';

tx.init({
  missingPolicy: new PseudoTranslationPolicy(),
});

Custom Policy

You can implement custom missing policies by creating a policy class based on the example below.

import { tx } from '@transifex/native';

class CustomMissingPolicy {
  handle(sourceString, localeCode) {
    const output = sourceString;
    // do something with the string
    // ....
    return output;
  }
}

tx.init({
  missingPolicy: new CustomMissingPolicy();
});