Skip to content

Commit

Permalink
add support for Arabic
Browse files Browse the repository at this point in the history
  • Loading branch information
Trott committed Mar 30, 2019
1 parent 4f55903 commit 6380aee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions slug.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ slug.charmap = slug.defaults.charmap = {
'ā':'a', 'ē':'e', 'ģ':'g', 'ī':'i', 'ķ':'k', 'ļ':'l', 'ņ':'n',
'ū':'u', 'Ā':'A', 'Ē':'E', 'Ģ':'G', 'Ī':'I',
'Ķ':'K', 'Ļ':'L', 'Ņ':'N', 'Ū':'U',
// arabic
'أ': 'a', 'ب': 'b', 'ت': 't', 'ث': 'th', 'ج': 'g', 'ح': 'h', 'خ': 'kh', 'د': 'd',
'ذ': 'th', 'ر': 'r', 'ز': 'z', 'س': 's', 'ش': 'sh', 'ص': 's', 'ض': 'd', 'ط': 't',
'ظ': 'th', 'ع': 'aa', 'غ': 'gh', 'ف': 'f', 'ق': 'k', 'ك': 'k', 'ل': 'l', 'م': 'm',
'ن': 'n', 'ه': 'h', 'و': 'o', 'ي': 'y',
// lithuanian
'ė':'e', 'į':'i', 'ų':'u', 'Ė': 'E', 'Į': 'I', 'Ų':'U',
// romanian
Expand Down
3 changes: 3 additions & 0 deletions test/slug.test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -232,3 +232,6 @@ describe 'slug', ->
text = "It's Your Journey We Guide You Through."
expected = "Its-Your-Journey-We-Guide-You-Through."
[slug text, mode:'rfc3986', lower:off].should.eql [expected]

it 'should replace arabic characters', ->
slug('مرحبا بك').should.eql 'mrhb-bk'

0 comments on commit 6380aee

Please sign in to comment.