Search code examples
fluttertranslationtranslate

How can I detect text language with flutter


I need a package that detects and returns the text language. Do you have a flutter package recommendation for this? If you know of any other method besides the packages, I'd be happy to hear it.


Solution

  • I found another way to detect language code; You need to use this package. I leave a simple code example below;

    Translation translation = await translator.translate("Example Text");
    lanCode = translation.sourceLanguage.code;
    print("Language Code: $lanCode");