Skip to content

Commit

Permalink
Add support for Croatian
Browse files Browse the repository at this point in the history
* Add Croatian rule

* added tests for croatian language
  • Loading branch information
napravicukod authored and Florian Eckerstorfer committed Aug 9, 2016
1 parent f5140f4 commit 4d032e0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Resources/rules/croatian.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"Č": "C",
"Ć": "C",
"Ž": "Z",
"Š": "S",
"Đ": "Dj",
"č": "c",
"ć": "c",
"ž": "z",
"š": "s",
"đ": "dj"
}
13 changes: 13 additions & 0 deletions src/RuleProvider/DefaultRuleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,19 @@ class DefaultRuleProvider implements RuleProviderInterface
'ိံ' => 'ein',
'ုံ' => 'on',
),
'croatian' =>
array (
'Č' => 'C',
'Ć' => 'C',
'Ž' => 'Z',
'Š' => 'S',
'Đ' => 'Dj',
'č' => 'c',
'ć' => 'c',
'ž' => 'z',
'š' => 's',
'đ' => 'dj',
),
'czech' =>
array (
'Č' => 'C',
Expand Down
4 changes: 3 additions & 1 deletion tests/SlugifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ public function customRulesProvider()
{
return [
['azerbaijani', 'əöüğşçı', 'eougsci'],
['azerbaijani', 'Fərhad Səfərov', 'ferhad-seferov']
['azerbaijani', 'Fərhad Səfərov', 'ferhad-seferov'],
['croatian', 'Č Ć Ž Š Đ č ć ž š đ', 'c-c-z-s-dj-c-c-z-s-dj'],
];
}

Expand Down Expand Up @@ -222,6 +223,7 @@ public function defaultRuleProvider()
[str_repeat('Übergrößenträger', 1000), str_repeat('uebergroessentraeger', 1000)],
[str_repeat('my🎉', 5000), substr(str_repeat('my-', 5000), 0, -1)],
[str_repeat('hi🇦🇹', 5000), substr(str_repeat('hi-', 5000), 0, -1)],
['Č Ć Ž Š Đ č ć ž š đ', 'c-c-z-s-d-c-c-z-s-d'],
];
}
}

0 comments on commit 4d032e0

Please sign in to comment.