Package com.transifex.common
Class TranslationsDownloader
java.lang.Object
com.transifex.common.TranslationsDownloader
A class that makes use of
CDSHandler
to fetch translations from the CDS and save them
to files.-
Constructor Summary
-
Method Summary
-
Constructor Details
-
TranslationsDownloader
-
-
Method Details
-
downloadTranslations
@NonNull public HashMap<String,File> downloadTranslations(@Nullable String localeCode, @Nullable Set<String> tags, @NonNull File directory, @NonNull String filename) Fetches translations from CDS and saves them to files.For each locale, a subdirectory under the provided directory is created and a file containing the translations is created. Note that the provided directory should already exist. If a translation file already exists, it's overwritten.
- Parameters:
localeCode
- An optional locale to fetch translations from; if set tonull
, it will fetch translations for the locale codes configured in theCDSHandler
instance provided in the constructor.tags
- An optional set of tags. If defined, only strings that have all of the given tags will be fetched.directory
- The directory on which to save the translations. The directory should already exist.filename
- The name of the translation file for a locale.- Returns:
- A key-value map where each locale code points to the downloaded file containing the translations. If an error occurs, some or all locale codes will be missing from the map.
-