Package com.transifex.txnative.cache
Class TxDiskTranslationsProvider
java.lang.Object
com.transifex.txnative.cache.TxDiskTranslationsProvider
- All Implemented Interfaces:
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 Summary
-
Constructor Summary
ConstructorDescriptionTxDiskTranslationsProvider
(AssetManager manager, String srcDirectoryPath) Initializes the provider with a directory under the application's raw asset files and loads the translations synchronously.TxDiskTranslationsProvider
(File srcDirectory) Initializes the provider with a file directory containing translations and loads them synchronously. -
Method Summary
Modifier and TypeMethodDescriptionReturns the translations from the provider.
-
Field Details
-
TAG
-
-
Constructor Details
-
TxDiskTranslationsProvider
Initializes the provider with a file directory containing translations and loads them synchronously.- Parameters:
srcDirectory
- The directory containing translations in the expected format.
-
TxDiskTranslationsProvider
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
-
getTranslations
Description copied from interface:TxTranslationsProvider
Returns the translations from the provider.- Specified by:
getTranslations
in interfaceTxTranslationsProvider
- Returns:
- A
LocaleData.TranslationMap
object ornull
if an error occurred. The returned map can be empty if an error occurred.
-