From 2c29ec95f074a3be6780e9eb5fd54908a5d39036 Mon Sep 17 00:00:00 2001 From: Konstantinos Pittas Date: Fri, 17 Jul 2015 23:15:11 +0300 Subject: [PATCH] Improved greek language support. --- src/Slugify.php | 84 +++++++++++++++++++++++++++++++++---------- tests/SlugifyTest.php | 2 +- 2 files changed, 66 insertions(+), 20 deletions(-) diff --git a/src/Slugify.php b/src/Slugify.php index 1be323a9..94f0af1b 100644 --- a/src/Slugify.php +++ b/src/Slugify.php @@ -363,13 +363,52 @@ class Slugify implements SlugifyInterface 'ż' => 'z', // Greek + 'ΑΥ' => 'AU', + 'Αυ' => 'Au', + 'ΟΥ' => 'OU', + 'Ου' => 'Ou', + 'ΕΥ' => 'EU', + 'Ευ' => 'Eu', + 'ΕΙ' => 'I', + 'Ει' => 'I', + 'ΟΙ' => 'I', + 'Οι' => 'I', + 'ΥΙ' => 'I', + 'Υι' => 'I', + 'ΑΎ' => 'AU', + 'Αύ' => 'Au', + 'ΟΎ' => 'OU', + 'Ού' => 'Ou', + 'ΕΎ' => 'EU', + 'Εύ' => 'Eu', + 'ΕΊ' => 'I', + 'Εί' => 'I', + 'ΟΊ' => 'I', + 'Οί' => 'I', + 'ΎΙ' => 'I', + 'Ύι' => 'I', + 'ΥΊ' => 'I', + 'Υί' => 'I', + 'αυ' => 'au', + 'ου' => 'ou', + 'ευ' => 'eu', + 'ει' => 'i', + 'οι' => 'i', + 'υι' => 'i', + 'αύ' => 'au', + 'ού' => 'ou', + 'εύ' => 'eu', + 'εί' => 'i', + 'οί' => 'i', + 'ύι' => 'i', + 'υί' => 'i', 'Α' => 'A', - 'Β' => 'B', + 'Β' => 'V', 'Γ' => 'G', 'Δ' => 'D', 'Ε' => 'E', 'Ζ' => 'Z', - 'Η' => 'E', + 'Η' => 'I', 'Θ' => 'Th', 'Ι' => 'I', 'Κ' => 'K', @@ -382,25 +421,28 @@ class Slugify implements SlugifyInterface 'Ρ' => 'R', 'Σ' => 'S', 'Τ' => 'T', - 'Υ' => 'Y', - 'Φ' => 'Ph', + 'Υ' => 'I', + 'Φ' => 'F', 'Χ' => 'Ch', 'Ψ' => 'Ps', 'Ω' => 'O', + 'Ά' => 'A', + 'Έ' => 'E', + 'Ή' => 'I', + 'Ί' => 'I', + 'Ό' => 'O', + 'Ύ' => 'I', 'Ϊ' => 'I', - 'Ϋ' => 'Y', - 'ά' => 'a', - 'έ' => 'e', - 'ή' => 'e', - 'ί' => 'i', - 'ΰ' => 'Y', + 'Ϊ' => 'I', + 'Ϋ' => 'I', + 'ϒ' => 'I', 'α' => 'a', - 'β' => 'b', + 'β' => 'v', 'γ' => 'g', 'δ' => 'd', 'ε' => 'e', 'ζ' => 'z', - 'η' => 'e', + 'η' => 'i', 'θ' => 'th', 'ι' => 'i', 'κ' => 'k', @@ -414,19 +456,23 @@ class Slugify implements SlugifyInterface 'ς' => 's', 'σ' => 's', 'τ' => 't', - 'υ' => 'y', - 'φ' => 'ph', + 'υ' => 'i', + 'φ' => 'f', 'χ' => 'ch', 'ψ' => 'ps', 'ω' => 'o', - 'ϊ' => 'i', - 'ϋ' => 'y', + 'ά' => 'a', + 'έ' => 'e', + 'ή' => 'i', + 'ί' => 'i', 'ό' => 'o', - 'ύ' => 'y', + 'ύ' => 'i', + 'ϊ' => 'i', + 'ϋ' => 'i', + 'ΰ' => 'i', 'ώ' => 'o', - 'ϐ' => 'b', + 'ϐ' => 'v', 'ϑ' => 'th', - 'ϒ' => 'Y', /* Arabic */ 'أ' => 'a', diff --git a/tests/SlugifyTest.php b/tests/SlugifyTest.php index 05420473..d21b9aff 100644 --- a/tests/SlugifyTest.php +++ b/tests/SlugifyTest.php @@ -202,7 +202,7 @@ public function provider() array('Блоґ їжачка', 'blog-jizhachka'), array('фильм', 'film'), array('драма', 'drama'), - array('ελληνικά', 'ellenika'), + array('Ύπαρξη Αυτής η Σκουληκομυρμηγκότρυπα', 'iparxi-autis-i-skoulikomirmigkotripa'), array('C’est du français !', 'c-est-du-francais'), array('هذه هي اللغة العربية', 'hthh-hy-llgh-laarby'), array('مرحبا العالم', 'mrhb-laa-lm'),