Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Include the slug transliteration plugin into the core of GS
#19
Zegnåt Wrote:
mvlcek Wrote:These strings would be UTF-8, thus all languages are supported. The transliteration function would need to split the string with mb_substr (or similar) to create the arrays needed for strtr (or whatever). As this splitting is only done when saving pages, there is no performance hit.
(Emphasis mine.)

Spitting is exactly the problem, take the following example:
Code:
...
'TRANSLITERATION' => array('æ'=>'ae','ꝛ'=>'r','ß'=>'ss'),
'TRANSLIT_FROM' => 'æꝛß',
'TRANSLIT_TO' => 'aerss',
...
The array works and will transliterate æ to ae and ß to ss. The strings will not work, they will turn æ into a (swapping the first characters) and ß into r (swapping the third characters). There is no way to teach a string splitter when 2 characters might go together.

OK, didn't think about replacing one character by multiple ones. You could of course use a comma-separated string like:
Code:
'TRANSLIT_FROM' => 'æ,ꝛ,ß',
'TRANSLIT_TO' => 'ae,r,ss',
By using a associative array it is easier matching from and to characters; it just introduces a special case for the translation file, what I personally don't like ;-)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.


Messages In This Thread
Include the slug transliteration plugin into the core of GS - by mvlcek - 2011-06-15, 04:15:26



Users browsing this thread: 2 Guest(s)