public static void initializeListingTranslatorInTabbedViewPagerActivity(final TabbedViewPagerActivity cda, final LinearLayout translationBox, final String translateText, final Runnable callback) {
        if (!OfflineTranslateUtils.isTargetLanguageValid()) {
            AndroidRxUtils.runOnUi(() -> translationBox.setVisibility(View.GONE));
            return;
        }
        final TextView note = translationBox.findViewById(R.id.description_translate_note);
        final Button button = translationBox.findViewById(R.id.description_translate_button);

        // add observer to listing language
        cda.translationStatus.setSourceLanguageChangeConsumer(lng -> {
            final boolean showTranslationBox;
            if (null == lng || Settings.getLanguagesToNotTranslate().contains(lng.getCode())) {
                showTranslationBox = false;
            } else {
                showTranslationBox = true;
                if (OfflineTranslateUtils.LANGUAGE_UNKNOWN.equals(lng.getCode())) {
                    button.setEnabled(false);
                    note.setText(R.string.translator_language_unknown);
                } else {
                    button.setEnabled(true);
                    note.setText(cda.getResources().getString(R.string.translator_language_detected, lng.toString()));
                }
            }
            AndroidRxUtils.runOnUi(() -> translationBox.setVisibility(showTranslationBox ? View.VISIBLE : View.GONE));
        });

        button.setOnClickListener(v -> callback.run());
        note.setOnClickListener(v -> OfflineTranslateUtils.showLanguageSelection(cda, cda.translationStatus::setSourceLanguage));

        // identify listing language
        OfflineTranslateUtils.detectLanguage(translateText,
                cda.translationStatus::setSourceLanguage,
                error -> {
                    AndroidRxUtils.runOnUi(() -> translationBox.setVisibility(View.VISIBLE));
                    button.setEnabled(false);
                    note.setText(error);
                });
    }
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