Skip to content

Commit

Permalink
Add Indonesia Language (gosimple#64)
Browse files Browse the repository at this point in the history
* Add Indonesia Language
* Add "idn", "ind" for Indonesia Language
* Add test for Indonesia language

Co-authored-by: rizkyadhi <[email protected]>
Co-authored-by: Dobrosław Żybort <[email protected]>
  • Loading branch information
3 people authored Dec 13, 2021
1 parent e8f901c commit f347b0c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions languages_substitution.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func init() {
&fiSub,
&frSub,
&grSub,
&idSub,
&kkSub,
&nbSub,
&nlSub,
Expand Down Expand Up @@ -95,6 +96,10 @@ var grSub = map[rune]string{
'ϋ': "u",
}

var idSub = map[rune]string{
'&': "dan",
}

var kkSub = map[rune]string{
'&': "jane",
'ә': "a",
Expand Down
2 changes: 2 additions & 0 deletions slug.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ func MakeLang(s string, lang string) (slug string) {
slug = SubstituteRune(slug, frSub)
case "gr", "el", "ell":
slug = SubstituteRune(slug, grSub)
case "id", "idn", "ind":
slug = SubstituteRune(slug, idSub)
case "kz", "kk", "kaz":
slug = SubstituteRune(slug, kkSub)
case "nb", "nob":
Expand Down
1 change: 1 addition & 0 deletions slug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func TestSlugMakeLang(t *testing.T) {
{"fr", "This & that", "this-et-that", true},
{"fr", "This @ that", "this-arobase-that", true},
{"gr", "This & that", "this-kai-that", true},
{"id", "This & that", "this-dan-that", true},
{"ell", "This & that", "this-kai-that", true},
{"Ell", "This & that", "this-kai-that", true},
{"kk", "This & that", "this-jane-that", true},
Expand Down

0 comments on commit f347b0c

Please sign in to comment.