Ruslan Ulanov’s Codeshack

The developer’s notebook

Archive for the ‘wordpress’ tag

Cyr2Lat Slugs – WordPress Plugin

10 comments

?? ??????? ??????? ????…

If you happen to write Word Press posts in one of the Cyrillic-based languages (i.e. Russian, Bulgarian, Ukrainian, Belarusian, etc.) and are using post’s title in Permalinks then you know that your post’s URL will become an unreadable mash of encoded characters (like %45%f0%…)

I got finally tired of changing encoded slugs to their latin equivalents on my son’s blog, and started looking for ways to automate this process. The Cyrillic Slugs plug-in written by Petko Bossakov was my only alternative at the time in WordPress plug-in repository. Unfortunatelly that plug-in didn’t work for me, since Cyrillic Slugs expects the page to be written in Windows-1251 encoding, and my blog uses WP’s default/recommended UTF-8. Hence Cyr2Lat Slugs plug-in was born.

Here’s a sample that illustrates what this plug-in does.

Before Cyr2Lat Slugs:

  1. You write a post with title “?????? ?????????”
  2. WordPress creates permalink like this:
    http://www.myblog.com/2008/12/19/%d0%bf%d1%80%d…b2%d0%ba%d0%b0

After Cyr2Lat Slugs:

  1. You write a post with title “?????? ?????????”
  2. WordPress creates permalink like this:
    http://www.myblog.com/2008/12/19/primer-zagolovka

Cyr2Lat Slugs is based on Petko’s original idea and uses one of his functions, but otherwise is written in a more contemporary, object-oriented fashion. It also uses strtr function instead of str_replace which should be much faster.

Please note that you have to save post (click Save or Publish button) for slug conversion to take place!

Version: 1.0
Requirements: WP 2.3+ (WP MU compatible)
Author: Ruslan Ulanov
License: GPL

Download Cyr2Lat Slugs plug-in now.

Installation:

  1. Copy file cyr2lat-slugs.php to folder wp-content/plugins/ on your server.
  2. Activate Cyr2Lat Slugs in Plugins menu of your blog’s admin interface.
  3. You’re done. There are no options to configure.

Comments are welcome (moderated, no spam please).

 
#
*In Russian*

Cyr2Lat Slugs ??? ?????? ??? ????????? Word Press, ??????? ????????? ??????? ????? ? ????????? ????? ? ???????? (????????), ??? ????? ????? URL ???????? ? ????????? ??? ???????????.

???????????????? ?????? ??????? Cyr2Lat Slugs ?? ???????.

?? ????????? Cyr2Lat Slugs:

  1. ?? ?????? ???? ? ?????????? “?????? ?????????”
  2. WordPress ??????? ??? ???? ?????????:
    http://www.myblog.com/2008/12/19/%d0%bf%d1%80%d…b2%d0%ba%d0%b0

????? ????????? Cyr2Lat Slugs:

  1. ?? ?????? ???? ? ?????????? “?????? ?????????”
  2. WordPress ??????? ??? ???? ?????????:
    http://www.myblog.com/2008/12/19/primer-zagolovka

??????????: ???? ?????????? ????????? (?????? ?????? Save ??? Publish), ????? ????????? ??? ????????? ? ????????!

??????: 1.0
??????????: WP 2.3+ (???????? ? WP MU)
?????: ?????? ??????
????????: GPL

????????? Cyr2Lat Slugs.

?????????:

  1. ?????????? ???? cyr2lat-slugs.php ? ????? wp-content/plugins/ ?? ???????.
  2. ??????????? Cyr2Lat Slugs ? ???? Plugins ????????????????? ?????????? ?????? ?????.
  3. ??????. ?????? ?????? ??????????????? ?? ????.

??????????? ?????????????? (?? ????????????, ??? ?????????? ?????).

Written by Ruslan Ulanov

December 10th, 2008 at 7:41 pm

Posted in PHP

Tagged with