A good start point can be this plugin: http://github.com/rsl/stringex/tree/master
It already deals with accents to generate slugs. --- José Valim. http://josevalim.blogspot.com/ http://www.pagestacker.com/ On 3 jan, 11:54, Manfred Stienstra <[email protected]> wrote: > Hi Marcello, > > The fix for central european languages is relatively easy, but the > solution for languages in general is very hard. I'm a bit hesitant to > root for a solution that singles out a few languages and doesn't > support the rest. > > If you really want to explore this, it might be a good idea to start a > plugin that replaces the inflector implementation and see if other > people are interested? > > Manfred > > On Dec 31, 2008, at 5:47 PM, [email protected] wrote: > > > > > Not sure if this is a plugin functionality, so I am asking here. > > > By default rails works well in italian, except for not seeing accented > > vowels as vowels while doing underscore inflection. > > > <pre> > >>> "FacoltàController".underscore > > => "facoltàcontroller" > > </pre> > > > but it should be > > > <pre> > >>> "FacoltàController".underscore > > => "facoltà_controller" > > </pre> > > > Note the underscore after the 'à'. The fix is easy: > > > <pre> > > --- a/activesupport/lib/active_support/inflector.rb > > +++ b/activesupport/lib/active_support/inflector.rb > > @@ -205,8 +205,8 @@ module ActiveSupport > > # "ActiveRecord::Errors".underscore # => active_record/errors > > def underscore(camel_cased_word) > > camel_cased_word.to_s.gsub(/::/, '/'). > > - gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). > > - gsub(/([a-z\d])([A-Z])/,'\1_\2'). > > + gsub(/([A-ZÀ-Ù]+)([A-ZÀ-Ù][a-zà-ù])/,'\1_\2'). > > + gsub(/([a-zà-ù\d])([A-ZÀ-Ù])/,'\1_\2'). > > tr("-", "_"). > > downcase > > end > > </pre> > > > Should it go to core rails? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" 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/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
