franc is a library to detect the language of text. It supports more languages than any other library, or Google.
Website Demo