Skip to content

Instantly share code, notes, and snippets.

@glaforge
Created January 4, 2024 01:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glaforge/1d780bb861c41dd3145003061b0c4d72 to your computer and use it in GitHub Desktop.
Save glaforge/1d780bb861c41dd3145003061b0c4d72 to your computer and use it in GitHub Desktop.
Creating slugs from any text (including in non-latin languages) using the Slugify library and ICU for transliteration
@Grab('com.ibm.icu:icu4j')
@Grab('com.github.slugify:slugify')
import com.github.slugify.*
var slugify = Slugify.builder()
.transliterator(true)
.locale(Locale.ENGLISH)
.build()
println slugify.slugify("Un bel été où l'hôtel François à rebours des îles de Noël tenait tête")
println slugify.slugify("生成人工智能")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment