Created
January 4, 2024 01:25
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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