安装
pip install langid
检测语言
import langid
print('locale language', langid.classify('中国'))
print('locale language', langid.classify('China'))
print('locale language', langid.classify('Энид Конивчен'))
结果
locale language ('zh', -17.446399450302124)
locale language ('en', 9.061840057373047)
locale language ('ru', -216.17790341377258)