Created
September 8, 2012 12:27
-
-
Save mdepolli/3674398 to your computer and use it in GitHub Desktop.
Titleize equivalent for pt-BR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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