Perhaps an incremental solution would be better -- add support for Central European characters first and see if there's a need for a more elaborate solution.
Only thing I have against this is that I believe all code should be written in English (I'm Danish myself). Cheers, Daniel On Sat, Jan 3, 2009 at 11:54 AM, 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 -~----------~----~----~----~------~----~------~--~---
