19 package org.sleuthkit.autopsy.texttranslation.translators;
21 import com.google.cloud.translate.TranslateOptions;
22 import org.apache.commons.lang3.StringUtils;
50 String getTargetLanguageCode() {
59 String getCredentialPath() {
68 void setCredentialPath(String path) {
69 credentialPath = path;
78 void setTargetLanguageCode(String code) {
79 if (StringUtils.isBlank(code)) {
82 targetLanguageCode = code;
90 if (!ModuleSettings.configExists(GOOGLE_TRANSLATE_NAME)) {
91 ModuleSettings.makeConfigFile(GOOGLE_TRANSLATE_NAME);
93 if (ModuleSettings.settingExists(GOOGLE_TRANSLATE_NAME, TARGET_LANGUAGE_CODE_KEY)) {
94 targetLanguageCode = ModuleSettings.getConfigSetting(GOOGLE_TRANSLATE_NAME, TARGET_LANGUAGE_CODE_KEY);
96 if (targetLanguageCode == null || StringUtils.isBlank(targetLanguageCode)) {
99 if (ModuleSettings.settingExists(GOOGLE_TRANSLATE_NAME, CREDENTIAL_PATH_KEY)) {
100 credentialPath = ModuleSettings.getConfigSetting(GOOGLE_TRANSLATE_NAME, CREDENTIAL_PATH_KEY);
102 if (credentialPath == null) {
110 void saveSettings() {
111 ModuleSettings.setConfigSetting(GOOGLE_TRANSLATE_NAME, TARGET_LANGUAGE_CODE_KEY, targetLanguageCode);
112 ModuleSettings.setConfigSetting(GOOGLE_TRANSLATE_NAME, CREDENTIAL_PATH_KEY, credentialPath);
static final String CREDENTIAL_PATH_KEY
static final String DEFAULT_TARGET_LANGUAGE
String targetLanguageCode
static final String TARGET_LANGUAGE_CODE_KEY
static final String DEFAULT_CREDENTIAL_PATH
static final String GOOGLE_TRANSLATE_NAME