NouanceLabs / payload-better-fields-plugin

This plugin aims to provide you with very specific and improved fields for the Payload admin panel.
MIT License
124 stars 2 forks source link

Slugification of special characters for scandinavian languages #46

Closed Augigauki closed 7 months ago

Augigauki commented 7 months ago

The character æ correctly converts to ae, but characters ø and å incorrectly converts to o and a. They should instead convert to oe (ø/ö) and aa (å) respectively.

In swedish ä = æ, so ä should convert to ae as well.

paulpopus commented 7 months ago

Before I look into a solution on my end, can you test passing the locale into your slugify config?

Something like this:

//...
slugify: { lower: true, remove: /[*+~.()'"!?#\.,:@]/g, locale: 'sv' }
//...

The full list of locale specific transliterations are here https://github.com/simov/slugify/blob/master/config/locales.json

We use https://www.npmjs.com/package/slugify under the hood as outlined under the Options for https://github.com/NouanceLabs/payload-better-fields-plugin#slug-field

Augigauki commented 7 months ago

Adding the locale worked well! Thanks for the tip :)