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
-~----------~----~----~----~------~----~------~--~---