Commit 2eda2725 by Nghia Nguyen Committed by Alexander Makarov

Fixes #5164: Added `Inlfector::$transliterator` that can be used to customize intl transliteration

parent df991951
......@@ -220,6 +220,7 @@ Yii Framework 2 Change Log
- Enh #5117: Added `beforeFilter` and `afterFilter` JS events to `GridView` (kartik-v)
- Enh #5124: Added support to prevent duplicated form submission when using `ActiveForm` (qiangxue)
- Enh #5131: Added `$autoRenew` parameter to `yii\web\User::getIdentity()` (qiangxue)
- Enh #5164: Added `Inlfector::$transliterator` that can be used to customize intl transliteration (zinzinday)
- Enh: Added support for using sub-queries when building a DB query with `IN` condition (qiangxue)
- Enh: Supported adding a new response formatter without the need to reconfigure existing formatters (qiangxue)
- Enh: Added `yii\web\UrlManager::addRules()` to simplify adding new URL rules (qiangxue)
......
......@@ -231,7 +231,12 @@ class BaseInflector
'ø' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u', 'ű' => 'u', 'ý' => 'y', 'þ' => 'th',
'ÿ' => 'y',
];
/**
* @var mixed Either a [[Transliterator]] or a string from which a [[Transliterator]]
* can be built for transliteration used by [[slug()]] when intl is available.
* @see http://php.net/manual/en/transliterator.transliterate.php
*/
public static $transliterator = 'Any-Latin; NFKD';
/**
* Converts a word to its plural form.
......@@ -437,7 +442,7 @@ class BaseInflector
protected static function transliterate($string)
{
if (static::hasIntl()) {
return transliterator_transliterate('Any-Latin; NFKD', $string);
return transliterator_transliterate(static::$transliterator, $string);
} else {
return str_replace(array_keys(static::$transliteration), static::$transliteration, $string);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment