Skip to content

Commit

Permalink
Add Romanian language
Browse files Browse the repository at this point in the history
  • Loading branch information
vasilegoian committed May 3, 2022
1 parent e104167 commit f551ffd
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions languages_substitution.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ func init() {
&nlSub,
&nnSub,
&plSub,
&roSub,
&slSub,
&svSub,
&trSub,
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions slug.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
4 changes: 4 additions & 0 deletions slug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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},
Expand Down Expand Up @@ -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},
Expand Down

0 comments on commit f551ffd

Please sign in to comment.