implemented detect_language() in its basic form