A good smal module. Just one option please be added. Transliteration.

CommentFileSizeAuthor
#2 001-transliteration-fix.patch925 bytesrightclick
t.jpg93.17 KBmpa3b

Comments

rc_100’s picture

Assigned: mpa3b » rc_100
Status: Active » Postponed

That's a lot of hypens! I'm adding transliteration to the list of features to add. Thanks for the feedback!

rightclick’s picture

StatusFileSize
new925 bytes

I had this issue with 7.x-1.x version too. I have a patch for it which can be easily modified for 6.x.

This patch also removes dots, and replaces two or more hyphens with a single one.

drupov’s picture

Version: 6.x-1.2 » 7.x-1.0-beta1

My menu items are in cyrillic and the patch from #2 makes them appear in cyrillic too:
<li class="leaf контакт">
which is not ok, I don't want to have cyrillic characters in my css. So there's actually no transliteration gonig on...

Before the patch the additional css didn't appear at all, but there was one blank space instead:
<li class="leaf ">

ArsenBespalov’s picture

Issue summary: View changes
Status: Postponed » Fixed

If you want transliteration your menu items cyrillic names, you must added this function to end module file:

//
// transliteration from cyrillic to translit with UTF-8 encoding
//
function mb_transliterate($string)
{ 
		$table = array( 
								'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 
								'Е' => 'E', 'Ё' => 'YO', 'Ж' => 'ZH', 'З' => 'Z', 'И' => 'I', 
								'Й' => 'J', 'К' => 'K', 'Л' => 'L', 'М' => 'M', 'Н' => 'N', 
								'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T', 
								'У' => 'U', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C', 'Ч' => 'CH', 
								'Ш' => 'SH', 'Щ' => 'SCH', 'Ь' => '', 'Ы' => 'Y', 'Ъ' => '', 
								'Э' => 'E', 'Ю' => 'YU', 'Я' => 'YA', 
 
								'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 
								'е' => 'e', 'ё' => 'yo', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 
								'й' => 'j', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n',
								'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 
								'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', 
								'ш' => 'sh', 'щ' => 'sch', 'ь' => '', 'ы' => 'y', 'ъ' => '', 
								'э' => 'e', 'ю' => 'yu', 'я' => 'ya', 
		); 
 
		$output = str_replace( 
				array_keys($table), 
				array_values($table),$string 
		); 
 
		$output = preg_replace('/[^-a-z0-9._\[\]\'"]/i', ' ', $output);
		$output = preg_replace('/ +/', '-', $output);
 
		return $output; 
}

and then use this function in _make_class_name function, like this:

function _make_class_name($text) {
	// do main text conversion to class name,
	// then remove double hyphens or hyphens at beginning or end of class name
	$text = mb_transliterate($text);
	$text = drupal_strtolower(preg_replace('/(\s?&amp;\s?|[^-_\w\d])/i', '-', trim(strip_tags($text))));
	$text = preg_replace('/(^-+|-+$)/', '', $text);
	$text = preg_replace('/--+/', '-', $text);
	return $text;
}

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.