diff --git a/languages_substitution.go b/languages_substitution.go index ad0963f..6403482 100644 --- a/languages_substitution.go +++ b/languages_substitution.go @@ -24,6 +24,7 @@ func init() { &nlSub, &nnSub, &plSub, + &roSub, &slSub, &svSub, &trSub, @@ -162,6 +163,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 14acce7..37f212c 100644 --- a/slug.go +++ b/slug.go @@ -85,6 +85,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 baace64..61c904f 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 { @@ -94,6 +95,8 @@ func TestSlugMakeLang(t *testing.T) { {"tr", "şüöğıçŞÜÖİĞÇ", "suogicSUOIGC", false}, {"kk", "әғһіңөқұүӘҒҺІҢӨҚҰҮ", "aghinoquuaghinoquu", true}, {"kk", "әғһіңөқұүӘҒҺІҢӨҚҰҮ", "aghinoquuAGHINOQUU", false}, + {"ro", "ĂăÂăÎîȘșȚț", "aaaaiisstt", true}, + {"ro", "ĂăÂăÎîȘșȚț", "AaAaIiSsTt", false}, // & fun. {"cs", "Toto & Tamto", "toto-a-tamto", true}, {"cs", "Toto & Tamto", "Toto-a-Tamto", false}, @@ -145,6 +148,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},