Skip to content

Commit

Permalink
Adding french language (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
fraiss-c authored and matrixik committed Jul 26, 2021
1 parent abe4c67 commit ce9859b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion languages_substitution.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func init() {
// TODO: Find better way so all langs are merged automatically and better
// tested.
for _, sub := range []*map[rune]string{
&deSub, &enSub, &esSub, &fiSub, &grSub, &kkSub, &nlSub, &plSub, &svSub, &slSub, &trSub, &nbSub, &nnSub,
&deSub, &enSub, &esSub, &fiSub, &frSub, &grSub, &kkSub, &nlSub, &plSub, &svSub, &slSub, &trSub, &nbSub, &nnSub,
} {
for key, value := range defaultSub {
(*sub)[key] = value
Expand Down Expand Up @@ -54,6 +54,11 @@ var fiSub = map[rune]string{
'@': "at",
}

var frSub = map[rune]string{
'&': "et",
'@': "arobase",
}

var grSub = map[rune]string{
'&': "kai",
'η': "i",
Expand Down
2 changes: 2 additions & 0 deletions slug.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ func MakeLang(s string, lang string) (slug string) {
slug = SubstituteRune(slug, esSub)
case "fi", "fin":
slug = SubstituteRune(slug, fiSub)
case "fr", "fra":
slug = SubstituteRune(slug, frSub)
case "gr", "el", "ell":
slug = SubstituteRune(slug, grSub)
case "kz", "kk", "kaz":
Expand Down
3 changes: 3 additions & 0 deletions slug_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ func TestSlugMakeLang(t *testing.T) {
{"en", "This & that", "this-and-that", true},
{"es", "This & that", "this-y-that", true},
{"fi", "This & that", "this-ja-that", true},
{"fr", "This & that", "this-et-that", true},
{"fr", "This @ that", "this-arobase-that", true},
{"gr", "This & that", "this-kai-that", true},
{"ell", "This & that", "this-kai-that", true},
{"Ell", "This & that", "this-kai-that", true},
Expand Down Expand Up @@ -150,6 +152,7 @@ func TestSlugMakeUserSubstituteLang(t *testing.T) {
{map[string]string{"&": "or"}, "de", "This & that", "this-or-that"}, // by default "&" => "und"
{map[string]string{"&": "or"}, "DEU", "This & that", "this-or-that"}, // by default "&" => "und"
{map[string]string{"&": "or"}, "Fin", "This & that", "this-or-that"}, // by default "&" => "ja"
{map[string]string{"&": "or"}, "fr", "This & that", "this-or-that"}, // by default "&" => "ja"
{map[string]string{"&": "or"}, "kk", "This & that", "this-or-that"}, // by default "&" => "jane"
{map[string]string{"&": "or", "@": "the"}, "sv", "@ This & that", "the-this-or-that"}, // by default "&" => "och", "@" => "snabel a"
{map[string]string{"&": "or", "@": "the"}, "de", "@ This & that", "the-this-or-that"}, // by default "&" => "und", "@" => "an"
Expand Down

0 comments on commit ce9859b

Please sign in to comment.