Class TxDiskTranslationsProvider

java.lang.Object
com.transifex.txnative.cache.TxDiskTranslationsProvider
All Implemented Interfaces:
TxTranslationsProvider

public class TxDiskTranslationsProvider extends Object implements TxTranslationsProvider
Translations provider that loads translations from disk or the application's raw asset files depending on the constructor used.

The directory should contain the translations in the format detailed in TranslationMapStorage.

If an error occurs during initialization, getTranslations() will return null.

  • Field Details

    • TAG

      public static final String TAG
  • Constructor Details

    • TxDiskTranslationsProvider

      public TxDiskTranslationsProvider(@NonNull File srcDirectory)
      Initializes the provider with a file directory containing translations and loads them synchronously.
      Parameters:
      srcDirectory - The directory containing translations in the expected format.
    • TxDiskTranslationsProvider

      public TxDiskTranslationsProvider(@NonNull AssetManager manager, @NonNull String srcDirectoryPath)
      Initializes the provider with a directory under the application's raw asset files and loads the translations synchronously.
      Parameters:
      manager - An asset manager instance.
      srcDirectoryPath - The path to the directory containing translations in the expected format.
  • Method Details