Problem with slugfy with Vietnamese language

Viewed 155

I am using module slugfy from npm to create a slug URL. However, when I use it with some special string, I have unsatisfied results. For example, when I using it in the Vietnamese language.

const slugify = require('slugify');
console.log(slugify(Đồ gia dụng));

It's result

djo-gia-dung

And I want it to be

do-gia-dung

Please give me the solution to deal with it. Thank you for your attention

1 Answers

You can specify the language to slugify, in the options

Try this

slugify('Đồ gia dụng', {locale: 'vi'})
Related