diff --git a/README.md b/README.md index d0cbdb4a..c11a95e2 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Features -------- - Removes all special characters from a string. -- Provides custom replacements for German, French, Spanish, Russian, Ukrainian, Polish, Czech, Latvian, Greek, Esperanto¹, Arabian and Vietnamese special characters. Instead of removing these characters Slugify approximates them (e.g., `ae` replaces `ä`). +- Provides custom replacements for German, French, Spanish, Russian, Ukrainian, Polish, Czech, Latvian, Greek, Esperanto¹, Arabian, Vietnamese and Burmese special characters. Instead of removing these characters Slugify approximates them (e.g., `ae` replaces `ä`). - No external dependencies. - PSR-4 compatible. - Compatible with PHP >= 5.3.3 and [HHVM](http://hhvm.com). diff --git a/src/Slugify.php b/src/Slugify.php index f85fb797..6c96e0c7 100644 --- a/src/Slugify.php +++ b/src/Slugify.php @@ -532,6 +532,127 @@ class Slugify implements SlugifyInterface 'Ỵ' => 'Y', 'Ỷ' => 'Y', 'Ỹ' => 'Y', + + // burmese consonants + 'က'=> 'k', + 'ခ'=> 'kh', + 'ဂ'=> 'g', + 'ဃ'=> 'ga', + 'င'=> 'ng', + 'စ'=> 's', + 'ဆ'=> 'sa', + 'ဇ'=> 'z', + 'စျ'=> 'za', + 'ည'=> 'ny', + 'ဋ'=> 't', + 'ဌ'=> 'ta', + 'ဍ'=> 'd', + 'ဎ'=> 'da', + 'ဏ'=> 'na', + 'တ'=> 't', + 'ထ'=> 'ta', + 'ဒ'=> 'd', + 'ဓ'=> 'da', + 'န'=> 'n', + 'ပ'=> 'p', + 'ဖ'=> 'pa', + 'ဗ'=> 'b', + 'ဘ'=> 'ba', + 'မ'=> 'm', + 'ယ'=> 'y', + 'ရ'=> 'ya', + 'လ'=> 'l', + 'ဝ'=> 'w', + 'သ'=> 'th', + 'ဟ'=> 'h', + 'ဠ'=> 'la', + 'အ'=> 'a', + // consonant character combos + 'ြ'=> 'y', + 'ျ'=> 'ya', + 'ွ'=> 'w', + 'ြွ'=> 'yw', + 'ျွ'=> 'ywa', + 'ှ'=> 'h', + // independent vowels + 'ဧ'=> 'e', + '၏'=> '-e', + 'ဣ'=> 'i', + 'ဤ'=> '-i', + 'ဉ'=> 'u', + 'ဦ'=> '-u', + 'ဩ'=> 'aw', + 'သြော'=> 'aw', + 'ဪ'=> 'aw', + '၍' => 'ywae', + '၌' => 'hnaik', + // numbers + '၀'=> '0', + '၁'=> '1', + '၂'=> '2', + '၃'=> '3', + '၄'=> '4', + '၅'=> '5', + '၆'=> '6', + '၇'=> '7', + '၈'=> '8', + '၉'=> '9', + // virama and tone marks which are silent in transliteration + '္'=> '', + '့'=> '', + 'း'=> '', + // dependent vowels + 'ာ'=> 'a', + 'ါ'=> 'a', + 'ေ'=> 'e', + 'ဲ'=> 'e', + 'ိ'=> 'i', + 'ီ'=> 'i', + 'ို'=> 'o', + 'ု'=> 'u', + 'ူ'=> 'u', + 'ေါင်'=> 'aung', + 'ော'=> 'aw', + 'ော်'=> 'aw', + 'ေါ'=> 'aw', + 'ေါ်'=> 'aw', + '်'=> 'at', + 'က်'=> 'et', + 'ိုက်'=> 'aik', + 'ောက်'=> 'auk', + 'င်'=> 'in', + 'ိုင်'=> 'aing', + 'ောင်'=> 'aung', + 'စ်'=> 'it', + 'ည်'=> 'i', + 'တ်'=> 'at', + 'ိတ်'=> 'eik', + 'ုတ်'=> 'ok', + 'ွတ်'=> 'ut', + 'ေတ်'=> 'it', + 'ဒ်'=> 'd', + 'ိုဒ်'=> 'ok', + 'ုဒ်'=> 'ait', + 'န်'=> 'an', + 'ာန်'=> 'an', + 'ိန်'=> 'ein', + 'ုန်'=> 'on', + 'ွန်'=> 'un', + 'ပ်'=> 'at', + 'ိပ်'=> 'eik', + 'ုပ်'=> 'ok', + 'ွပ်'=> 'ut', + 'န်ုပ်'=> 'nub', + 'မ်'=> 'an', + 'ိမ်'=> 'ein', + 'ုမ်'=> 'on', + 'ွမ်'=> 'un', + 'ယ်'=> 'e', + 'ိုလ်'=> 'ol', + 'ဉ်'=> 'in', + 'ံ'=> 'an', + 'ိံ'=> 'ein', + 'ုံ'=> 'on' ); /** @var string[][] */ diff --git a/tests/SlugifyTest.php b/tests/SlugifyTest.php index 84c40df7..24990949 100644 --- a/tests/SlugifyTest.php +++ b/tests/SlugifyTest.php @@ -164,7 +164,8 @@ public function provider() array('مرحبا العالم', 'mrhb-laa-lm'), array('Één jaar', 'een-jaar'), array('tiếng việt rất khó', 'tieng-viet-rat-kho'), - array('Nguyễn Đăng Khoa', 'nguyen-dang-khoa') + array('Nguyễn Đăng Khoa', 'nguyen-dang-khoa'), + array('နှစ်သစ်ကူးတွင် သတ္တဝါတွေ စိတ်ချမ်းသာ ကိုယ်ကျန်းမာ၍ ကောင်းခြင်း အနန္တနှင့် ပြည့်စုံကြပါစေ', 'nhitthitkutwin-thttwatwe-seikkhyaantha-koekyaanmaywae-kaungkhyin-anntnhin-pyisonkypase') ); } }