FGRibreau / node-language-detect

🇫🇷 NodeJS language detection library using n-gram
http://blog.fgribreau.com/2011/07/week-end-project-nodejs-language.html
MIT License
399 stars 45 forks source link

Option to return language as iso2 or iso3 #31

Closed ajmas closed 5 years ago

ajmas commented 5 years ago

Would it be possible to add an optional third parameter to LanguageDetect.detect() that would allow add a property to return the languages as iso2 or iso3. If it is already possible, could this be added to the docs?

Example:

LanguageDetect.detect(text, 1, { langType: 'iso2' } )
ajmas commented 5 years ago

Digging into the code a bit I see that setLanguageType() is available, but not exposed to Typescript. Will add a PR if it is welcome.

ajmas commented 5 years ago

PR: https://github.com/FGRibreau/node-language-detect/pull/33

FGRibreau commented 5 years ago

Merged :+1: thanks!