Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

howto add cyryllic support to SS_Transliterator?

Go to End

5 Posts   897 Views


Community Member, 89 Posts

4 January 2013 at 1:58am

I simply modify in /framework/model/Transliterator.php function useStrTr()
Add to $table array next

$table = array(
			'Ā'=>'A', 'ā'=>'a', 'Ē'=>'E', 'ē'=>'e', 'Ī'=>'I', 'ī'=>'i', 'Ō'=>'O', 'ō'=>'o', 'Ū'=>'U', 'ū'=>'u',
			'œ'=>'oe', 'ß'=>'ss', 'ij'=>'ij', 'ą'=>'a','ę'=>'e', 'ė'=>'e', 'į'=>'i','ų'=>'u','ū'=>'u', 'Ą'=>'A',
			'Ę'=>'E', 'Ė'=>'E', 'Į'=>'I','Ų'=>'U','Ū'=>'u',
		'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Ѓ' => 'G`',
		'Ґ' => 'G`', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'YO', 'Є' => 'YE',
		'Ж' => 'ZH', 'З' => 'Z', 'И' => 'I', 'Й' => 'J',
		'І' => 'I', 'Ї' => 'YI', 'К' => 'K', 'Ќ' => 'K`',
		'Л' => 'L', 'Љ' => 'L', 'М' => 'M', 'Н' => 'N', 'Њ' => 'N`',
		'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T',
		'У' => 'U', 'Ў' => 'U`', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'TS',
		'Ч' => 'CH', 'Џ' => 'DH', 'Ш' => 'SH', 'Щ' => 'SH', 'Ъ' => '``',
		'Ы' => 'Y`', 'Ь' => '`', 'Э' => 'E`', 'Ю' => 'YU', 'Я' => 'YA',
		'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'ѓ' => 'g',
		'ґ' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'yo', 'є' => 'ye',
		'ж' => 'zh', 'з' => 'z', 'ѕ' => 'z', 'и' => 'i', 'й' => 'j',
		'ј' => 'j', 'і' => 'i', 'ї' => 'yi', 'к' => 'k', 'ќ' => 'k`',
		'л' => 'l', 'љ' => 'l', 'м' => 'm', 'н' => 'n', 'њ' => 'n`',
		'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't',
		'у' => 'u', 'ў' => 'u`', 'ф' => 'f', 'х' => 'h', 'ц' => 'ts',
		'ч' => 'ch', 'џ' => 'dh', 'ш' => 'sh', 'щ' => 'shh', 'ъ' => '``',
		'ы' => 'y`', 'ь' => '`', 'э' => 'e`', 'ю' => 'yu', 'я' => 'ya'

Then appears in SS3 transliteration URLSegment. But after an upgrade SS I will lose this opportunity. How can this code not bind to /framework/ and put it in my Projects?


Community Member, 10 Posts

3 December 2015 at 1:35am

Hi WebSpilka,
did you find any solution for this issue?


Community Member, 89 Posts

3 December 2015 at 4:19am

No, I yet continue to modify the file /framework/model/Transliterator.php
I find article,
but I can not find the time to issue a decision in the extension


Community Member, 166 Posts

3 December 2015 at 9:37am

Hi WebSpilka,

You will need to look into extending the SS_Transliterator class.
I'm not sure if you can override an existing function (may very well be impossible with a protected function like "useStrTr") though.

If you extend inside your /mysite/code folder, you can update the cms and framework folders without breaking your site.



Community Member, 10 Posts

4 December 2015 at 5:33am

I found a solution. It works and I hope is right.
You should use Object::useCustomClass to override SS_Transliterator class.
Make sure the encoding of the new file is UTF8.