Skip to content

Commit

Permalink
Add Azerbaijani transliterations (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
seferov authored and Florian Eckerstorfer committed May 12, 2016
1 parent 0c2ef55 commit 922e56a
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Resources/rules/azerbaijani.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"Ə": "E",
"Ç": "C",
"Ğ": "G",
"İ": "I",
"Ş": "S",
"Ö": "O",
"Ü": "U",
"ə": "e",
"ç": "c",
"ğ": "g",
"ı": "i",
"ş": "s",
"ö": "o",
"ü": "u"
}
17 changes: 17 additions & 0 deletions src/RuleProvider/DefaultRuleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,23 @@ class DefaultRuleProvider implements RuleProviderInterface
'ö' => 'oe',
'ü' => 'ue',
),
'azerbaijani' =>
array (
'Ə' => 'E',
'Ç' => 'C',
'Ğ' => 'G',
'İ' => 'I',
'Ş' => 'S',
'Ö' => 'O',
'Ü' => 'U',
'ə' => 'e',
'ç' => 'c',
'ğ' => 'g',
'ı' => 'i',
'ş' => 's',
'ö' => 'o',
'ü' => 'u',
),
'bulgarian' => NULL,
'burmese' =>
array (
Expand Down
1 change: 1 addition & 0 deletions src/Slugify.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Slugify implements SlugifyInterface
// Languages are preferred if they appear later, list is ordered by number of
// websites in that language
// https://en.wikipedia.org/wiki/Languages_used_on_the_Internet#Content_languages_for_websites
'azerbaijani',
'burmese',
'hindi',
'georgian',
Expand Down
20 changes: 20 additions & 0 deletions tests/SlugifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,26 @@ public function doNotConvertToLowercase()
$this->assertEquals($expected, $this->slugify->slugify($actual));
}

/**
* @test
* @dataProvider customRulesProvider
*/
public function customRules($rule, $string, $result)
{
$slugify = new Slugify();
$slugify->activateRuleSet($rule);

$this->assertSame($result, $slugify->slugify($string));
}

public function customRulesProvider()
{
return [
['azerbaijani', 'əöüğşçı', 'eougsci'],
['azerbaijani', 'Fərhad Səfərov', 'ferhad-seferov']
];
}

public function defaultRuleProvider()
{
return [
Expand Down

0 comments on commit 922e56a

Please sign in to comment.