Skip to content

Commit

Permalink
Add Romanian rules to slugify (#150)
Browse files Browse the repository at this point in the history
* add Romanian rules

* add extra stuff - got inspired by azerbaijani pr

* Update SlugifyTest.php

* Update DefaultRuleProvider.php
  • Loading branch information
gabiudrescu authored and Florian Eckerstorfer committed Feb 11, 2017
1 parent cc6c040 commit 639e12d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Resources/rules/romanian.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"ă": "a",
"î": "i",
"â": "a",
"ş": "s",
"ș": "s",
"ţ": "t",
"ț": "t",
"Ă": "A",
"Î": "I",
"Â": "A",
"Ş": "S",
"Ș": "S",
"Ţ": "T",
"Ț": "T"
}
17 changes: 17 additions & 0 deletions src/RuleProvider/DefaultRuleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,23 @@ class DefaultRuleProvider implements RuleProviderInterface
'ź' => 'z',
'ż' => 'z',
),
'romanian' =>
array(
'ă' => 'a',
'î' => 'i',
'â' => 'a',
'ş' => 's',
'ș' => 's',
'ţ' => 't',
'ț' => 't',
'Ă' => 'A',
'Î' => 'I',
'Â' => 'A',
'Ş' => 'S',
'Ș' => 'S',
'Ţ' => 'T',
'Ț' => 'T'
),
'russian' =>
array (
'Ъ' => '',
Expand Down
1 change: 1 addition & 0 deletions src/Slugify.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class Slugify implements SlugifyInterface
'polish',
'german',
'russian',
'romanian'
],
];

Expand Down
1 change: 1 addition & 0 deletions tests/SlugifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public function customRulesProvider()
['azerbaijani', 'Fərhad Səfərov', 'ferhad-seferov'],
['croatian', 'Č Ć Ž Š Đ č ć ž š đ', 'c-c-z-s-dj-c-c-z-s-dj'],
['danish', 'Æ æ Ø ø Å å É é', 'ae-ae-oe-oe-aa-aa-e-e'],
['romanian', 'ă î â ş ș ţ ț Ă Î Â Ş Ș Ţ Ț', 'a-i-a-s-s-t-t-a-i-a-s-s-t-t'],
['serbian', 'А Б В Г Д Ђ Е Ж З И Ј К Л Љ М Н Њ О П Р С Т Ћ У Ф Х Ц Ч Џ Ш а б в г д ђ е ж з и ј к л љ м н њ о п р с т ћ у ф х ц ч џ ш Š Đ Ž Ć Č š đ ž ć č', 'a-b-v-g-d-dj-e-z-z-i-j-k-l-lj-m-n-nj-o-p-r-s-t-c-u-f-h-c-c-dz-s-a-b-v-g-d-dj-e-z-z-i-j-k-l-lj-m-n-nj-o-p-r-s-t-c-u-f-h-c-c-dz-s-s-dj-z-c-c-s-dj-z-c-c'],
['lithuanian', 'Ą Č Ę Ė Į Š Ų Ū Ž ą č ę ė į š ų ū ž', 'a-c-e-e-i-s-u-u-z-a-c-e-e-i-s-u-u-z'],
];
Expand Down

0 comments on commit 639e12d

Please sign in to comment.