private static void getTranslator(final String lng, final Consumer<Translator> consumer) {
        final String targetLng = TranslateLanguage.fromLanguageTag(Settings.getTranslationTargetLanguage().getCode());
        if (null == targetLng) {
            return;
        }
        final TranslatorOptions options = new TranslatorOptions.Builder()
                .setSourceLanguage(lng)
                .setTargetLanguage(targetLng)
                .build();

        final Translator translator = Translation.getClient(options);

        translator.downloadModelIfNeeded(new DownloadConditions.Builder().build())
                .addOnSuccessListener(b -> consumer.accept(translator))
                .addOnFailureListener(e -> {
                    Log.e("Failed to initialize MLKit Translator", e);
                    consumer.accept(null);
                });
    }
Utility method to get a Translator object that can be used to perform offline translation
@param activity      the calling activity
@param sourceLng     language to translate from
@param unsupportedLngConsumer    returned if the sourceLng is not supported
@param downloadingModelConsumer  returned if language models need to be downloaded, should be used to show a progress UI to the user
@param translatorConsumer        returns the translator object
main/src/main/java/cgeo/geocaching/utils/OfflineTranslateUtils.java