Skip to content

Commit

Permalink
Adds support for greek substitutions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilias Dimos authored and matrixik committed Jun 19, 2017
1 parent dfb5bc6 commit f36922d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions languages_substitution.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,15 @@ var esSub = map[rune]string{
'&': "y",
'@': "en",
}

var grSub = map[rune]string{
'&': "kai",
'η': "i",
'ή': "i",
'Η': "i",
'ι': "i",
'ί': "i",
'Ι': "i",
'χ': "x",
'Χ': "x",
}
2 changes: 2 additions & 0 deletions slug.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ func MakeLang(s string, lang string) (slug string) {
slug = SubstituteRune(slug, plSub)
case "es":
slug = SubstituteRune(slug, esSub)
case "gr":
slug = SubstituteRune(slug, grSub)
default: // fallback to "en" if lang not found
slug = SubstituteRune(slug, enSub)
}
Expand Down
1 change: 1 addition & 0 deletions slug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func TestSlugMakeLang(t *testing.T) {
{"de", "This & that", "this-und-that"},
{"pl", "This & that", "this-i-that"},
{"es", "This & that", "this-y-that"},
{"gr", "This & that", "this-kai-that"},
{"test", "This & that", "this-and-that"}, // unknown lang, fallback to "en"
}

Expand Down

0 comments on commit f36922d

Please sign in to comment.