translate static method
Implementation
static Future<String> translate({
required String text,
String fromLanguageCode = GoogleTranslator.autoLanguage,
required String toLanguageCode,
bool ignoreError = true,
}) async {
try {
final Translation translation = await googleTranslator.getTranslation(
text,
from: fromLanguageCode,
to: toLanguageCode,
);
return translation.text;
} catch (e) {
if (ignoreError) {
return text;
} else {
rethrow;
}
}
}