Convert Greek Unicode strings to "greeklish" in ruby

Friday, November 14, 2008 8 comments
After digging around Ruby's Unicode handling (almost none, at least in 1.8) I found a way to transform Greek strings into the latin equivalents (also know as "greek-lish"). Here's a snippet which adds two methods on the String class: "greeklish" and the banged version "greeklish!". To use it you'll need RubyGems and ActiveSupport (if you have rails these are already included).

There it goes (you won't be able to see the code from your feedreader probably - sorry for that :/ ):

Greek localization for Rails with Globalite plugin

Tuesday, November 11, 2008 3 comments

I just finished translating the Globalite plugin in Greek and I'm really happy about it. I've already sent a pull request to Matt Aimonetti and hopefully it will get merged soon it is now merged in the master globalite repo on github. You can check the language file hereSee the master repo.

Now that the base is established, I can continue and localize the Community Engine app :).

P.S.: Btw, feel free to use this file in other localization situations.

How to fake the :first-letter CSS selector with javascript

Sunday, November 2, 2008 3 comments
I was playing with sIFR 3 for a client's project and I was trying to use the :first-letter CSS selector inside the sIFR replaced flash text. If I get it right this is not supported so I made the following hack:

Suppose that we have the following markup:

Inside the head part of the html page (or in an external js file that is loaded before the sIFR activation) I put this small script:

Now, all we have to do when we call sIFR.replace is to add the following CSS rule:

Let's wrap it up now, shall we?

Obviously, for the above to work you will need the appropriate swf files and a basic knowledge of how to use sIFR. For more info you can take a look at this tutorial.

Disclaimer: I know this is not the cleanest solution possible but it's a quick and dirty way of getting the functionality you want on some specific headings, etc... Please don't copy & paste the previous snippet cause there are high chances that it won't work! Customize it for your own needs and requirements and let me know of any recommendations/suggestions :)