sendLanguage method

String sendLanguage({
  1. required LanguageCodeData languageCodeData,
  2. required String id,
  3. List<RegExpReplace>? regexpReplaces,
  4. String? languageCode,
})

Implementation

String sendLanguage({
  required LanguageCodeData languageCodeData,
  required String id,
  List<RegExpReplace>? regexpReplaces,
  String? languageCode,
}) {
  languageCode ??= language_code;
  regexpReplaces ??= regexp_replaces;
  try {
    String language_result = languageCodeData[languageCode] ??
        languageCodeData["id"] ??
        "Translation not found\n\n${id}: Tidak ada bahasa ${languageCode}";
    if (language_result.isEmpty) {
      language_result =
          "Translation not found\n\n${id}: Tidak ada bahasa ${languageCode}";
    }

    return variableMessage(
      text: language_result,
      regexpReplaces: regexpReplaces,
    );
  } catch (e) {
    return "LanguageBot error\nId: ${id}\nRes: ${e.toString()}";
  }
}