Library to help with Unicode conversion and romanization from other alphabets.
Add the package to your go.mod with the command:
go get github.com/heat/latinifyThen import it in your code:
import "github.com/heat/latinify"Use String to normalize accents and other characters to the Latin alphabet:
texto, err := latinify.String("Olá, 世界")StringWithTable allows applying additional mapping tables:
table := latinify.Table{
'ü': 'u',
'ä': 'a',
}
texto, err := latinify.StringWithTable("für ärger", table)Slugify creates a URL-friendly version of the given text:
slug, err := latinify.Slugify("Olá, Mundo!")
// slug == "ola-mundo"- Fork the repository and create a branch for your changes.
- Run
go test ./...to make sure the tests still pass. - Open a Pull Request describing your changes.