Skip to content

Custom Translations

Max Weber edited this page Apr 13, 2021 · 6 revisions

With the release of 2.0.0 of the Trufi Core, we have a new possibility to integrate custom translations into the Trufi Core.

You will need to pass into the TrufiConfiguration Singleton a custom translation with your translations that you want. This is currently available for title, tagline, description, aboutContent.

Example

void setupTrotroTranslations(TrufiConfiguration config) {
  config.customTranslations
    ..title = {
      // LangKey is possible
      Locale("de"): "Trotro App",
      // LangKey and CountryKey is possible
      Locale("en", "US"): "Trotro App",
      Locale("es"): "Trotro App",
      Locale("fr"): "Trotro App",
      Locale("it"): "Trotro App",
      Locale("qu"): "Trotro App",
    };
}

Fallback Strategy

There is always a fallback strategy. That being said, it means that if you have set your application with a Locale with language Key and Country Key and it cannot find the CountryKey, it will fall back to the Language Key only version. If this one does not exist, it will fall back to the Trufi App default translation.

customTranslation Language + Country Key > customTranslation with LanguageKey > Default Translation

Contribute

If you need more specific overwrites, feel free to create an issue here. Or clone the Trufi Core Repository to change the translations directly.

Trufi Logo

Table of Content

Clone this wiki locally