Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Definitive article is capitalized... shoud it be? #1

Open
sshaw opened this issue Dec 12, 2012 · 1 comment
Open

Definitive article is capitalized... shoud it be? #1

sshaw opened this issue Dec 12, 2012 · 1 comment

Comments

@sshaw
Copy link

sshaw commented Dec 12, 2012

Hi!

Given the below example, shouldn't AS be in lowercase?

irb > 'HARRY POTTER E AS RELÍQUIAS DA MORTE: PARTE 2'.titleize_pt_br
 => "Harry Potter e As RelÍquias da Morte: Parte 2"

While I'm not necessary a fan of such chicanery, have you considered an interface like this (untested):

module TitleizePTBR
  def self.include(m)
    if m.instance_methods.include? :titleize
      m.class_eval  do 
        alias :old_titleize :titleize
        def titleize(*locale)  
           locale.first == :pt_BR ? titleize_pt_br : old_titleize  # check arity  of old_titleize
        end
      end
    end
  end

  def titleize_pt_br
     # ...
  end
end

class String
  include TitleizePTBR
end

s="surra de bunda"
p s.titleize            # Surra De Bunda
p s.titleize(:pt_BR)     # Surra de Bunda
@beneti
Copy link
Owner

beneti commented Dec 12, 2012

Hi, I need to check brazilian portuguese grammar, but I think you are right. And there is an error, there is an accent in the world 'RELÍQUIAS' and it isn't in uppercase. I will study your suggestion. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants