Package com.transifex.txnative.cache
Interface TxCache
-
- All Known Implementing Classes:
TxDecoratorCache
,TxFileOutputCacheDecorator
,TxMemoryCache
,TxProviderBasedCache
,TxReadonlyCacheDecorator
,TxUpdateFilterCache
public interface TxCache
An interface for classes that act as cache for translations.
-
-
Method Summary
Modifier and Type Method Description LocaleData.TranslationMap
get()
Gets all translations from the cache in the form of aTranslationMap
object.String
get(String key, String locale)
Get the translation for a certain key and locale pair.void
update(LocaleData.TranslationMap translationMap)
Update the cache with the providedTranslationMap
.
-
-
-
Method Detail
-
get
@NonNull LocaleData.TranslationMap get()
Gets all translations from the cache in the form of aTranslationMap
object.The returned object should not be altered as the cache may use it internally.
-
get
@Nullable String get(@NonNull String key, @NonNull String locale)
Get the translation for a certain key and locale pair.- Parameters:
key
- The key of the string.locale
- The locale code.- Returns:
- The string if the key was found in the cache;
null
if the provided locale does not exist in the cache or the key does not exist for this locale; empty string if the string has not yet been translated for this locale
-
update
void update(@NonNull LocaleData.TranslationMap translationMap)
Update the cache with the providedTranslationMap
.The translation map should not be changed after providing it to the cache, because the cache implementation may use it without making a copy.
-
-