Skip to content

Instantly share code, notes, and snippets.

@mdepolli
Created September 8, 2012 12:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdepolli/3674398 to your computer and use it in GitHub Desktop.
Save mdepolli/3674398 to your computer and use it in GitHub Desktop.
Titleize equivalent for pt-BR
def br_titleize(word)
humanize(underscore(word)).gsub(/(?!(?<= )(de|da|do|das|dos|d'|e|a|o)\b)(\b[a-z\u00E0-\u00FC])/) { |s| s.mb_chars.capitalize.to_s }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment