diff --git a/languages_substitution.go b/languages_substitution.go index 60d3c6c..cfc3ab8 100644 --- a/languages_substitution.go +++ b/languages_substitution.go @@ -26,6 +26,7 @@ func init() { &nlSub, &nnSub, &plSub, + &roSub, &slSub, &svSub, &trSub, @@ -169,6 +170,20 @@ var plSub = map[rune]string{ '@': "na", } +var roSub = map[rune]string{ + '&': "si", + 'Ă': "A", + 'ă': "a", + 'Â': "A", + 'â': "a", + 'Î': "I", + 'î': "i", + 'Ș': "S", + 'ș': "s", + 'Ț': "T", + 'ț': "t", +} + var slSub = map[rune]string{ '&': "in", 'Đ': "DZ", diff --git a/slug.go b/slug.go index 1439ebc..86bdb68 100644 --- a/slug.go +++ b/slug.go @@ -89,6 +89,8 @@ func MakeLang(s string, lang string) (slug string) { slug = SubstituteRune(slug, nnSub) case "pl", "pol": slug = SubstituteRune(slug, plSub) + case "ro", "rou": + slug = SubstituteRune(slug, roSub) case "sl", "slv": slug = SubstituteRune(slug, slSub) case "sv", "swe": diff --git a/slug_test.go b/slug_test.go index 7cff10a..088bf71 100644 --- a/slug_test.go +++ b/slug_test.go @@ -54,6 +54,7 @@ func TestSlugMake(t *testing.T) { {"jaja---lol-méméméoo--a", "jaja-lol-mememeoo-a"}, {"影師", "ying-shi"}, {"Đanković & Kožušček", "dankovic-and-kozuscek"}, + {"ĂăÂâÎîȘșȚț", "aaaaiisstt"}, } for index, st := range testCases { @@ -92,10 +93,12 @@ func TestSlugMakeLang(t *testing.T) { {"hu", "SzÉlÜtÖtt ŰrÚjsÁgírÓnŐ", "SzElUtOtt-UrUjsAgirOnO", false}, {"Ell", "ϊχώΩϋ", "ixwwu", true}, {"Ell", "ϊχώΩϋ", "ixwwu", false}, - {"tr", "şüöğıçŞÜÖİĞÇ", "suogicsuoigc", true}, - {"tr", "şüöğıçŞÜÖİĞÇ", "suogicSUOIGC", false}, {"kk", "әғһіңөқұүӘҒҺІҢӨҚҰҮ", "aghinoquuaghinoquu", true}, {"kk", "әғһіңөқұүӘҒҺІҢӨҚҰҮ", "aghinoquuAGHINOQUU", false}, + {"ro", "ĂăÂăÎîȘșȚț", "aaaaiisstt", true}, + {"ro", "ĂăÂăÎîȘșȚț", "AaAaIiSsTt", false}, + {"tr", "şüöğıçŞÜÖİĞÇ", "suogicsuoigc", true}, + {"tr", "şüöğıçŞÜÖİĞÇ", "suogicSUOIGC", false}, // & fun. {"bg", "Това и онова", "tova-i-onova", true}, @@ -153,6 +156,7 @@ func TestSlugMakeLang(t *testing.T) { {"nn", "1\"2'3’4‒5–6—7―8", "1234-5-6-7-8", true}, {"nl", "1\"2'3’4‒5–6—7―8", "1234-5-6-7-8", true}, {"pl", "1\"2'3’4‒5–6—7―8", "1234-5-6-7-8", true}, + {"ro", "1\"2'3’4‒5–6—7―8", "1234-5-6-7-8", true}, {"sl", "1\"2'3’4-5–6—7―8", "1234-5-6-7-8", true}, {"sv", "1\"2'3’4‒5–6—7―8", "1234-5-6-7-8", true}, {"tr", "1\"2'3’4‒5–6—7―8", "1234-5-6-7-8", true},