gosimple / slug

URL-friendly slugify with multiple languages support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auto-detech language

nadermx opened this issue · comments

Is there any way we could have it auto detect the language with the slug.Make and then default to English?

Hi, sorry for late reply.

Personally I would prefer to not add this functionality to slug. Especially that looks like this will be only few additional lines by using packages like:
https://github.com/abadojack/whatlanggo
https://github.com/rylans/getlang

Thank to you bringing my attention to this I found that slug is using now country codes instead of language codes 🤦‍♂️

With #33 slug will also catch proper iso639 language codes so you could feed it with output straight from mentioned packages.

One more comment, I believe that this package will be used mostly for short text and detecting language is growing more unreliable as text is getting shorter.