Hi Norman,

great work!

As just said on rails-core, I'd like to see this functionality in I18n if you 
were cool with that.

I wouldn't be too concerned about performance for starters but rather 
pluggability/extensibility. Figure out a good api and hook in a simple, initial 
implementation that works for most cases. I would guess your's does. As long as 
people can plug in their own implementation and improvements while Rails still 
ships with a basic but stable version everybody will be happy :)


On Apr 14, 2010, at 10:42 PM, Norman Clarke wrote:

> Hi all,
> 
> The other day I sent a patch to Rails to improve
> ActiveSupport::Inflector's support for transliterating UTF-8 Latin
> characters to ASCII.
> 
> In the discussion of the patch, I mentioned the idea of making
> Inflector.transliterate use Rails' i18n facilities, and Jeremy Kemper
> and Yaroslav Markin encouraged me to pursue the idea.
> 
> http://github.com/rails/rails/commit/dceef0828a23e8298dd9a9aab1a33c49e84f17d6#activesupport/lib/active_support/inflector/transliterate.rb-P50
> 
> I've been working on support for this and would like to ask for some
> feedback before sending a patch to Rails. My work can be found at:
> 
> http://github.com/norman/rails/tree/translit
> 
> Basically the new code lets you do things like this:
> 
>    I18n.backend.store_translations(:de, :support =>
> {:transliterations => {"ü" => "ue", "ö" => "oe"}})
>    assert_equal "Juergen Koehler",
> ActiveSupport::Inflector.transliterate("Jürgen Köhler")
> 
> Yaroslav, if you look in the tests you'll see I also basically stole
> your Russian transliterator verbatim. :)
> 
> One of my main concerns has been keeping reasonably good performance
> in a thread-safe manner. The new code memoizes the available
> transliterators in a class variable, which I'm a little hesitant about
> doing, but I think will be ok. If someone more experienced with
> thread-safety issues could advise me on that I'd be grateful.
> 
> Regards,
> 
> Norman
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "rails-i18n" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rails-i18n?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"rails-i18n" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-i18n?hl=en.

Reply via email to