• Proposal concerning default transliteration in 1.6

2 views
Skip to first unread message

infograf768

unread,
Dec 18, 2009, 9:48:47 AM12/18/09
to Joomla! CMS Development
As you may know, Ercan has added in code the possibility of specific
transliteration per language by including a xx-XX.transliterate.php
file in the xx-XX language pack.
I already proposed here a default one to use in en-GB to enlarge the
limited transliteration we have in language.php through the
transliterate function.

See http://groups.google.com/group/joomla-dev-cms/browse_thread/thread/c8abbff7f67f9a85?hl=en-GB#

Since Ian has added in 1.6 core the phputf8 library 2 days ago, I
propose we use that library for basic transliteration instead of the
present code. This would save most latin languages adding a specific
xx-XX.transliterate.php file.

Code could be something like:

---------------------------------------
function transliterate($string)
{
include_once
(JPATH_SITE.DS.'libraries'.DS.'phputf8'.DS.'utils'.DS.'ascii.php');

if ($this->_transliterator !== null) {
return call_user_func($this->_transliterator, $string);
}

$string = utf8_accents_to_ascii($string); // function available in
the phputf8 library
$string = JString::strtolower($string);

return $string;
}
--------------
instead of
----------------
function transliterate($string)
{
if ($this->_transliterator !== null) {
return call_user_func($this->_transliterator, $string);
}

$string = htmlentities(utf8_decode($string));
$string = preg_replace(
array('/ß/','/&(..)lig;/', '/&([aouAOU])uml;/','/&(.)[^;]
*;/'),
array('ss',"$1","$1".'e',"$1"),
$string);

return $string;
}
--------------
what do you think?

Reply all
Reply to author
Forward
0 new messages