Showing
2 changed files
with
19 additions
and
2 deletions
language-guess.js
0 → 100644
1 | +import {franc} from 'franc'; | ||
2 | +import langs from 'langs'; | ||
3 | + | ||
4 | +function getLang(se) { | ||
5 | + let langCode = ""; | ||
6 | + if(se.length < 10) { | ||
7 | + langCode = franc(se, {minLength:`${se.length}`}); | ||
8 | + } else { | ||
9 | + langCode = franc(se); | ||
10 | + } | ||
11 | + return langs.where('3', langCode).local; | ||
12 | +} | ||
13 | + | ||
14 | +export {getLang}; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment