Skip to content

Commit

Permalink
Add swedish and norwegian special chars
Browse files Browse the repository at this point in the history
added tests

typo

Fix tests
  • Loading branch information
Philipp authored and simov committed Jan 3, 2022
1 parent 584a47d commit 36834a6
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
16 changes: 14 additions & 2 deletions config/locales.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@
},
"nb": {
"locale": "Norwegian",
"&": "og"
"&": "og",
"Å": "AA",
"Æ": "AE",
"Ø": "OE",
"å": "aa",
"æ": "ae",
"ø": "oe"
},
"it": {
"locale": "Italian",
Expand All @@ -118,6 +124,12 @@
},
"sv": {
"locale": "Swedish",
"&": "och"
"&": "och",
"Å": "AA",
"Ä": "AE",
"Ö": "OE",
"å": "aa",
"ä": "ae",
"ö": "oe"
}
}
26 changes: 26 additions & 0 deletions test/locales.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,30 @@ describe('locale', () => {
'porcento-e-menor-maior-ou-centavo-libra-soma-infinito-amor'
)
})

it('nb - Norwegian', () => {
var alphabet =
'& Å Æ Ø å æ ø'

t.equal(slugify(alphabet),
'and-A-AE-O-a-ae-o'
)

t.equal(slugify(alphabet, {locale: 'nb'}),
'og-AA-AE-OE-aa-ae-oe'
)
})

it('sv - Swedish', () => {
var alphabet =
'& Å Ä Ö å ä ö'

t.equal(slugify(alphabet),
'and-A-A-O-a-a-o'
)

t.equal(slugify(alphabet, {locale: 'sv'}),
'och-AA-AE-OE-aa-ae-oe'
)
})
})

0 comments on commit 36834a6

Please sign in to comment.