Friday, 18 November 2016 09:05

Aliases and Transliteration Files

Working with alias fields and transliteration led me to conclusion that translation teams not always do good work. For example, sometimes it happens that certain Cyrillic symbols are translated in alias field with some unwanted characters. For serbian users, "ш" in title becomes "sh" in alias, "ч" is "ch". Pronounced, "sh" sounds exactly like "ш", but who cares about pronunciation in this case?! I want to be able to pronounce whole url to someone and I want him to be able to write it down correctly and perhaps visit that address. Now, if my url contains word "зашто" (why in english), I'd like it to be "zasto" in alias and transliterated to latin. Why? Because in latin, serbian "ш" is "š", which in non-accented alias becomes, of course - "s". That logic works in minds of ordinary people... To make long story short (somehow), editing file /languages/sr-RS/sr-RS.localise.php is solution for this problem. Particular array that needs to be edited is $glyph_array. You'll be able to easily spot what changes to what there and feel free to edit it. What follows is part of that file and as you can see, it's used for latin 1, latin supplement , extended A, Cyrillic and Greek set of characters, accented or unaccented.

Same story goes for letters "ђ" and "Ђ" which should be "d" and "D". Solution provided below in highlighted lines.

		//Specific language transliteration.
		//This one is for latin 1, latin supplement , extended A, Cyrillic, Greek

		$glyph_array = array(
		'a'		=>	'à,á,â,ã,ä,å,ā,ă,ą,ḁ,α,ά',
		'ae'	=>	'æ',
		'b'		=>	'β,б',
		'c'		=>	'ç,ć,ĉ,ċ,č,ч,Ч,ћ,Ћ,ц,Ц',
		'd'		=>	'д,Д',
		'dj'	=>	'ď,đ,Ð,ђ,Ђ,δ,ð',
		'dz'	=>	'џ,Џ',
		'e'		=>	'è,é,ê,ë,ē,ĕ,ė,ę,ě,э,ε,έ',
		'f'		=>	'ƒ,ф',
		'g'		=>	'ğ,ĝ,ğ,ġ,ģ,г,γ',
		'h'		=>	'ĥ,ħ,Ħ,х',
		'i'		=>	'ì,í,î,ï,ı,ĩ,ī,ĭ,į,и,й,ъ,ы,ь,η,ή',
		'ij'	=>	'ij',
		'j'		=>	'ĵ',
		'ja'	=>	'я',
		'ju'	=>	'яю',
		'k'		=>	'ķ,ĸ,κ',
		'l'		=>	'ĺ,ļ,ľ,ŀ,ł,л,λ',
		'lj'	=>	'љ,Љ',
		'm'		=>	'μ',
		'n'		=>	'ñ,ņ,ň,ʼn,ŋ,н,ν',
		'nj'	=>	'њ,Њ',
		'o'		=>	'ò,ó,ô,õ,ø,ō,ŏ,ő,ο,ό,ω,ώ',
		'oe'	=>	'œ,ö',
		'p'		=>	'п,π',
		'ph'	=>	'φ',
		'ps'	=>	'ψ',
		'r'		=>	'ŕ,ŗ,ř,р,ρ,σ,ς',
		's'		=>	'ş,ś,ŝ,ş,š,с',
		'ss'	=>	'ß,ſ',
		's'		=>	'ш,Ш',
		'shch'	=>	'щ',
		't'		=>	'ţ,ť,ŧ,τ',
		'th'	=>	'θ',
		'u'		=>	'ù,ú,û,ü,ũ,ū,ŭ,ů,ű,ų,у',
		'v'		=>	'в',
		'w'		=>	'ŵ',
		'x'		=>	'χ,ξ',
		'y'		=>	'ý,þ,ÿ,ŷ',
		'z'		=>	'ź,ż,ž,з,ж,Ж,ζ'

Particular example is highlighted in above code and this is solution we use. Also, we use system plugin of our own, YU Alias system plugin, which is free to download and use. These 2 solutions make our aliases work exactly as I want them to work. For some reason, K2 extension requires changes in XX-xx.localize.php file for some characters, at least for ex-YU countries. Read about this in serbian in Joomla forum, too.

Read 659 times Last modified on Monday, 22 May 2017 13:16
Login to post comments