Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Burmese language support #54

Merged
merged 2 commits into from
Jan 13, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
121 changes: 121 additions & 0 deletions src/Slugify.php
Original file line number Diff line number Diff line change
Expand Up @@ -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[][] */
Expand Down
3 changes: 2 additions & 1 deletion tests/SlugifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
);
}
}