Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ $slugify->setRegExp('/([^a-z0-9]|-)+/');

*(The regular expression used in the example above is the default one.)*

### Contributing

Feel free to ask for new rules for languages that is not already here.

All you need to do is:

1. Provide transliteration rules for your language, in any form, e.g. `'ї' => 'ji'`
2. Provide some examples of texts transliterated with this rules e.g. `'Україна' => 'Ukrajina'`

### Further information

- [API docs](http://cocur.co/slugify/api/master/)
Expand Down
96 changes: 94 additions & 2 deletions src/Slugify.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,99 @@ class Slugify implements SlugifyInterface
'ن' => 'n',
'ه' => 'h',
'و' => 'o',
'ي' => 'y'
'ي' => 'y',

/* Vietnamese */
'ạ' => 'a',
'ả' => 'a',
'ầ' => 'a',
'ấ' => 'a',
'ậ' => 'a',
'ẩ' => 'a',
'ẫ' => 'a',
'ằ' => 'a',
'ắ' => 'a',
'ặ' => 'a',
'ẳ' => 'a',
'ẵ' => 'a',
'ẹ' => 'e',
'ẻ' => 'e',
'ẽ' => 'e',
'ề' => 'e',
'ế' => 'e',
'ệ' => 'e',
'ể' => 'e',
'ễ' => 'e',
'ị' => 'i',
'ỉ' => 'i',
'ọ' => 'o',
'ỏ' => 'o',
'ồ' => 'o',
'ố' => 'o',
'ộ' => 'o',
'ổ' => 'o',
'ỗ' => 'o',
'ờ' => 'o',
'ớ' => 'o',
'ợ' => 'o',
'ở' => 'o',
'ỡ' => 'o',
'ụ' => 'u',
'ủ' => 'u',
'ừ' => 'u',
'ứ' => 'u',
'ự' => 'u',
'ử' => 'u',
'ữ' => 'u',
'ỳ' => 'y',
'ỵ' => 'y',
'ỷ' => 'y',
'ỹ' => 'y',
'Ạ' => 'A',
'Ả' => 'A',
'Ầ' => 'A',
'Ấ' => 'A',
'Ậ' => 'A',
'Ẩ' => 'A',
'Ẫ' => 'A',
'Ằ' => 'A',
'Ắ' => 'A',
'Ặ' => 'A',
'Ẳ' => 'A',
'Ẵ' => 'A',
'Ẹ' => 'E',
'Ẻ' => 'E',
'Ẽ' => 'E',
'Ề' => 'E',
'Ế' => 'E',
'Ệ' => 'E',
'Ể' => 'E',
'Ễ' => 'E',
'Ị' => 'I',
'Ỉ' => 'I',
'Ọ' => 'O',
'Ỏ' => 'O',
'Ồ' => 'O',
'Ố' => 'O',
'Ộ' => 'O',
'Ổ' => 'O',
'Ỗ' => 'O',
'Ờ' => 'O',
'Ớ' => 'O',
'Ợ' => 'O',
'Ở' => 'O',
'Ỡ' => 'O',
'Ụ' => 'U',
'Ủ' => 'U',
'Ừ' => 'U',
'Ứ' => 'U',
'Ự' => 'U',
'Ử' => 'U',
'Ữ' => 'U',
'Ỳ' => 'Y',
'Ỵ' => 'Y',
'Ỷ' => 'Y',
'Ỹ' => 'Y',
);

/** @var string[][] */
Expand Down Expand Up @@ -471,7 +563,7 @@ public function __construct($regExp = self::LOWERCASE_NUMBERS_DASHES)
{
$this->regExp = $regExp;
}

/**
* Returns the slug-version of the string.
*
Expand Down
3 changes: 2 additions & 1 deletion tests/SlugifyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ public function provider()
array('C’est du français !', 'c-est-du-francais'),
array('هذه هي اللغة العربية', 'hthh-hy-llgh-laarby'),
array('مرحبا العالم', 'mrhb-laa-lm'),
array('Één jaar', 'een-jaar')
array('Één jaar', 'een-jaar'),
array('tiếng việt rất khó', 'tieng-viet-rat-kho')
);
}
}