Module:Grammar/Conjugate: Difference between revisions

m
no edit summary
(add 'were' -> 'was')
mNo edit summary
Line 2: Line 2:


function p.pluralize(str, apostrophe)
function p.pluralize(str, apostrophe)
apostrophe = apostrophe or ''
  apostrophe = apostrophe or ''
local irregularplurals = {}
  local irregularplurals = {
 
    man = 'men'
if (str:sub(-1) == 's') then
  }
        return (str .. apostrophe)  --return unmodified (ends with 's', like 'boots', so we shouldn't append another 's')
  if irregularplurals[str] ~= nil then
    elseif (string.sub(str, -1) == 'y') and apostrophe == '' then
    return irregularplurals[str]
        return (string.sub(str, 1, -2) ..  'ies')
  elseif (str:sub(-1) == 's') then
    elseif (str:sub(-1) == 'z' or str:sub(-2) == 'ch' or str:sub(-2) == 'sh' or str:sub(-1) == 'x') and apostrophe == '' then
    return (str .. apostrophe)  --return unmodified (ends with 's', like 'boots', so we shouldn't append another 's')
        return (str ..  'es')
  elseif (string.sub(str, -1) == 'y') and apostrophe == '' then
    else
    return (string.sub(str, 1, -2) ..  'ies')
        return (str.. apostrophe .. 's')
  elseif (str:sub(-1) == 'z' or str:sub(-2) == 'ch' or str:sub(-2) == 'sh' or str:sub(-1) == 'x') and apostrophe == '' then
    end
    return (str ..  'es')
  else
    return (str.. apostrophe .. 's')
  end
end
end