Add french inflections rules for nouveau=>nouveaux

This commit is contained in:
Mathieu Magnin 2017-07-04 17:14:59 +02:00
parent 622a170793
commit eb2a33138c
2 changed files with 26 additions and 10 deletions

View file

@ -15,22 +15,22 @@
.stats-number
= dossier_count
.stats-legend
= "dossier".pluralize(dossier_count)
= "dossier".pluralize(dossier_count, :fr)
%li
- nouveaux_count = @dossiers_nouveaux_count_per_procedure[p.id] || 0
.stats-number
= nouveaux_count
.stats-legend
= "nouveau".pluralize(nouveaux_count)
= "nouveau".pluralize(nouveaux_count, :fr)
%li
- followed_count = @followed_dossiers_count_per_procedure[p.id] || 0
.stats-number
= followed_count
.stats-legend
= "suivi".pluralize(followed_count)
= "suivi".pluralize(followed_count, :fr)
%li
- archived_count = @dossiers_archived_count_per_procedure[p.id] || 0
.stats-number
= archived_count
.stats-legend
= "archivé".pluralize(archived_count)
= "archivé".pluralize(archived_count, :fr)

View file

@ -18,12 +18,28 @@ ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.irregular('avis', 'avis')
end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym 'RESTful'
# end
# From https://github.com/davidcelis/inflections
ActiveSupport::Inflector.inflections(:fr) do |inflect|
inflect.clear
inflect.plural(/$/, 's')
inflect.plural(/(hib|ch|bij|caill|p|gen|jouj)ou$/i, '\1oux')
inflect.irregular('avis', 'avis')
inflect.singular(/s$/, '')
inflect.plural(/(bijou|caillou|chou|genou|hibou|joujou|pou|au|eu|eau)$/, '\1x')
inflect.singular(/(bijou|caillou|chou|genou|hibou|joujou|pou|au|eu|eau)x$/, '\1')
inflect.plural(/(bleu|émeu|landau|lieu|pneu|sarrau)$/, '\1s')
inflect.plural(/al$/, 'aux')
inflect.plural(/ail$/, 'ails')
inflect.singular(/(journ|chev)aux$/, '\1al')
inflect.singular(/ails$/, 'ail')
inflect.plural(/(b|cor|ém|gemm|soupir|trav|vant|vitr)ail$/, '\1aux')
inflect.singular(/(b|cor|ém|gemm|soupir|trav|vant|vitr)aux$/, '\1ail')
inflect.plural(/(s|x|z)$/, '\1')
inflect.irregular('monsieur', 'messieurs')
inflect.irregular('madame', 'mesdames')
inflect.irregular('mademoiselle', 'mesdemoiselles')
end