GetSimple Support Forum

Full Version: slug Transliteration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I have Zegnåt's slug Transliteration script - http://get-simple.info/extend/plugin/slu...ration/33/ and it works fine with GS 2.03.

But it does not work with GS 3.0. I am not a programmer but I think there should be very minor updates/changes done in this script. May be anybody familiar with PHP could tell me what should be fixed? Thank you Smile Smile Smile

The script:

Code:
<?php
    $tf = basename(__FILE__,'.php');
    register_plugin(
        $tf,
        '<code>slug</code> Transliteration',
        '2',
        'Martijn van der Ven',
        'http://zegnat.com/',
        'If you use a language with non ASCII characters <a href="http://en.wikipedia.org/wiki/Transliteration">transliteration</a> can be used by GetSimple to change your page titles into slugs.'
    );
    add_action('changedata-save','translit');
    function translit($t=false,$m=false) {
        global $i18n;
        if (is_array($a=$m)||is_array($a=@$i18n['TRANSLITERATION'])||is_array($a=@$i18n['TRANSLIT'])) {
            if (!$t&&isset($_POST['submitted'])) {
                global $url, $xml, $file;
                $t = ($u=$_POST['post-id'])?$u:($u=$_POST['post-title'])?$u:'temp';
                $url = clean_url(to7bit(str_replace(array_keys($a),array_values($a),$t)));
                unset($xml->url);
                $note = $xml->addChild('url');
                $note->addCData($url);
                $file = GSDATAPAGESPATH.$url.".xml";
                return true;
            }
            return str_replace(array_keys($a),array_values($a),$t);
        }
        else return false;
    }
?>
arthur_a_keen Wrote:I have Zegnåt's slug Transliteration script - http://get-simple.info/extend/plugin/slu...ration/33/ and it works fine with GS 2.03. But it does not work with GS 3.0.
Can you please provide us with a wee bit more info? A few examples of what you entered wouldn't hurt either. We misplaced our crystal balls the other day. Smile

Have you tried re-installing the plugin?

I use it with German umlauts (ÄäÖöÜü) and it works fine here.

There's another thread about the plugin which involves Russian users, maybe you'll find some answers there?
polyfragmented Wrote:
arthur_a_keen Wrote:I have Zegnåt's slug Transliteration script - http://get-simple.info/extend/plugin/slu...ration/33/ and it works fine with GS 2.03. But it does not work with GS 3.0.
Can you please provide us with a wee bit more info? A few examples of what you entered wouldn't hurt either. We misplaced our crystal balls the other day. Smile

Have you tried re-installing the plugin?

I use it with German umlauts (ÄäÖöÜü) and it works fine here.

There's another thread about the plugin which involves Russian users, maybe you'll find some answers there?

This thread is AN old one. It is regarding GS 2.03.

My GS 2.03 works fine with it. But GS 3.0 does not work at all - it does not convert Cyrillic letters/symbols.
I have installed slug transliteration but its not working for me.

I am not using german or russian, using turkish.

in wordpress default slug system, i dont have any problem but GS's slug system and also slug transliteration i didnt get true slugs (i have to modify slug whenever add a page)

can you help for that matter? for turkish language i can list irregular letters (no-latin) and slug options:

[non-latin] = slug

[iı][İI] = i
[oö][OÖ] = o
[uü][UÜ] = u
[sş][SŞ] = s
[gğ][GĞ] = g
[cç][CÇ] = c // its already convert true

these are all our non-latin characters.

or how modify slug transliteraton plug-in for turkish users.

thanks
You have to add a translit array to your language file.
The system has to take necessary information; it isn't being held magically.

Code:
Such array should look:
"TRANSLITERATION" => array(
  "ğ"=>"g","Ç"=>"C"
),
and so on, add your letters and don't forget to save translation file in utf-8 w/o bom format/
Hi again,

I am not php master =) and i didn't understand which language file?

I have modified admin/lang/en_US.php file which i used for my site language and added that code inside

Code:
"TRANSLITERATION" => array("Ç"=>"c","ç"=>"c","Ğ"=>"g","ğ"=>"g","ı"=>"i","İ"=>"i","ş"=>"s","Ş"=>"s","Ö"=>"o","Ö"=>"o"),

so nothing changed; agian when i create a page its not convert non-latin.

If i need to modify also plugin/slugtranslit.php, please let me know where exactly:


Code:
]<?php
$tf = basename(__FILE__,'.php');
register_plugin(
  $tf,
  '<code>slug</code> Transliteration',
  '2',
  'Martijn van der Ven',
  'http://zegnat.com/',
  'If you use a language with non ASCII characters <a href="http://en.wikipedia.org/wiki/Transliteration">transliteration</a> can be used by GetSimple to change your page titles into slugs.'
);
add_action('changedata-save','translit');
function translit($t=false,$m=false) {
  global $i18n;
  if (is_array($a=$m)||is_array($a=@$i18n['TRANSLITERATION'])||is_array($a=@$i18n['TRANSLIT'])) {
   if (!$t&&isset($_POST['submitted'])) {
    global $url, $xml, $file;
    $t = ($u=$_POST['post-id'])?$u:($u=$_POST['post-title'])?$u:'temp';
    $url = clean_url(to7bit(str_replace(array_keys($a),array_values($a),$t)));
    unset($xml->url);
    $note = $xml->addChild('url');
    $note->addCData($url);
    $file = GSDATAPAGESPATH.$url.".xml";
    return true;
   }
   return str_replace(array_keys($a),array_values($a),$t);
  }
  else return false;
}
?>

or I am working on wrong places? =(
Did you save language file in utf8 format as I mentioned ?
yipuu! i thought DW take care about it but i am worng =) I changed the file utf-8 and now works perfectly!

thanks your amazing help.