You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
421 B
20 lines
421 B
# pluralize |
|
# |
|
# A Liquid filter to make it easy to form correct plurals. |
|
# |
|
# https://github.com/bdesham/pluralize |
|
|
|
module Pluralize |
|
def pluralize(number, singular, plural = nil) |
|
number = number.to_i |
|
if number == 1 |
|
"#{singular}" |
|
elsif plural.nil? |
|
"#{singular}s" |
|
else |
|
"#{plural}" |
|
end |
|
end |
|
end |
|
|
|
Liquid::Template.register_filter(Pluralize) |