Permalink
Browse files

subo el archivo de inflexiones

  • Loading branch information...
1 parent d9f9016 commit 3c165fa4916776ded29037fa557741c8a59d2b06 @movihus committed Feb 2, 2012
Showing with 28 additions and 0 deletions.
  1. +28 −0 config/initializers/inflections.rb
View
28 config/initializers/inflections.rb
@@ -8,3 +8,31 @@
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
+
+
+ActiveSupport::Inflector.inflections do |inflect|
+ inflect.plural /([aeiou])([A-Z]|_|$)/, '\1s\2'
+ inflect.plural /([rlnd])([A-Z]|_|$)/, '\1es\2'
+ inflect.plural /([aeiou])([A-Z]|_|$)([a-z]+)([rlnd])($)/, '\1s\2\3\4es\5'
+ inflect.plural /([rlnd])([A-Z]|_|$)([a-z]+)([aeiou])($)/, '\1es\2\3\4s\5'
+ inflect.singular /([aeiou])s([A-Z]|_|$)/, '\1\2'
+ inflect.singular /([rlnd])es([A-Z]|_|$)/, '\1\2'
+ inflect.singular /([aeiou])s([A-Z]|_)([a-z]+)([rlnd])es($)/, '\1\2\3\4\5'
+ inflect.singular /([rlnd])es([A-Z]|_)([a-z]+)([aeiou])s($)/, '\1\2\3\4\5'
+
+# Se agregan inflectores para todos los casos de detalle_ y detalles_
+# Ejs.:
+# detalle_pendiente_aprobacion -> detalles_pediente_aprobacion
+# detalle_rechazo -> detalles_rechazo
+ inflect.plural /(\bdetalle)(\w+|_|$)/, '\1s\2'
+ inflect.plural /(\bdetalles)(\w+|_|$)/, '\1\2'
+ inflect.singular /(\bdetalle)s(\w+|_|$)/, '\1\2'
+
+ # Para evitar errores de pluralización utilizados por formtastic al utilizar i18n
+ # (https://github.com/justinfrench/formtastic/blob/master/lib/formtastic.rb#L1850)
+ inflect.irregular 'label', 'labels'
+ inflect.irregular 'title', 'titles'
+ inflect.irregular 'hint', 'hints'
+ inflect.irregular 'action', 'actions'
+end
+

0 comments on commit 3c165fa

Please sign in to comment.